Do not override error code of setsockopt

This commit is contained in:
Linus Yang
2018-03-12 12:41:51 +08:00
parent b4c5021c65
commit 0a11c87aa5
2 changed files with 2 additions and 4 deletions
+1 -2
View File
@@ -384,14 +384,13 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
if(setsockopt(remote->fd, IPPROTO_TCP, TCP_FASTOPEN,
&optval, sizeof(optval)) != 0) {
ERROR("setsockopt");
err = WSAEOPNOTSUPP;
break;
}
// Load ConnectEx function
LPFN_CONNECTEX ConnectEx = winsock_getconnectex();
if (ConnectEx == NULL) {
LOGE("Cannot load ConnectEx() function");
err = WSAEOPNOTSUPP;
err = WSAENOPROTOOPT;
break;
}
// ConnectEx requires a bound socket
+1 -2
View File
@@ -530,14 +530,13 @@ connect_to_remote(EV_P_ struct addrinfo *res,
if(setsockopt(sockfd, IPPROTO_TCP, TCP_FASTOPEN,
&optval, sizeof(optval)) != 0) {
ERROR("setsockopt");
err = WSAEOPNOTSUPP;
break;
}
// Load ConnectEx function
LPFN_CONNECTEX ConnectEx = winsock_getconnectex();
if (ConnectEx == NULL) {
LOGE("Cannot load ConnectEx() function");
err = WSAEOPNOTSUPP;
err = WSAENOPROTOOPT;
break;
}
// ConnectEx requires a bound socket