Throw error on `listmembers` failure protocol-wise

Throw error on `listmembers` socket error
This commit is contained in:
Tristan B. Kildaire 2021-01-27 22:55:47 +02:00
parent 1727060060
commit c41d96b8d4
1 changed files with 18 additions and 9 deletions

View File

@ -551,24 +551,33 @@ public final class DClient
/* Send the protocol data */
DataMessage protocolDataMsg = new DataMessage(reqRepQueue.getTag(), protocolData);
bSendMessage(socket, protocolDataMsg.encode());
bool status = bSendMessage(socket, protocolDataMsg.encode());
/* Receive the server's response */
byte[] resp = reqRepQueue.dequeue().getData();
/* If the operation completed successfully */
if(resp[0])
/* If the send worked */
if(status)
{
string memberList = cast(string)resp[1..resp.length];
members = split(memberList, ",");
/* If the operation completed successfully */
if(resp[0])
{
string memberList = cast(string)resp[1..resp.length];
members = split(memberList, ",");
}
/* If there was an error */
else
{
throw new DClientException("List member error");
}
return members;
}
/* If there was an error */
/* If the list failed */
else
{
/* TODO: Error handling */
throw new DNetworkError("listmembers");
}
return members;
}
/**