Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add connection icon animation type and refactor connect logic #29

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

mixmasala
Copy link
Contributor

draft, because it is pinned to a PR branch of katzenpost.

this also probably breaks provider selection at startup.

do not merge.

fix deps: https://todo.sr.ht/~eliasnaur/gio/471
go get -u broke some dependencies of gio
when a previous Page becomes Current, call its Start method.
TODO: find a more elegant solution to make an animated connection icon.
create a new type to hold layout methods with a worker routine that
updates the connection icon while the page is displayed.
adds catshadow.Status() which indicates the current connection state of the client.
@mixmasala mixmasala marked this pull request as draft February 18, 2023 16:35
leif added 3 commits June 17, 2023 20:10
add re-pin to latest katzenpost@add_status_to_catshadow branch
triggered by attempting to build, but not by the go get which re-pinned katzenpost, wtf?
so, this builds now, but clicking the icon crashes with:

fatal error: sync: Unlock of unlocked RWMutex
case catshadow.StateConnecting:
// ignore
case catshadow.StateOffline:
a.c.Online(context.TODO())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

29% of developers fix this issue

G104: Errors unhandled.


ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

func (a *App) doConnectClick() {
switch a.c.Status() {
case catshadow.StateOnline:
a.c.Offline()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

29% of developers fix this issue

G104: Errors unhandled.


ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

@leif
Copy link
Member

leif commented Jun 17, 2023

I merged main in here, and main from katzenpost into katzenpost/katzenpost#239 and bumped this to use that, and fixed a few things to make it build, but, it crashes with fatal error: sync: Unlock of unlocked RWMutex when i click the button to connect:

fatal error: sync: Unlock of unlocked RWMutex

goroutine 104 [running]:
sync.fatal({0xe62a86?, 0x7f7f1316f338?})
	runtime/panic.go:1031 +0x1e
sync.(*RWMutex).Unlock(0xc0006a4c18)
	sync/rwmutex.go:209 +0x4a
github.com/katzenpost/katzenpost/catshadow.(*Client).goOnline(0xc000130200, {0xfc78d0, 0xc00003a428})
	github.com/katzenpost/[email protected]/catshadow/client.go:1434 +0xd9
github.com/katzenpost/katzenpost/catshadow.(*Client).worker.func2()
	github.com/katzenpost/[email protected]/catshadow/worker.go:79 +0x2d
created by github.com/katzenpost/katzenpost/catshadow.(*Client).worker
	github.com/katzenpost/[email protected]/catshadow/worker.go:79 +0x9be

goroutine 1 [select (no cases)]:
gioui.org/app.osMain(...)
	[email protected]/app/os_unix.go:43
gioui.org/app.Main(...)
	[email protected]/app/app.go:45
main.uiMain()
	github.com/katzenpost/katzen/katzen.go:208 +0x2c
main.main()
	github.com/katzenpost/katzen/katzen.go:192 +0xd2

goroutine 6 [chan receive]:
github.com/awnumar/memguard/core.NewCoffer.func1(0x0?)
	github.com/awnumar/[email protected]/core/coffer.go:39 +0x4d
created by github.com/awnumar/memguard/core.NewCoffer
	github.com/awnumar/[email protected]/core/coffer.go:36 +0x10f

goroutine 9 [runnable]:
main.(*HomePage).Layout.func1.2.1.1.1({{{0x0, 0x0}, {0x178, 0xf4230}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, 0x14fc5ba38, ...}, ...})
	github.com/katzenpost/katzen/home.go:129 +0x96
gioui.org/layout.Flex.Layout({0xd0?, 0x45?, 0x56?, 0xc0?}, {{{0x12c, 0x0}, {0x178, 0xf4230}}, {0x3f800000, 0x3f800000}, ...}, ...)
	[email protected]/layout/flex.go:99 +0xf5d
main.(*HomePage).Layout.func1.2.1.1({{{0x12c, 0x0}, {0x178, 0xf4230}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, 0x14fc5ba38, ...}, ...})
	github.com/katzenpost/katzen/home.go:127 +0x358
gioui.org/layout.Inset.Layout({0x0?, 0x0?, 0x1b?, 0x0?}, {{{0x12c, 0x0}, {0x178, 0xf4230}}, {0x3f800000, 0x3f800000}, ...}, ...)
	[email protected]/layout/layout.go:139 +0x39d
main.(*Background).Layout(0xc000564c48, {{{0x12c, 0x0}, {0x190, 0xf4240}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, ...}, ...}, ...)
	github.com/katzenpost/katzen/stack.go:59 +0x129
main.(*HomePage).Layout.func1.2.1({{{0x12c, 0x0}, {0x190, 0xf4240}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, 0x14fc5ba38, ...}, ...}, ...)
	github.com/katzenpost/katzen/home.go:120 +0x1a8
gioui.org/layout.(*List).Layout(0x1524c60, {{{0x12c, 0x0}, {0x190, 0xf4240}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, ...}, ...}, ...)
	[email protected]/layout/list.go:121 +0x17c
main.(*HomePage).Layout.func1.2({{{0x12c, 0x160}, {0x190, 0x160}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, 0x14fc5ba38, ...}, ...})
	github.com/katzenpost/katzen/home.go:106 +0x129
gioui.org/layout.Flex.Layout({0x0?, 0x0?, 0x0?, 0x0?}, {{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, ...}, ...)
	[email protected]/layout/flex.go:134 +0xb95
main.(*HomePage).Layout.func1({{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, 0x14fc5ba38, ...}, ...})
	github.com/katzenpost/katzen/home.go:89 +0x21d
gioui.org/layout.Inset.Layout({0x84ae88?, 0xc0?, 0x565860?, 0xc0?}, {{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, ...}, ...)
	[email protected]/layout/layout.go:139 +0x39d
main.(*Background).Layout(0xc000565ae0, {{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, ...}, ...}, ...)
	github.com/katzenpost/katzen/stack.go:59 +0x129
main.(*HomePage).Layout(0xc0004d0080, {{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, ...}, ...})
	github.com/katzenpost/katzen/home.go:87 +0x1c8
main.(*App).Layout(0xc000911db0, {{{0x190, 0x190}, {0x190, 0x190}}, {0x3f800000, 0x3f800000}, {0xfc0700, 0xc0009220d0}, {0xc11b9c424f30cb56, ...}, ...})
	github.com/katzenpost/katzen/katzen.go:82 +0x95
main.(*App).handleGioEvents(0xc000911db0, {0xde3800?, 0xc002d12840?})
	github.com/katzenpost/katzen/katzen.go:307 +0x738
main.(*App).run(0xc000911db0)
	github.com/katzenpost/katzen/katzen.go:169 +0x265
main.uiMain.func1()
	github.com/katzenpost/katzen/katzen.go:203 +0x19c
created by main.uiMain
	github.com/katzenpost/katzen/katzen.go:196 +0x25

goroutine 10 [select]:
gioui.org/app.(*Window).run(0xc000922000, {0xc00012a300?, 0x0?, 0x0?})
	[email protected]/app/window.go:966 +0x1d9
created by gioui.org/app.NewWindow
	[email protected]/app/window.go:190 +0x9ea

goroutine 11 [select, locked to thread]:
gioui.org/app.(*Window).waitFrame(0xc000922000, {0xfcc9e8, 0xc0001343c0})
	[email protected]/app/window.go:757 +0xea
gioui.org/app.(*Window).processEvent(0xc000922000, {0xfcc9e8, 0xc0001343c0}, {0xfc22e0?, 0xc002d127e0?})
	[email protected]/app/window.go:885 +0xa27
gioui.org/app.(*callbacks).Event(0xc0009224d8, {0xfc22e0?, 0xc002d127e0?})
	[email protected]/app/window.go:487 +0x13d
gioui.org/app.(*x11Window).loop(0xc0001343c0)
	[email protected]/app/os_x11.go:462 +0x37b
gioui.org/app.newX11Window.func12()
	[email protected]/app/os_x11.go:828 +0x194
created by gioui.org/app.newX11Window
	[email protected]/app/os_x11.go:820 +0x8f5

goroutine 84 [select]:
github.com/katzenpost/katzenpost/catshadow.(*Client).Online(0xc000130200, {0xfc78d0?, 0xc00003a428})
	github.com/katzenpost/[email protected]/catshadow/client.go:1416 +0x232
main.(*App).doConnectClick(0xc000911db0)
	github.com/katzenpost/katzen/katzen.go:92 +0x5e
created by main.(*App).update
	github.com/katzenpost/katzen/katzen.go:118 +0x632

goroutine 82 [select]:
github.com/katzenpost/katzenpost/catshadow.(*StateWriter).worker(0xc000478480)
	github.com/katzenpost/[email protected]/catshadow/disk.go:198 +0xd9
github.com/katzenpost/katzenpost/core/worker.(*Worker).Go.func1()
	github.com/katzenpost/[email protected]/core/worker/worker.go:39 +0x5a
created by github.com/katzenpost/katzenpost/core/worker.(*Worker).Go
	github.com/katzenpost/[email protected]/core/worker/worker.go:37 +0xb9

goroutine 83 [select]:
gopkg.in/eapache/channels%2ev1.(*InfiniteChannel).infiniteBuffer(0xc000b3c460)
	gopkg.in/eapache/[email protected]/infinite_channel.go:49 +0xf3
created by gopkg.in/eapache/channels%2ev1.NewInfiniteChannel
	gopkg.in/eapache/[email protected]/infinite_channel.go:19 +0x165

goroutine 33 [chan receive]:
github.com/katzenpost/katzenpost/client.New.func1()
	github.com/katzenpost/[email protected]/client/client.go:104 +0x35
created by github.com/katzenpost/katzenpost/client.New
	github.com/katzenpost/[email protected]/client/client.go:103 +0x165

goroutine 102 [select]:
github.com/katzenpost/katzenpost/catshadow.(*Client).worker(0xc000130200)
	github.com/katzenpost/[email protected]/catshadow/worker.go:58 +0x31c
github.com/katzenpost/katzenpost/core/worker.(*Worker).Go.func1()
	github.com/katzenpost/[email protected]/core/worker/worker.go:39 +0x5a
created by github.com/katzenpost/katzenpost/core/worker.(*Worker).Go
	github.com/katzenpost/[email protected]/core/worker/worker.go:37 +0xb9

goroutine 98 [select]:
main.(*connectIcon).Start.func1()
	github.com/katzenpost/katzen/connect.go:51 +0x85
created by main.(*connectIcon).Start
	github.com/katzenpost/katzen/connect.go:48 +0x72

goroutine 101 [select]:
github.com/katzenpost/katzenpost/catshadow.(*Client).eventSinkWorker(0xc000130200)
	github.com/katzenpost/[email protected]/catshadow/client.go:311 +0x13a
github.com/katzenpost/katzenpost/core/worker.(*Worker).Go.func1()
	github.com/katzenpost/[email protected]/core/worker/worker.go:39 +0x5a
created by github.com/katzenpost/katzenpost/core/worker.(*Worker).Go
	github.com/katzenpost/[email protected]/core/worker/worker.go:37 +0xb9

goroutine 103 [chan receive]:
github.com/katzenpost/katzenpost/client.(*Client).Wait(...)
	github.com/katzenpost/[email protected]/client/client.go:146
github.com/katzenpost/katzenpost/catshadow.(*Client).Start.func2()
	github.com/katzenpost/[email protected]/catshadow/client.go:226 +0x2f
created by github.com/katzenpost/katzenpost/catshadow.(*Client).Start
	github.com/katzenpost/[email protected]/catshadow/client.go:225 +0x12d

goroutine 100 [chan receive]:
github.com/katzenpost/katzenpost/catshadow.(*Client).Start.func1()
	github.com/katzenpost/[email protected]/catshadow/client.go:212 +0x35
created by github.com/katzenpost/katzenpost/catshadow.(*Client).Start
	github.com/katzenpost/[email protected]/catshadow/client.go:211 +0x5a

now it runs but isn't connecting
@leif
Copy link
Member

leif commented Jun 17, 2023

ok, now it doesn't crash, but, it also isn't connecting. i did see it animate briefly though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants