I've found an error caused by connecting, disconnecting, and reconnecting.
I dug around a bit, and I think it's because skynet.connect() checks skynet.socket for nil.
(at L16, if not skynet.socket or force then)
skynet.socket.close() doesn't set skynet.socket to nil, it remains a function that errors "Attempt to use a closed file".
Because of that, it doesn't pass the check and doesn't connect to the websocket.
Running skynet.connect(true) doesn't work either because of the second check, where it tries to close an already closed file.
(at L18, if skynet.socket then skynet.socket.close() end)
I've found manually setting skynet.socket to nil directly after disconnecting can fix the problem; I think maybe doing that at the end of skynet.disconnect() could fix it? Not sure though.
I've found an error caused by connecting, disconnecting, and reconnecting.
I dug around a bit, and I think it's because
skynet.connect()
checksskynet.socket
for nil. (at L16,if not skynet.socket or force then
)skynet.socket.close()
doesn't setskynet.socket
to nil, it remains a function that errors "Attempt to use a closed file". Because of that, it doesn't pass the check and doesn't connect to the websocket. Runningskynet.connect(true)
doesn't work either because of the second check, where it tries to close an already closed file. (at L18,if skynet.socket then skynet.socket.close() end
)I've found manually setting
skynet.socket
to nil directly after disconnecting can fix the problem; I think maybe doing that at the end ofskynet.disconnect()
could fix it? Not sure though.