diff options
-rw-r--r-- | message_handler.cpp | 9 | ||||
-rw-r--r-- | message_handler.hpp | 13 |
2 files changed, 8 insertions, 14 deletions
diff --git a/message_handler.cpp b/message_handler.cpp index ef9eb06..e66e39c 100644 --- a/message_handler.cpp +++ b/message_handler.cpp @@ -163,7 +163,7 @@ uint32_t Handler::getCommand(Message& message) return command; } -int Handler::send(Message& outMessage) +void Handler::send(Message& outMessage) { auto session = (std::get<session::Manager&>(singletonPool).getSession( sessionID)).lock(); @@ -171,15 +171,12 @@ int Handler::send(Message& outMessage) // Flatten the packet auto packet = parser::flatten(outMessage, sessionHeader, *session); - // Read the packet + // Write the packet auto writeStatus = channel->write(packet); if (writeStatus < 0) { - std::cerr << "E> Error in writing : " << std::hex << writeStatus - << "\n"; + throw std::runtime_error("Error in writing to socket"); } - - return writeStatus; } void Handler::setChannelInSession() const diff --git a/message_handler.hpp b/message_handler.hpp index 0f553b7..882a077 100644 --- a/message_handler.hpp +++ b/message_handler.hpp @@ -50,17 +50,14 @@ class Handler */ std::unique_ptr<Message> executeCommand(Message& inMessage); - /* - * @brief Send the outgoing message - * - * The payload in the outgoing message is flattened and sent out on the - * socket + /** @brief Send the outgoing message * - * @param[in] outMessage - Outgoing Message + * The payload in the outgoing message is flattened and sent out on the + * socket * - * @return Zero on success and <0 on failure + * @param[in] outMessage - Outgoing Message */ - int send(Message& outMessage); + void send(Message& outMessage); /** @brief Set socket channel in session object */ void setChannelInSession() const; |