From 027ac0cba7ed1c55d95a4a4f36dc6c221134c4a4 Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Sat, 27 Oct 2018 00:24:13 +0200 Subject: Add debug when send fails --- src/BootstrapConnection.cpp | 3 +++ src/DirectConnection.cpp | 6 ++++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp index d7cee09..4876b7b 100644 --- a/src/BootstrapConnection.cpp +++ b/src/BootstrapConnection.cpp @@ -240,7 +240,10 @@ namespace sibs bool BootstrapConnection::put(const PubsubKey &pubsubKey, const void *data, const usize size) { if(size > 819200) // 800kb + { + Log::error("No data was sent because you are trying to send more than 800kb"); return false; + } { std::lock_guard lock(subscribeDataMutex); diff --git a/src/DirectConnection.cpp b/src/DirectConnection.cpp index 3ffff22..4795da1 100644 --- a/src/DirectConnection.cpp +++ b/src/DirectConnection.cpp @@ -185,10 +185,16 @@ namespace sibs bool DirectConnections::send(const std::shared_ptr peer, std::shared_ptr data, PubSubSendDataCallback sendDataCallbackFunc) { if(data->getDataSize() == 0) + { + Log::warn("No data sent because you are trying to send 0 bytes"); return true; + } if(data->getDataSize() > 819200) // 800kb + { + Log::error("Data not sent, data was over 800kb"); return false; + } Log::debug("DirectConnections::send: sending %d bytes to %s:%d", data->getRawSize(), peer->address.getAddress().c_str(), peer->address.getPort()); // TODO: Replace this with light-weight threads (fibers)? -- cgit v1.2.3