In neoirc-cli, cmdConnect in internal/cli/app.go makes a new stopPoll channel and starts a new pollLoop every time it succeeds. It never stops the poll loop of an earlier connection. After a second /connect, the first loop's channel is replaced without being closed, so that loop keeps running. Both loops then poll with the new client, and each message from the server can be shown twice. cmdConnect also writes stopPoll without a.mu while the first loop reads it. Found by the review of #227; read from the code on fe734af.
Fix: only one poll loop runs at a time. A /connect while connected stops the earlier poll loop before it starts a new one, and stopPoll is read and written under a.mu. Change nothing else.
Definition of done
After a second /connect, exactly one poll loop runs, and each message from the server is shown once.
Nothing reads or writes stopPoll without a.mu.
A test in internal/cli that connects twice to a test server and fails if the earlier poll loop is still polling.
One reviewed PR against next, cut after #226 and #225 have landed, since they change the same file.
Model: opus-5-5
In `neoirc-cli`, `cmdConnect` in `internal/cli/app.go` makes a new `stopPoll` channel and starts a new `pollLoop` every time it succeeds. It never stops the poll loop of an earlier connection. After a second `/connect`, the first loop's channel is replaced without being closed, so that loop keeps running. Both loops then poll with the new client, and each message from the server can be shown twice. `cmdConnect` also writes `stopPoll` without `a.mu` while the first loop reads it. Found by the review of https://git.eeqj.de/sneak/neoirc/pulls/227; read from the code on `fe734af`.
Fix: only one poll loop runs at a time. A `/connect` while connected stops the earlier poll loop before it starts a new one, and `stopPoll` is read and written under `a.mu`. Change nothing else.
## Definition of done
1. After a second `/connect`, exactly one poll loop runs, and each message from the server is shown once.
2. Nothing reads or writes `stopPoll` without `a.mu`.
3. A test in `internal/cli` that connects twice to a test server and fails if the earlier poll loop is still polling.
4. One reviewed PR against `next`, cut after https://git.eeqj.de/sneak/neoirc/issues/226 and https://git.eeqj.de/sneak/neoirc/issues/225 have landed, since they change the same file.
Model: opus-5-5
Fixed in #236: a second /connect now stops the earlier poll loop in the same locked step that replaces the client, and stopPoll is only read and written under a.mu.
Model: opus-5-5
Fixed in https://git.eeqj.de/sneak/neoirc/pulls/236: a second `/connect` now stops the earlier poll loop in the same locked step that replaces the client, and `stopPoll` is only read and written under `a.mu`.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In
neoirc-cli,cmdConnectininternal/cli/app.gomakes a newstopPollchannel and starts a newpollLoopevery time it succeeds. It never stops the poll loop of an earlier connection. After a second/connect, the first loop's channel is replaced without being closed, so that loop keeps running. Both loops then poll with the new client, and each message from the server can be shown twice.cmdConnectalso writesstopPollwithouta.muwhile the first loop reads it. Found by the review of #227; read from the code onfe734af.Fix: only one poll loop runs at a time. A
/connectwhile connected stops the earlier poll loop before it starts a new one, andstopPollis read and written undera.mu. Change nothing else.Definition of done
/connect, exactly one poll loop runs, and each message from the server is shown once.stopPollwithouta.mu.internal/clithat connects twice to a test server and fails if the earlier poll loop is still polling.next, cut after #226 and #225 have landed, since they change the same file.Model: opus-5-5
Fixed in #236: a second
/connectnow stops the earlier poll loop in the same locked step that replaces the client, andstopPollis only read and written undera.mu.Model: opus-5-5