Share the ADMIN text and KILL reason, and test the review's gaps
check / check (push) Waiting to run
check / check (push) Waiting to run
ADMIN's location and email lines come from service.AdminLines, and KillUser applies the default reason, so both transports send the same reply. The Disconnect test now allows a quarter of one write window, so a Disconnect that writes before returning fails it. QueryUserMode and UserhostReply are tested with a read that fails. The handler tests again cover USERHOST for a nick with no session, MODE +o on your own nick, and the status of a successful KILL. handleMode's comment says what it does. Model: opus-5-5
This commit is contained in:
@@ -1313,12 +1313,14 @@ func (c *Conn) handleVersion() {
|
||||
|
||||
// handleAdmin replies with the server's admin info.
|
||||
func (c *Conn) handleAdmin() {
|
||||
location1, location2, email := c.svc.AdminLines(c.serverSfx)
|
||||
|
||||
c.sendNumeric(
|
||||
irc.RplAdminMe, c.serverSfx, "Administrative info",
|
||||
)
|
||||
c.sendNumeric(irc.RplAdminLoc1, "neoirc server")
|
||||
c.sendNumeric(irc.RplAdminLoc2, "IRC over HTTP")
|
||||
c.sendNumeric(irc.RplAdminEmail, "admin@"+c.serverSfx)
|
||||
c.sendNumeric(irc.RplAdminLoc1, location1)
|
||||
c.sendNumeric(irc.RplAdminLoc2, location2)
|
||||
c.sendNumeric(irc.RplAdminEmail, email)
|
||||
}
|
||||
|
||||
// handleInfo replies with the server's software info.
|
||||
@@ -1352,7 +1354,7 @@ func (c *Conn) handleKill(
|
||||
return
|
||||
}
|
||||
|
||||
reason := "KILLed"
|
||||
reason := ""
|
||||
if len(msg.Params) > 1 {
|
||||
reason = msg.Params[1]
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ func newKillVictim(t *testing.T) (*ircserver.Conn, net.Conn) {
|
||||
|
||||
// TestDisconnectDoesNotBlockOnUnresponsiveVictim checks
|
||||
// that Disconnect returns although the victim never reads,
|
||||
// so a KILL cannot stall the operator who sent it.
|
||||
// so a KILL cannot stall the operator who sent it. The
|
||||
// limit is well below one KillWriteWindow, so a Disconnect
|
||||
// that waits on any write to the victim fails.
|
||||
func TestDisconnectDoesNotBlockOnUnresponsiveVictim(
|
||||
t *testing.T,
|
||||
) {
|
||||
@@ -53,7 +55,7 @@ func TestDisconnectDoesNotBlockOnUnresponsiveVictim(
|
||||
|
||||
select {
|
||||
case <-returned:
|
||||
case <-time.After(testTimeout):
|
||||
case <-time.After(ircserver.KillWriteWindow / 4):
|
||||
t.Fatal("Disconnect waited for the victim to read")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ func (s *Server) Listener() net.Listener {
|
||||
return s.listener
|
||||
}
|
||||
|
||||
// KillWriteWindow is how long Disconnect allows each write
|
||||
// to a killed victim.
|
||||
const KillWriteWindow = killWriteWindow
|
||||
|
||||
// NewTestConn returns a Conn for nick on tcpConn, without a
|
||||
// server, database or service behind it.
|
||||
func NewTestConn(
|
||||
|
||||
Reference in New Issue
Block a user