`join()` now throws an error on send failure

This commit is contained in:
Tristan B. Kildaire 2020-12-17 23:28:32 +02:00
parent 75d8d1243e
commit 472c731845
1 changed files with 13 additions and 5 deletions

View File

@ -130,12 +130,20 @@ public final class DClient
/* Send the protocol data */
DataMessage protocolData = new DataMessage(reqRepQueue.getTag(), data);
bSendMessage(socket, protocolData.encode());
bool status = bSendMessage(socket, protocolData.encode());
/* Receive the server's response */
byte[] resp = reqRepQueue.dequeue().getData();
return cast(bool)resp[0];
/* If the send worked */
if(status)
{
/* Receive the server's response */
byte[] resp = reqRepQueue.dequeue().getData();
return cast(bool)resp[0];
}
/* If the send failed */
else
{
throw new DNetworkError("join");
}
}
/**