Merge pull request #12 from tendermint/close-ws-connection
close ws connection on Stop
This commit is contained in:
commit
a416c37ebd
|
@ -85,6 +85,8 @@ func (wsc *WSClient) dial() error {
|
||||||
|
|
||||||
func (wsc *WSClient) OnStop() {
|
func (wsc *WSClient) OnStop() {
|
||||||
wsc.BaseService.OnStop()
|
wsc.BaseService.OnStop()
|
||||||
|
wsc.Conn.Close()
|
||||||
|
wsc.Conn = nil
|
||||||
// ResultsCh/ErrorsCh is closed in receiveEventsRoutine.
|
// ResultsCh/ErrorsCh is closed in receiveEventsRoutine.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,9 @@ func (wsc *wsConnection) OnStart() error {
|
||||||
|
|
||||||
func (wsc *wsConnection) OnStop() {
|
func (wsc *wsConnection) OnStop() {
|
||||||
wsc.BaseService.OnStop()
|
wsc.BaseService.OnStop()
|
||||||
|
if wsc.evsw != nil {
|
||||||
wsc.evsw.RemoveListener(wsc.remoteAddr)
|
wsc.evsw.RemoveListener(wsc.remoteAddr)
|
||||||
|
}
|
||||||
wsc.readTimeout.Stop()
|
wsc.readTimeout.Stop()
|
||||||
wsc.pingTicker.Stop()
|
wsc.pingTicker.Stop()
|
||||||
// The write loop closes the websocket connection
|
// The write loop closes the websocket connection
|
||||||
|
|
Loading…
Reference in New Issue