mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 01:22:00 +00:00
Cancel the recvr task on close
This avoids stail recvr from sending duplicate data.
This commit is contained in:
parent
dd2119c6d9
commit
cbd457b464
@ -119,6 +119,7 @@ class TsmConsole(conapi.Console):
|
||||
self.datacallback = None
|
||||
self.nodeconfig = config
|
||||
self.connected = False
|
||||
self.recvr = None
|
||||
|
||||
|
||||
def recvdata(self):
|
||||
@ -148,13 +149,16 @@ class TsmConsole(conapi.Console):
|
||||
self.ws.set_verify_callback(kv)
|
||||
self.ws.connect('wss://{0}/console0'.format(self.bmc), host=bmc, cookie='XSRF-TOKEN={0}; SESSION={1}'.format(wc.cookies['XSRF-TOKEN'], wc.cookies['SESSION']), subprotocols=[wc.cookies['XSRF-TOKEN']])
|
||||
self.connected = True
|
||||
eventlet.spawn_n(self.recvdata)
|
||||
self.recvr = eventlet.spawn(self.recvdata)
|
||||
return
|
||||
|
||||
def write(self, data):
|
||||
self.ws.send(data)
|
||||
|
||||
def close(self):
|
||||
if self.recvr:
|
||||
self.recvr.kill()
|
||||
self.recvr = None
|
||||
if self.ws:
|
||||
self.ws.close()
|
||||
self.connected = False
|
||||
|
Loading…
Reference in New Issue
Block a user