Fix reconnect crash
This commit is contained in:
parent
42ab29bbfe
commit
a739190383
|
@ -63,6 +63,10 @@ class NetBase
|
|||
# // TTTTTTTT
|
||||
# // TTTTTTTT
|
||||
# // TTTTTTTT
|
||||
if @s.nil?
|
||||
puts "Error: no active socket"
|
||||
return
|
||||
end
|
||||
flags_bits = PacketFlags.new(opts).bits
|
||||
ack = @ack
|
||||
ip = @ip
|
||||
|
|
|
@ -191,8 +191,9 @@ class TeeworldsClient
|
|||
|
||||
def disconnect
|
||||
puts 'disconnecting.'
|
||||
send_ctrl_close
|
||||
send_ctrl_close unless @s.nil?
|
||||
@s&.close
|
||||
@s = nil
|
||||
@signal_disconnect = true
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue