aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/BootstrapConnection.cpp2
-rw-r--r--src/DirectConnection.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/BootstrapConnection.cpp b/src/BootstrapConnection.cpp
index fffb332..361f13a 100644
--- a/src/BootstrapConnection.cpp
+++ b/src/BootstrapConnection.cpp
@@ -91,7 +91,7 @@ namespace sibs
throw PubsubKeyAlreadyListeningException("");
listenCallbackFuncs[pubsubKey] = callbackFunc;
}
- connections.send(serverPeer, std::make_shared<std::vector<u8>>(pubsubKey.data.data(), pubsubKey.data.data()),
+ connections.send(serverPeer, std::make_shared<std::vector<u8>>(pubsubKey.data.begin(), pubsubKey.data.end()),
[](PubSubResult result, const std::string &resultStr)
{
Log::debug("BootstrapConnection::listen: PubSubResult: %d, result string: %s", result, resultStr.c_str());
diff --git a/src/DirectConnection.cpp b/src/DirectConnection.cpp
index 713b3ac..8e60c47 100644
--- a/src/DirectConnection.cpp
+++ b/src/DirectConnection.cpp
@@ -126,7 +126,7 @@ namespace sibs
std::thread([peer, data, sendDataCallbackFunc]()
{
usize sentSizeTotal = 0;
- while(sentSizeTotal < data->size())
+ while(sentSizeTotal < data->size() || data->size() == 0)
{
int sentSize = UDT::send(peer->socket, (char*)data->data() + sentSizeTotal, data->size() - sentSizeTotal, 0);
if(sentSize == UDT::ERROR)
@@ -135,6 +135,8 @@ namespace sibs
sendDataCallbackFunc(PubSubResult::ERROR, UDT::getlasterror_desc());
}
sentSizeTotal += sentSize;
+ if(data->size() == 0)
+ break;
}
if(sendDataCallbackFunc)
sendDataCallbackFunc(PubSubResult::OK, "");