SockIt
|
#include "TcpServer.h"
Go to the source code of this file.
Functions | |
void | socket_deallocate (tcp::socket *socket) |
void socket_deallocate | ( | tcp::socket * | socket | ) |
Helper function to shutdown and deallocate the memory for a socket.
socket | The socket to deallocate. |
Definition at line 138 of file TcpServer.cpp.
References Logger::error().
Referenced by TcpServer::start_listening().
{ // may already have been deallocated if(!socket) return; try { if(socket && socket->is_open()) { //s->shutdown(s->shutdown_both); socket->close(); } } catch(boost::system::error_code &e) { Logger::error("socket deallocate: " + e.message()); } catch(std::exception &er) { Logger::error("socket deallocate: " + std::string(er.what())); } delete socket; socket = 0; }