libt2n: (tomj) close open connection (if any) on destruction of socket_client_connect...
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 24 Nov 2008 20:05:24 +0000 (20:05 +0000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 24 Nov 2008 20:05:24 +0000 (20:05 +0000)
src/socket_client.cpp
src/socket_client.hxx

index bd321fb..d8dc413 100644 (file)
@@ -102,6 +102,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()
+{
+    close();
+}
+
+
 /// establish a connection via tcp
 void socket_client_connection::tcp_connect(int max_retries)
 {
index cea491e..4b0431a 100644 (file)
@@ -68,6 +68,8 @@ class socket_client_connection : public client_connection, public socket_handler
             int _max_retries=max_retries_default,
             std::ostream *_logstream=NULL, log_level_values _log_level=none);
 
+        ~socket_client_connection();
+
         /** @brief read data from the socket and copy it into buffer
             @param usec_timeout wait until new data is found, max timeout usecs.
                   -1: wait endless