X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fsocket_client.cpp;h=fca01d144ec3de540fc3d02e50713e8d8a0febbd;hp=360e5f009f59cd359c18832ca7102abdf980e079;hb=56f3994d74dbc36d10bfa83b50b016bf269ac563;hpb=039e52da9b40d0e729360ff0a953dfbddf975b8a diff --git a/src/socket_client.cpp b/src/socket_client.cpp index 360e5f0..fca01d1 100644 --- a/src/socket_client.cpp +++ b/src/socket_client.cpp @@ -66,6 +66,7 @@ socket_client_connection::socket_client_connection(int _port, const std::string& { lastErrorMsg=e.what(); LOGSTREAM(debug,"tcp connect error: " << lastErrorMsg); + // FIXME: Don't call virtual function in constructor. Currently not dangerous but bad design. close(); } @@ -94,6 +95,7 @@ socket_client_connection::socket_client_connection(const std::string& _path, { lastErrorMsg=e.what(); LOGSTREAM(debug,"unix connect error: " << lastErrorMsg); + // FIXME: Don't call virtual function in constructor. Currently not dangerous close(); } @@ -101,6 +103,15 @@ socket_client_connection::socket_client_connection(const std::string& _path, do_callbacks(new_connection); } +/** + * Destructor. Closes an open connection. + */ +socket_client_connection::~socket_client_connection() +{ + // Destructor of socket_handler will close the socket! +} + + /// establish a connection via tcp void socket_client_connection::tcp_connect(int max_retries) {