Merge pull request #44 from TheBlueMatt/main v0.0.101.2
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Sun, 26 Sep 2021 22:54:31 +0000 (22:54 +0000)
committerGitHub <noreply@github.com>
Sun, 26 Sep 2021 22:54:31 +0000 (22:54 +0000)
c-bindings-gen/src/main.rs
genbindings.sh
lightning-c-bindings/demo.cpp

index f56f30ff34e04c2d360822b1d2aa670d4e0b083a..9d6f9cfeadad7717594a5d878d19e2a0ac2a1af2 100644 (file)
@@ -1853,7 +1853,8 @@ fn walk_ast<'a>(ast_storage: &'a FullLibraryAST, crate_types: &mut CrateTypes<'a
                                syn::Item::Impl(i) => {
                                        if let &syn::Type::Path(ref p) = &*i.self_ty {
                                                if let Some(trait_path) = i.trait_.as_ref() {
-                                                       if path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) {
+                                                       if path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) ||
+                                                          path_matches_nongeneric(&trait_path.1, &["Clone"]) {
                                                                if let Some(full_path) = import_resolver.maybe_resolve_path(&p.path, None) {
                                                                        crate_types.set_clonable("crate::".to_owned() + &full_path);
                                                                }
index e6ffd8bb5a9f17d42707b96747d92f49f22e69e6..f74b2ac61e2f619ffd88dd1209d07e9b49f82ab3 100755 (executable)
@@ -230,9 +230,12 @@ while read LINE; do
                        # We'll print this at the end
                        ;;
                "XXX"*)
-                       STRUCT_NAME="$(echo "$LINE" | awk '{ print $2 }')"
+                       NEW_STRUCT_NAME="$(echo "$LINE" | awk '{ print $2 }')"
+                       if [ "$NEW_STRUCT_NAME" != "$STRUCT_NAME" ]; then
+                               STRUCT_CONTENTS="$(cat include/lightning.h  | sed -n -e "/struct LDK$NEW_STRUCT_NAME/{:s" -e "/\} LDK$NEW_STRUCT_NAME;/!{N" -e "b s" -e "}" -e p -e "}")"
+                       fi
+                       STRUCT_NAME="$NEW_STRUCT_NAME"
                        METHOD_NAME="$(echo "$LINE" | awk '{ print $3 }')"
-                       STRUCT_CONTENTS="$(cat include/lightning.h  | sed -n -e "/struct LDK$STRUCT_NAME/{:s" -e "/\} LDK$STRUCT_NAME;/!{N" -e "b s" -e "}" -e p -e "}")"
                        METHOD="$(echo "$STRUCT_CONTENTS" | grep "(\*$METHOD_NAME)")"
                        if [ "$METHOD" = "" ]; then
                                echo "Unable to find method declaration for $LINE"
index e7b596b0199a6e72a36f50c37ddcf9b45192c25d..a11c4bf9ccd6439e336fceb41543be23ba7a5351 100644 (file)
@@ -242,6 +242,9 @@ public:
                        if (peers_1->datalen == 0 && peers_2->datalen == 0) { break; }
                        std::this_thread::yield();
                }
+               // Note that the above is somewhat race-y, as node 2 may still think its connected.
+               // Thus, make sure any connections are disconnected on its end as well.
+               PeerManager_disconnect_by_node_id(&net2, ChannelManager_get_our_node_id(&cm1), false);
 
                // Finally make an actual connection and keep it this time
                assert(!socket_connect(node1_handler, ChannelManager_get_our_node_id(&cm2), (sockaddr*)&listen_addr, sizeof(listen_addr)));