Browse Source

Do not override error code of setsockopt

pull/1965/head
Linus Yang 6 years ago
parent
commit
0a11c87aa5
2 changed files with 2 additions and 4 deletions
  1. 3
      src/local.c
  2. 3
      src/server.c

3
src/local.c

@ -384,14 +384,13 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
if(setsockopt(remote->fd, IPPROTO_TCP, TCP_FASTOPEN, if(setsockopt(remote->fd, IPPROTO_TCP, TCP_FASTOPEN,
&optval, sizeof(optval)) != 0) { &optval, sizeof(optval)) != 0) {
ERROR("setsockopt"); ERROR("setsockopt");
err = WSAEOPNOTSUPP;
break; break;
} }
// Load ConnectEx function // Load ConnectEx function
LPFN_CONNECTEX ConnectEx = winsock_getconnectex(); LPFN_CONNECTEX ConnectEx = winsock_getconnectex();
if (ConnectEx == NULL) { if (ConnectEx == NULL) {
LOGE("Cannot load ConnectEx() function"); LOGE("Cannot load ConnectEx() function");
err = WSAEOPNOTSUPP;
err = WSAENOPROTOOPT;
break; break;
} }
// ConnectEx requires a bound socket // ConnectEx requires a bound socket

3
src/server.c

@ -530,14 +530,13 @@ connect_to_remote(EV_P_ struct addrinfo *res,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN, if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN,
&optval, sizeof(optval)) != 0) { &optval, sizeof(optval)) != 0) {
ERROR("setsockopt"); ERROR("setsockopt");
err = WSAEOPNOTSUPP;
break; break;
} }
// Load ConnectEx function // Load ConnectEx function
LPFN_CONNECTEX ConnectEx = winsock_getconnectex(); LPFN_CONNECTEX ConnectEx = winsock_getconnectex();
if (ConnectEx == NULL) { if (ConnectEx == NULL) {
LOGE("Cannot load ConnectEx() function"); LOGE("Cannot load ConnectEx() function");
err = WSAEOPNOTSUPP;
err = WSAENOPROTOOPT;
break; break;
} }
// ConnectEx requires a bound socket // ConnectEx requires a bound socket

Loading…
Cancel
Save