Skip to content

Commit a6dc6cc

Browse files
committed
stop handshake io on close
1 parent 9bc627b commit a6dc6cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/websocket/client_ev.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ local ev = function(ws)
142142
req,
143143
function()
144144
local resp = {}
145-
-- assert(sock:getfd() > -1)
146145
local response = ''
147-
148146
local read_upgrade = function(loop,read_io)
149147
repeat
150148
local byte,err,pp = sock:receive(1)
@@ -208,6 +206,10 @@ local ev = function(ws)
208206
end
209207

210208
self.close = function(_,code,reason,timeout)
209+
if handshake_io then
210+
handshake_io:stop(loop)
211+
handshake_io:clear_pending(loop)
212+
end
211213
if self.state == 'CONNECTING' then
212214
self.state = 'CLOSING'
213215
on_close(false,1006,'')

0 commit comments

Comments
 (0)