From 00d940fb86a71d2cd8b83c6091d37293855a990e Mon Sep 17 00:00:00 2001
From: Morten Minde Neergaard <169057+xim@users.noreply.github.com>
Date: Tue, 1 Nov 2022 15:30:30 +0100
Subject: [PATCH] TCP connections: Only listen to localhost, not all interfaces

---
 scenes/shell.gd            | 2 +-
 scenes/tcp_server.gd       | 2 +-
 scenes/tcp_server_shell.gd | 2 +-
 scenes/text_editor.gd      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scenes/shell.gd b/scenes/shell.gd
index e406540..8074e6b 100644
--- a/scenes/shell.gd
+++ b/scenes/shell.gd
@@ -109,7 +109,7 @@ func _shell_binary():
 #func run_async_thread(command):
 #	var port = 1000 + (randi() % 1000)
 #	var s = TCP_Server.new()
-#	s.listen(port)
+#	s.listen(port, "127.0.0.1")
 #	var _pid = OS.execute("ncat", ["127.0.0.1", str(port), "-c", command], false, [], true)
 #	while not s.is_connection_available():
 #		pass
diff --git a/scenes/tcp_server.gd b/scenes/tcp_server.gd
index 3e5c114..ae1a281 100644
--- a/scenes/tcp_server.gd
+++ b/scenes/tcp_server.gd
@@ -13,7 +13,7 @@ func _ready():
 	start()
 
 func start():
-	_s.listen(port)
+	_s.listen(port, "127.0.0.1")
 		
 func _process(_delta):
 	if _s.is_connection_available():
diff --git a/scenes/tcp_server_shell.gd b/scenes/tcp_server_shell.gd
index 1756170..45223a6 100644
--- a/scenes/tcp_server_shell.gd
+++ b/scenes/tcp_server_shell.gd
@@ -13,7 +13,7 @@ func _ready():
 	start()
 
 func start():
-	_s.listen(port)
+	_s.listen(port, "127.0.0.1")
 		
 func _process(_delta):
 	if _s.is_connection_available():
diff --git a/scenes/text_editor.gd b/scenes/text_editor.gd
index 2018eec..c6e0abe 100644
--- a/scenes/text_editor.gd
+++ b/scenes/text_editor.gd
@@ -10,7 +10,7 @@ var _client_connection
 func _ready():
 	# Initialize TCP server for fake editor.
 	_server = TCP_Server.new()
-	_server.listen(1234)
+	_server.listen(1234, "127.0.0.1")
 	
 func _process(_delta):
 	if _server.is_connection_available():