added SO_REUSEADDR to nwio

This commit is contained in:
2012-05-01 15:02:31 +00:00
parent 77f384498d
commit 238cc4d82e
10 changed files with 20 additions and 1284 deletions

View File

@ -320,6 +320,11 @@ int qse_nwio_init (
{
qse_nwio_hnd_t handle;
{
int optval = 1;
setsockopt (nwio->handle, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, QSE_SIZEOF(optval));
}
if (bind (nwio->handle, (struct sockaddr*)&addr, addrlen) == SOCKET_ERROR)
{
nwio->errnum = syserr_to_errnum (WSAGetLastError());
@ -370,6 +375,11 @@ int qse_nwio_init (
{
qse_nwio_hnd_t handle;
{
int optval = 1;
setsockopt (nwio->handle, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, QSE_SIZEOF(optval));
}
if (bind (nwio->handle, (struct sockaddr*)&addr, addrlen) <= -1)
{
nwio->errnum = syserr_to_errnum (sock_errno());
@ -431,6 +441,13 @@ int qse_nwio_init (
{
qse_nwio_hnd_t handle;
#if defined(SO_REUSEADDR)
{
int optval = 1;
setsockopt (nwio->handle, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, QSE_SIZEOF(optval));
}
#endif
if (bind (nwio->handle, (struct sockaddr*)&addr, addrlen) <= -1)
{
nwio->errnum = syserr_to_errnum (errno);

View File

@ -554,9 +554,7 @@ int qse_pio_init (
posix_spawn_file_actions_t fa;
int fa_inited = 0;
int pserr;
#if defined(__linux)
posix_spawnattr_t psattr;
#endif
qse_pio_pid_t pid;
param_t param;
extern char** environ;
@ -1390,8 +1388,8 @@ create_process:
goto oops;
}
#if defined(__linux)
posix_spawnattr_init (&psattr);
#if defined(__linux)
#if !defined(POSIX_SPAWN_USEVFORK)
# define POSIX_SPAWN_USEVFORK 0x40
#endif