aboutsummaryrefslogtreecommitdiff
path: root/src/DirectConnection.cpp
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-06-09 19:18:41 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-06-09 19:18:44 +0200
commit4b0ee7c887deb1d385497cff694c2098ce4e4ba6 (patch)
tree94aa2c931fe24e47c5ce69a2b9132477b92ce460 /src/DirectConnection.cpp
parent23c234db3e9fcbe07b851529789f3174b6efa673 (diff)
Fix send not working, allow sending 0 bytes
Diffstat (limited to 'src/DirectConnection.cpp')
-rw-r--r--src/DirectConnection.cpp4
1 files changed, 3 insertions, 1 deletions
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, "");