Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP connections: Only listen to localhost, not all interfaces #159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scenes/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var _hint_client_connection

func _ready():
_hint_server = TCP_Server.new()
_hint_server.listen(1235)
_hint_server.listen(1235, "127.0.0.1")
OS.set_environment("HINT_TCP_PORT", "1235")

var args = helpers.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion scenes/shell.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scenes/tcp_server.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion scenes/tcp_server_shell.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion scenes/text_editor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion scripts/hint
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use IO::Socket;

$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
PeerPort => 1235,
PeerPort => $ENV{HINT_TCP_PORT},
Proto => "tcp",
Type => SOCK_STREAM);

Expand Down