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

This commit is contained in:
Nito Martinez 2015-11-25 08:36:49 +01:00
parent 428cbd802d
commit 89d8a68f4a

View File

@ -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))
{