diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-04-09 20:58:18 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 22:58:01 +0200 |
commit | ecc0df2ea82210a4add58a6a0dabdd39e1fc8052 (patch) | |
tree | 1e7951a5e97a81ce40ec581973b2a7f56afd80fd /src | |
parent | 26b3a44dc76b4fb7cbf259283d14f4483e6bfe4a (diff) |
Add debug output
Diffstat (limited to 'src')
-rw-r--r-- | src/BootstrapConnection.cpp | 5 | ||||
-rw-r--r-- | src/DirectConnection.cpp | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp index fc2e4ab..58a07d2 100644 --- a/src/BootstrapConnection.cpp +++ b/src/BootstrapConnection.cpp @@ -13,6 +13,7 @@ namespace sibs alive(true), putThreadCount(0) { + Log::debug("Created bootstrap connection, p2p? %s", options.useP2p ? "yes" : "no"); connections.onRemoveDisconnectedPeer([this](std::shared_ptr<DirectConnectionPeer> peer) { std::lock_guard<std::recursive_mutex> lock(subscribeDataMutex); @@ -97,7 +98,7 @@ namespace sibs return; } - Log::debug("BootstrapConnection::receiveDataFromServer: Received subscriber(s) from bootstrap node"); + //Log::debug("BootstrapConnection::receiveDataFromServer: Received subscriber(s) from bootstrap node"); sibs::SafeDeserializer deserializer((const u8*)data, size); PubsubKey pubsubKey; deserializer.extract(pubsubKey.data.data(), PUBSUB_KEY_LENGTH); @@ -121,7 +122,7 @@ namespace sibs in_addr_t ipv4Address = deserializer.extract<u32>(); u16 port = deserializer.extract<u16>(); Ipv4 newPeerAddress(addressFamily, ipv4Address, port); - Log::debug("BootstrapConnection::receiveDataFromServer: received subscriber (ip: %s, port: %d) from bootstrap node", newPeerAddress.getAddress().c_str(), newPeerAddress.getPort()); + //Log::debug("BootstrapConnection::receiveDataFromServer: received subscriber (ip: %s, port: %d) from bootstrap node", newPeerAddress.getAddress().c_str(), newPeerAddress.getPort()); connections.connect(newPeerAddress, [this, pubsubKey](std::shared_ptr<DirectConnectionPeer> peer, PubSubResult result, const std::string &resultStr) { std::lock_guard<std::recursive_mutex> lock(subscribeDataMutex); diff --git a/src/DirectConnection.cpp b/src/DirectConnection.cpp index 6869d05..453f6b6 100644 --- a/src/DirectConnection.cpp +++ b/src/DirectConnection.cpp @@ -194,7 +194,7 @@ namespace sibs std::unique_ptr<Socket> DirectConnections::createSocket(const Ipv4 &addressToBind, bool rendezvous, bool reuseAddr, bool bind) { - Log::debug("UDT: Creating socket for ipv4 address %s, port: %d", addressToBind.getAddress().c_str(), addressToBind.getPort()); + //Log::debug("UDT: Creating socket for ipv4 address %s, port: %d", addressToBind.getAddress().c_str(), addressToBind.getPort()); UDTSOCKET udtSocket = UDT::socket(AF_INET, SOCK_DGRAM, 0); if(udtSocket == UDT::INVALID_SOCK) { @@ -300,7 +300,9 @@ namespace sibs int socketId = socket->udtSocket; - Log::debug("DirectConnections: Connecting to %s peer (ip: %s, port: %d, rendezvous: %s)", server ? "server" : "client", address.getAddress().c_str(), address.getPort(), rendezvous ? "yes" : "no"); + Log::debug("DirectConnections: Connecting to %s peer (ip: %s, port: %d, rendezvous: %s, p2p: %s)", server ? "server" : "client", + address.getAddress().c_str(), address.getPort(), rendezvous ? "yes" : "no", options.useP2p ? "yes" : "no"); + if((!server && !options.useP2p) || UDT::connect(socketId, (sockaddr*)&address.address, sizeof(address.address)) == UDT::ERROR) { if(!server) |