Merge pull request #115 from TheBlueMatt/main v0.0.118.1
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Fri, 10 Nov 2023 02:07:56 +0000 (02:07 +0000)
committerGitHub <noreply@github.com>
Fri, 10 Nov 2023 02:07:56 +0000 (02:07 +0000)
Fix race in peer connection in C++ demo app

deterministic-build-wrappers/clang-x86_64-windows [new file with mode: 0755]
lightning-c-bindings/demo.cpp

diff --git a/deterministic-build-wrappers/clang-x86_64-windows b/deterministic-build-wrappers/clang-x86_64-windows
new file mode 100755 (executable)
index 0000000..31bb028
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+clang -target x86_64-pc-windows-gnu -L/usr/lib/gcc/x86_64-w64-mingw32/12-win32/ "$@"
index add28af90e4532d5cb346c5c0c43936c6fdfc9b2..dc79696f09e341190cd48d929cff6b120e70767d 100644 (file)
@@ -242,6 +242,7 @@ public:
 
                // Then disconnect the "main" connection, while another connection is being made.
                PeerManager_disconnect_by_node_id(&net1, ChannelManager_get_our_node_id(&cm2));
+               PeerManager_disconnect_by_node_id(&net2, ChannelManager_get_our_node_id(&cm1));
                assert(!socket_connect(node1_handler, ChannelManager_get_our_node_id(&cm2), (sockaddr*)&listen_addr, sizeof(listen_addr)));
 
                std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting new connection handshake..." << std::endl;