Browse Source

wsConnection: call onDisconnect

pull/788/head
Anton Kaliaev 7 years ago
parent
commit
a01c226dc4
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      rpc/lib/server/handlers.go

+ 4
- 1
rpc/lib/server/handlers.go View File

@ -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.


Loading…
Cancel
Save