From e3292deb151dee4c6814ac391612b466e202344b Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sat, 12 Nov 2022 12:08:25 +0100 Subject: [PATCH] Thoughts about ctrl close --- lib/teeworlds_client.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/teeworlds_client.rb b/lib/teeworlds_client.rb index 88e9a47..21dcb28 100644 --- a/lib/teeworlds_client.rb +++ b/lib/teeworlds_client.rb @@ -127,9 +127,15 @@ class TeeworldsClient end end + # TODO: this is same in client and server + # move to NetBase??? + def send_ctrl_close + @netbase&.send_packet([NET_CTRLMSG_CLOSE], 0, control: true) + end + def disconnect puts 'disconnecting.' - @netbase&.send_packet([NET_CTRLMSG_CLOSE], 0, control: true) + send_ctrl_close @s&.close @signal_disconnect = true end