mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
On windows, ENOBUFS starts with WSA. #6296. Fix on 0.2.18-rc
This commit is contained in:
parent
d13389b30e
commit
e9b33ed1bf
3 changed files with 9 additions and 2 deletions
4
changes/bug6296
Normal file
4
changes/bug6296
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
o Minor bugfixes:
|
||||||
|
|
||||||
|
- Instead of ENOBUFS on Windows, say WSAENOBUFS. Fixes
|
||||||
|
compilation on Windows. Fixes bug 6296; bugfix on 0.2.3.18-rc.
|
|
@ -500,6 +500,8 @@ int network_init(void);
|
||||||
* the actual errno after a socket operation fails.
|
* the actual errno after a socket operation fails.
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
/** Expands to WSA<b>e</b> on Windows, and to <b>e</b> elsewhere. */
|
||||||
|
#define SOCK_ERRNO(e) WSA##e
|
||||||
/** Return true if e is EAGAIN or the local equivalent. */
|
/** Return true if e is EAGAIN or the local equivalent. */
|
||||||
#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
|
#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
|
||||||
/** Return true if e is EINPROGRESS or the local equivalent. */
|
/** Return true if e is EINPROGRESS or the local equivalent. */
|
||||||
|
@ -520,6 +522,7 @@ int network_init(void);
|
||||||
int tor_socket_errno(tor_socket_t sock);
|
int tor_socket_errno(tor_socket_t sock);
|
||||||
const char *tor_socket_strerror(int e);
|
const char *tor_socket_strerror(int e);
|
||||||
#else
|
#else
|
||||||
|
#define SOCK_ERRNO(e) e
|
||||||
#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN)
|
#define ERRNO_IS_EAGAIN(e) ((e) == EAGAIN)
|
||||||
#define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS)
|
#define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS)
|
||||||
#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS)
|
#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS)
|
||||||
|
|
|
@ -1336,7 +1336,7 @@ connection_connect(connection_t *conn, const char *address,
|
||||||
|
|
||||||
if (get_n_open_sockets() >= get_options()->_ConnLimit-1) {
|
if (get_n_open_sockets() >= get_options()->_ConnLimit-1) {
|
||||||
warn_too_many_conns();
|
warn_too_many_conns();
|
||||||
*socket_error = ENOBUFS;
|
*socket_error = SOCK_ERRNO(ENOBUFS);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ connection_connect(connection_t *conn, const char *address,
|
||||||
conn->s = s;
|
conn->s = s;
|
||||||
if (connection_add_connecting(conn) < 0) {
|
if (connection_add_connecting(conn) < 0) {
|
||||||
/* no space, forget it */
|
/* no space, forget it */
|
||||||
*socket_error = ENOBUFS;
|
*socket_error = SOCK_ERRNO(ENOBUFS);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return inprogress ? 0 : 1;
|
return inprogress ? 0 : 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue