From 89d8a68f4a43f84208a343ec0974284733e7b569 Mon Sep 17 00:00:00 2001 From: Nito Martinez Date: Wed, 25 Nov 2015 08:36:49 +0100 Subject: [PATCH] Disable setting socket options for preexisting socket like: keepalive and tcp_nodelay, these should be set extenally if needed. Do not close the socket if the clientaddress could not be set --- libfreerdp/core/tcp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 6496f75..00a1c45 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -1150,7 +1150,8 @@ int freerdp_tcp_connect(rdpContext* context, rdpSettings* settings, settings->ClientAddress = freerdp_tcp_get_ip_address(sockfd); if (!settings->ClientAddress) { - close(sockfd); + if (!useExternalDefinedSocket) + close(sockfd); WLog_ERR(TAG, "Couldn't get socket ip address"); return -1; } @@ -1158,7 +1159,7 @@ int freerdp_tcp_connect(rdpContext* context, rdpSettings* settings, optval = 1; optlen = sizeof(optval); - if (!ipcSocket) + if (!ipcSocket && !useExternalDefinedSocket) { if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (void*) &optval, optlen) < 0) WLog_ERR(TAG, "unable to set TCP_NODELAY"); @@ -1181,7 +1182,7 @@ int freerdp_tcp_connect(rdpContext* context, rdpSettings* settings, } } - if (!ipcSocket) + if (!ipcSocket && !useExternalDefinedSocket) { if (!freerdp_tcp_set_keep_alive_mode(sockfd)) { -- 2.7.4