From 219395cc87fd735045a9d3accd0f8c1378776747 Mon Sep 17 00:00:00 2001 From: Kirill Shumilov Date: Fri, 19 Jun 2020 15:21:27 +0300 Subject: [PATCH] fix(stdlib): do not try to open a new tcp connection in tethering-inet while it has already opened connection --- workspace/__lib__/xod/debug/open-tcp/patch.cpp | 4 ++++ workspace/__lib__/xod/debug/tethering-inet/patch.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/workspace/__lib__/xod/debug/open-tcp/patch.cpp b/workspace/__lib__/xod/debug/open-tcp/patch.cpp index fb08a1d29..d91f8cafe 100644 --- a/workspace/__lib__/xod/debug/open-tcp/patch.cpp +++ b/workspace/__lib__/xod/debug/open-tcp/patch.cpp @@ -13,6 +13,10 @@ void evaluate(Context ctx) { return; auto inet = getValue(ctx); + + // Do nothing if TCP connection is already opened + if (inet->isConnected()) return; + auto host = getValue(ctx); uint32_t port = (uint32_t)getValue(ctx); diff --git a/workspace/__lib__/xod/debug/tethering-inet/patch.cpp b/workspace/__lib__/xod/debug/tethering-inet/patch.cpp index d8dab6cc3..715ba0ad9 100644 --- a/workspace/__lib__/xod/debug/tethering-inet/patch.cpp +++ b/workspace/__lib__/xod/debug/tethering-inet/patch.cpp @@ -280,6 +280,8 @@ class TetheringInternet { // TODO: MUX printPrefix(); writeCmd(CIPCLOSE, EOL); + _connected = false; + _pkgSize = 0; return readCmd(OK, ERROR) == 1; } };