From a01c226dc42c1b425745e64f94e3fea8e297bb79 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 7 Nov 2017 19:16:05 -0500 Subject: [PATCH] wsConnection: call onDisconnect --- rpc/lib/server/handlers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index deede5894..1f2907001 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -457,10 +457,13 @@ func (wsc *wsConnection) OnStart() error { return nil } -// OnStop is a nop. +// OnStop implements cmn.Service by calling OnDisconnect callback. func (wsc *wsConnection) OnStop() { // Both read and write loops close the websocket connection when they exit their loops. // The writeChan is never closed, to allow WriteRPCResponse() to fail. + if wsc.onDisconnect != nil { + wsc.onDisconnect(wsc.remoteAddr) + } } // GetRemoteAddr returns the remote address of the underlying connection.