Had a mistake migrating to the new bformat, now migrated almost.
This commit is contained in:
parent
c4a4d46264
commit
261448159f
|
@ -99,9 +99,7 @@ public final class BesterConnection : Thread
|
|||
try
|
||||
{
|
||||
/* Receive a message */
|
||||
byte[] receivedBytes;
|
||||
receiveMessage(clientConnection, receivedBytes);
|
||||
receivedMessage = parseJSON(cast(string)receivedBytes);
|
||||
receiveMessage(clientConnection, receivedMessage);
|
||||
|
||||
/**
|
||||
* If the message was received successfully then
|
||||
|
@ -220,7 +218,7 @@ public final class BesterConnection : Thread
|
|||
try
|
||||
{
|
||||
/* Send the message */
|
||||
sendMessage(clientConnection, cast(byte[])toJSON(dummyMessage));
|
||||
sendMessage(clientConnection, dummyMessage);
|
||||
}
|
||||
catch(NetworkException e)
|
||||
{
|
||||
|
@ -348,7 +346,7 @@ public final class BesterConnection : Thread
|
|||
try
|
||||
{
|
||||
/* Send the message */
|
||||
sendMessage(clientConnection, cast(byte[])toJSON(statusMessage));
|
||||
sendMessage(clientConnection, statusMessage);
|
||||
}
|
||||
catch(NetworkException e)
|
||||
{
|
||||
|
|
|
@ -211,7 +211,7 @@ public final class HandlerResponse
|
|||
|
||||
/* Send the message to the client */
|
||||
debugPrint("Sending handler's response to client \"" ~ clientConnection.toString() ~ "\"...");
|
||||
sendMessage(clientSocket, cast(byte[])toJSON(clientPayload));
|
||||
sendMessage(clientSocket, clientPayload);
|
||||
debugPrint("Sending handler's response to client \"" ~ clientConnection.toString() ~ "\"... [sent]");
|
||||
}
|
||||
catch(SocketOSException exception)
|
||||
|
@ -284,7 +284,7 @@ public final class HandlerResponse
|
|||
|
||||
/* Send the payload */
|
||||
debugPrint("Sending handler's response to server \"" ~ serverConnection.toString() ~ "\"...");
|
||||
sendMessage(serverConnection, cast(byte[])toJSON(serverPayload));
|
||||
sendMessage(serverConnection, serverPayload);
|
||||
debugPrint("Sending handler's response to server \"" ~ serverConnection.toString() ~ "\"... [sent]");
|
||||
|
||||
/* Close the connection to the server */
|
||||
|
|
|
@ -14,10 +14,15 @@ import bmessage : bformatreceiveMessage = receiveMessage, bformatsendMessage = s
|
|||
*/
|
||||
public void receiveMessage(Socket originator, ref JSONValue receiveMessage)
|
||||
{
|
||||
if(!bformatreceiveMessage(originator, receiveMessage))
|
||||
/* The received bytes */
|
||||
byte[] receivedBytes;
|
||||
|
||||
if(!bformatreceiveMessage(originator, receivedBytes))
|
||||
{
|
||||
throw new NetworkException(originator);
|
||||
}
|
||||
|
||||
receiveMessage = parseJSON(cast(string)receivedBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +36,7 @@ public void receiveMessage(Socket originator, ref JSONValue receiveMessage)
|
|||
*/
|
||||
public void sendMessage(Socket recipient, JSONValue jsonMessage)
|
||||
{
|
||||
if(!bformatsendMessage(recipient, jsonMessage))
|
||||
if(!bformatsendMessage(recipient, cast(byte[])toJSON(jsonMessage)))
|
||||
{
|
||||
throw new NetworkException(recipient);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue