summaryrefslogtreecommitdiffstats
path: root/common/os_calls.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2008-04-05 08:01:29 +0000
committerjsorg71 <jsorg71>2008-04-05 08:01:29 +0000
commit85e42c068c2a8c3e7b07e31b38bfd5d8f863c5bb (patch)
tree9b3d8f44ea456f71dea7912c577abec7b0d9607c /common/os_calls.c
parent230bead7477205297caf9761a7cf6ee79c6fe702 (diff)
downloadxrdp-proprietary-85e42c068c2a8c3e7b07e31b38bfd5d8f863c5bb.tar.gz
xrdp-proprietary-85e42c068c2a8c3e7b07e31b38bfd5d8f863c5bb.zip
socket options fixes
Diffstat (limited to 'common/os_calls.c')
-rw-r--r--common/os_calls.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 251e1f37..9b587c8d 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -260,18 +260,16 @@ g_tcp_set_no_delay(int sck)
unsigned int option_len;
#endif
- option_value = 1;
option_len = sizeof(option_value);
- setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char*)&option_value,
- option_len);
- if (getsockopt(sck, SOL_SOCKET, SO_SNDBUF, (char*)&option_value,
+ /* SOL_TCP IPPROTO_TCP */
+ if (getsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char*)&option_value,
&option_len) == 0)
{
- if (option_value < (1024 * 32))
+ if (option_value == 0)
{
- option_value = 1024 * 32;
+ option_value = 1;
option_len = sizeof(option_value);
- setsockopt(sck, SOL_SOCKET, SO_SNDBUF, (char*)&option_value,
+ setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char*)&option_value,
option_len);
}
}
@@ -299,14 +297,19 @@ g_tcp_socket(void)
{
return -1;
}
- option_value = 1;
option_len = sizeof(option_value);
- setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (char*)&option_value,
- option_len);
- option_value = 1;
- setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char*)&option_value,
- option_len);
-
+ if (getsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char*)&option_value,
+ &option_len) == 0)
+ {
+ if (option_value == 0)
+ {
+ option_value = 1;
+ option_len = sizeof(option_value);
+ setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char*)&option_value,
+ option_len);
+ }
+ }
+ option_len = sizeof(option_value);
if (getsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char*)&option_value,
&option_len) == 0)
{