X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fsocket_client.cpp;h=4f4975f29fc832864e99a75b44ffbedf738cb37a;hp=100ca54704a68b5006652918834ce7ff0209c1a1;hb=af84dfb53a739a0c8c343d9172f1847fa908906d;hpb=b604df5f671b5e7abfd37570d76927a6ebd45f98 diff --git a/src/socket_client.cpp b/src/socket_client.cpp index 100ca54..4f4975f 100644 --- a/src/socket_client.cpp +++ b/src/socket_client.cpp @@ -123,7 +123,7 @@ void socket_client_connection::unix_connect(int max_retries) { // recurse if retries left if (max_retries > 0) - tcp_connect(max_retries-1); + unix_connect(max_retries-1); } do_callbacks(new_connection); @@ -185,4 +185,21 @@ void socket_client_connection::close() } } +/** @brief try to reconnect the current connection with the same connection credentials (host and port or path) +*/ +void socket_client_connection::reconnect() +{ + // close the current connection if still open + close(); + + socket_type_value type=get_type(); + + if (type == tcp_s) + tcp_connect(max_retries); + else if (type == unix_s) + unix_connect(max_retries); + + reopen(); +} + }