mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 05:42:35 +00:00
Config is now saved and synced when updated
This commit is contained in:
@@ -19,6 +19,10 @@ module TAC
|
||||
@data_sent, @data_received = 0, 0
|
||||
end
|
||||
|
||||
def uuid=(id)
|
||||
@uuid = id
|
||||
end
|
||||
|
||||
def socket=(socket)
|
||||
@socket = socket
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ module TAC
|
||||
class TACNET
|
||||
class Connection
|
||||
TAG = "TACNET|Connection"
|
||||
attr_reader :client
|
||||
def initialize(hostname = DEFAULT_HOSTNAME, port = DEFAULT_PORT)
|
||||
@hostname = hostname
|
||||
@port = port
|
||||
@@ -16,7 +17,7 @@ module TAC
|
||||
handle_connection
|
||||
end
|
||||
|
||||
@packet_handler = PacketHandler.new
|
||||
@packet_handler = PacketHandler.new(host_is_a_connection: true)
|
||||
end
|
||||
|
||||
def connect(error_callback)
|
||||
@@ -58,6 +59,14 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
def puts(packet)
|
||||
@client.puts(packet)
|
||||
end
|
||||
|
||||
def gets
|
||||
@client.gets
|
||||
end
|
||||
|
||||
def connected?
|
||||
!closed?
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ module TAC
|
||||
|
||||
def handle_handshake(packet)
|
||||
if @host_is_a_connection
|
||||
# TODO: Set Connection client id to received uuid
|
||||
$window.backend.tacnet.client.uuid = packet.body
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ module TAC
|
||||
if @active_client && @active_client.connected?
|
||||
log.i(TAG, "Too many clients, already have one connected!")
|
||||
client.close("Too many clients!")
|
||||
pp @active_client.connected?
|
||||
else
|
||||
@active_client = client
|
||||
# TODO: Backup local config
|
||||
|
||||
Reference in New Issue
Block a user