1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-05-13 11:03:19 +00:00

Add tests for explicit and implicit (via EOF) shutdown; fix bug ;-)

This commit is contained in:
Alex Bramley 2011-08-23 10:53:52 +01:00
parent 770c5eb5ac
commit 7d9b8c3099
2 changed files with 85 additions and 1 deletions

View file

@ -265,11 +265,11 @@ func (conn *Conn) shutdown() {
// Guard against double-call of shutdown() if we get an error in send()
// as calling sock.Close() will cause recv() to recieve EOF in readstring()
if conn.Connected {
conn.Dispatcher.Dispatch("disconnected", conn, &Line{})
conn.Connected = false
conn.sock.Close()
conn.cSend <- true
conn.cLoop <- true
conn.Dispatcher.Dispatch("disconnected", conn, &Line{})
// reinit datastructures ready for next connection
// do this here rather than after runLoop()'s for due to race
conn.initialise()