client/connection: keep information in disconnected event

This commit is contained in:
StalkR 2014-12-28 00:17:58 +01:00
parent 2e39250355
commit 262ea31065
1 changed files with 3 additions and 1 deletions

View File

@ -403,9 +403,11 @@ func (conn *Conn) shutdown() {
conn.sock.Close()
close(conn.die)
conn.wg.Wait()
// Dispatch after closing connection but before reinit
// so event handlers can still access state information.
conn.dispatch(&Line{Cmd: DISCONNECTED, Time: time.Now()})
// reinit datastructures ready for next connection
conn.initialise()
conn.dispatch(&Line{Cmd: DISCONNECTED, Time: time.Now()})
}
// Dumps a load of information about the current state of the connection to a