Moves the reverse DNS lookup for an IRC client out of newConn, which acceptLoop called before it could accept the next connection, to the start of serve, which runs on the connection's own goroutine. A client whose address has no answering reverse DNS now holds up only its own registration, not every other IRC connect. Fixes #156.
newConn no longer takes a context; the lookup was its only use. The server holds the lookup function in a field, set to resolveHost by New, the same way it holds the ping times, and passes it to serve. NewTestServer takes it as a parameter, and the new test helper newTestEnvWithResolver passes one through.
The new test, TestRegistrationWhileAnotherLookupIsPending, gives the server a lookup that blocks for the first client until the server stops, then checks that a second client registers and that its welcome carries the hostname its own lookup returned.
Judgement call: the lookup is at the top of serve, not in completeRegistration, so it runs once per connection even when a nick is refused and the client tries again; a reply to an unregistered client waits for that client's own lookup, as it did before.
Judgement call: the test sets the lookup before the server starts, through NewTestServer, because a field changed after Start would race with the accept loop.
Not reproduced against a real reverse DNS server that does not answer; the test stands in for it with a lookup that blocks.
Model: opus-5-5
Moves the reverse DNS lookup for an IRC client out of `newConn`, which `acceptLoop` called before it could accept the next connection, to the start of `serve`, which runs on the connection's own goroutine. A client whose address has no answering reverse DNS now holds up only its own registration, not every other IRC connect. Fixes https://git.eeqj.de/sneak/neoirc/issues/156.
`newConn` no longer takes a context; the lookup was its only use. The server holds the lookup function in a field, set to `resolveHost` by `New`, the same way it holds the ping times, and passes it to `serve`. `NewTestServer` takes it as a parameter, and the new test helper `newTestEnvWithResolver` passes one through.
The new test, `TestRegistrationWhileAnotherLookupIsPending`, gives the server a lookup that blocks for the first client until the server stops, then checks that a second client registers and that its welcome carries the hostname its own lookup returned.
- Judgement call: the lookup is at the top of `serve`, not in `completeRegistration`, so it runs once per connection even when a nick is refused and the client tries again; a reply to an unregistered client waits for that client's own lookup, as it did before.
- Judgement call: the test sets the lookup before the server starts, through `NewTestServer`, because a field changed after `Start` would race with the accept loop.
- Not reproduced against a real reverse DNS server that does not answer; the test stands in for it with a lookup that blocks.
Model: opus-5-5
acceptLoop called newConn, which did the reverse DNS lookup, with its
three-second timeout, before the loop could accept the next
connection, so one client whose address had no answering reverse DNS
held up every other IRC connect. serve now does the lookup at its
start, on the connection's own goroutine, and the accept loop only
accepts.
The server keeps the lookup function in a field, as it does the ping
times, so that a test can give it one that blocks. The new test
checks that a second client registers while the first one's lookup
has not returned.
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.
Moves the reverse DNS lookup for an IRC client out of
newConn, whichacceptLoopcalled before it could accept the next connection, to the start ofserve, which runs on the connection's own goroutine. A client whose address has no answering reverse DNS now holds up only its own registration, not every other IRC connect. Fixes #156.newConnno longer takes a context; the lookup was its only use. The server holds the lookup function in a field, set toresolveHostbyNew, the same way it holds the ping times, and passes it toserve.NewTestServertakes it as a parameter, and the new test helpernewTestEnvWithResolverpasses one through.The new test,
TestRegistrationWhileAnotherLookupIsPending, gives the server a lookup that blocks for the first client until the server stops, then checks that a second client registers and that its welcome carries the hostname its own lookup returned.serve, not incompleteRegistration, so it runs once per connection even when a nick is refused and the client tries again; a reply to an unregistered client waits for that client's own lookup, as it did before.NewTestServer, because a field changed afterStartwould race with the accept loop.Model: opus-5-5
PASS
Model: opus-5-5