|
|
|
@ -471,8 +471,11 @@ g_tcp_socket(void)
|
|
|
|
|
{
|
|
|
|
|
option_value = 0;
|
|
|
|
|
option_len = sizeof(option_value);
|
|
|
|
|
setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
|
|
|
|
|
option_len);
|
|
|
|
|
if (setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
|
|
|
|
|
option_len) < 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
@ -484,8 +487,11 @@ g_tcp_socket(void)
|
|
|
|
|
{
|
|
|
|
|
option_value = 1;
|
|
|
|
|
option_len = sizeof(option_value);
|
|
|
|
|
setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
|
|
|
|
|
option_len);
|
|
|
|
|
if (setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
|
|
|
|
|
option_len) < 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -498,8 +504,11 @@ g_tcp_socket(void)
|
|
|
|
|
{
|
|
|
|
|
option_value = 1024 * 32;
|
|
|
|
|
option_len = sizeof(option_value);
|
|
|
|
|
setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
|
|
|
|
|
option_len);
|
|
|
|
|
if (setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
|
|
|
|
|
option_len) < 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -785,7 +794,10 @@ g_tcp_set_non_blocking(int sck)
|
|
|
|
|
#else
|
|
|
|
|
i = fcntl(sck, F_GETFL);
|
|
|
|
|
i = i | O_NONBLOCK;
|
|
|
|
|
fcntl(sck, F_SETFL, i);
|
|
|
|
|
if (fcntl(sck, F_SETFL, i) < 0)
|
|
|
|
|
{
|
|
|
|
|
log_message(LOG_LEVEL_ERROR, "g_tcp_set_non_blocking: fcntl() failed\n");
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1421,7 +1433,12 @@ g_set_wait_obj(tbus obj)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendto(s, "sig", 4, 0, (struct sockaddr *)&sa, sa_size);
|
|
|
|
|
if (sendto(s, "sig", 4, 0, (struct sockaddr *)&sa, sa_size) < 0)
|
|
|
|
|
{
|
|
|
|
|
close(s);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close(s);
|
|
|
|
|
return 0;
|
|
|
|
|
#endif
|
|
|
|
@ -1934,8 +1951,7 @@ g_mkdir(const char *dirname)
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
return 0;
|
|
|
|
|
#else
|
|
|
|
|
mkdir(dirname, S_IRWXU);
|
|
|
|
|
return 0;
|
|
|
|
|
return mkdir(dirname, S_IRWXU);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|