session CHANGE use more practical TCP keep alive options

Refs cesnet/netopeer2#292
diff --git a/src/session_client.c b/src/session_client.c
index 84f44c4..4d196ee 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -935,18 +935,7 @@
         /* make the socket non-blocking */
         if (((flags = fcntl(sock, F_GETFL)) == -1) || (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1)) {
             ERR("Fcntl failed (%s).", strerror(errno));
-            close(sock);
-            freeaddrinfo(res_list);
-            return -1;
-        }
-
-        /* enable keep-alive */
-        i = 1;
-        if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &i, sizeof i) == -1) {
-            ERR("Setsockopt failed (%s).", strerror(errno));
-            close(sock);
-            freeaddrinfo(res_list);
-            return -1;
+            goto error;
         }
 
         /* we're done, network connection established */
@@ -959,6 +948,13 @@
     freeaddrinfo(res_list);
 
     return sock;
+
+error:
+    if (sock > -1) {
+        close(sock);
+    }
+    freeaddrinfo(res_list);
+    return -1;
 }
 
 static NC_MSG_TYPE