From 262ea310659361c2334cd6a3bf6e32f3124e3725 Mon Sep 17 00:00:00 2001 From: StalkR Date: Sun, 28 Dec 2014 00:17:58 +0100 Subject: [PATCH] client/connection: keep information in disconnected event --- client/connection.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/connection.go b/client/connection.go index d94f736..6f004f5 100644 --- a/client/connection.go +++ b/client/connection.go @@ -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