Do not crash on ctrl close of invalid connection
This commit is contained in:
parent
129fa9aed5
commit
409f880f36
|
@ -149,6 +149,11 @@ class TeeworldsServer
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_ctrl_close(client, reason)
|
def send_ctrl_close(client, reason)
|
||||||
|
# when clients disconnect
|
||||||
|
# during the connection process
|
||||||
|
# we do not care
|
||||||
|
return if client.nil?
|
||||||
|
|
||||||
msg = [NET_CTRLMSG_CLOSE]
|
msg = [NET_CTRLMSG_CLOSE]
|
||||||
msg += Packer.pack_str(reason) unless reason.nil?
|
msg += Packer.pack_str(reason) unless reason.nil?
|
||||||
@netbase.set_peer_token(client.token)
|
@netbase.set_peer_token(client.token)
|
||||||
|
|
Loading…
Reference in a new issue