aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksi Lindeman <dec05eba@protonmail.com>2019-04-09 20:58:18 +0200
committerAleksi Lindeman <dec05eba@protonmail.com>2019-04-09 20:58:29 +0200
commitc890b0748a47a88c832984f95070ddf3d232cc08 (patch)
tree6c8eb06233e41503e83b727e13bcbe0fd65941f8
parentfc8f81c8da18b4557a9dabb82d87f82d691616ae (diff)
Add debug output
-rw-r--r--src/BootstrapConnection.cpp5
-rw-r--r--src/DirectConnection.cpp6
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)