mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 21:10:06 -04:00
New function to abstract SO_REUSEADDR.
svn:r1102
This commit is contained in:
parent
f9e4e0f98e
commit
c7b2f8fdc9
@ -141,6 +141,7 @@ Changes in current version:
|
|||||||
o New evthread_use_windows_threads() and evthread_use_pthreads() functions to set up the evthread callbacks with reasonable defaults.
|
o New evthread_use_windows_threads() and evthread_use_pthreads() functions to set up the evthread callbacks with reasonable defaults.
|
||||||
o Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted.
|
o Change the semantics of timeouts in conjunction with EV_PERSIST; timeouts in that case will now repeat until deleted.
|
||||||
o sendfile, mmap and memory reference support for evbuffers.
|
o sendfile, mmap and memory reference support for evbuffers.
|
||||||
|
o New evutil_make_listen_socket_reuseable() to abstract SO_REUSEADDR.
|
||||||
|
|
||||||
Changes in 1.4.0:
|
Changes in 1.4.0:
|
||||||
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
||||||
|
15
evutil.c
15
evutil.c
@ -189,6 +189,21 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
evutil_make_listen_socket_reuseable(evutil_socket_t sock)
|
||||||
|
{
|
||||||
|
#ifndef WIN32
|
||||||
|
int one = 1;
|
||||||
|
/* REUSEADDR on Unix means, "don't hang on to this address after the
|
||||||
|
* listener is closed." On Windows, thoug, it means "don't keep other
|
||||||
|
* processes from binding to this address while we're using it. */
|
||||||
|
return setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &one,
|
||||||
|
(socklen_t)sizeof(one));
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
ev_int64_t
|
ev_int64_t
|
||||||
evutil_strtoll(const char *s, char **endptr, int base)
|
evutil_strtoll(const char *s, char **endptr, int base)
|
||||||
{
|
{
|
||||||
|
@ -121,6 +121,16 @@ int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
|
|||||||
@return 0 on success, -1 on failure
|
@return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int evutil_make_socket_nonblocking(evutil_socket_t sock);
|
int evutil_make_socket_nonblocking(evutil_socket_t sock);
|
||||||
|
|
||||||
|
/** Do platform-specific operations on a listener socket to make sure that
|
||||||
|
another program will be able to bind this address right after we've
|
||||||
|
closed the listener
|
||||||
|
|
||||||
|
@param sock The socket to make reuseabla
|
||||||
|
@return 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int evutil_make_listen_socket_reuseable(evutil_socket_t);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/** Do the platform-specific call needed to close a socket returned from
|
/** Do the platform-specific call needed to close a socket returned from
|
||||||
socket() or accept(). */
|
socket() or accept(). */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user