From 0a11c87aa5903b83a0cebb5cc1b0efaa63b61c05 Mon Sep 17 00:00:00 2001 From: Linus Yang Date: Mon, 12 Mar 2018 12:41:51 +0800 Subject: [PATCH] Do not override error code of setsockopt --- src/local.c | 3 +-- src/server.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/local.c b/src/local.c index 3da1302a..01a1a26a 100644 --- a/src/local.c +++ b/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, &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 diff --git a/src/server.c b/src/server.c index a968a2bc..cc361e6b 100644 --- a/src/server.c +++ b/src/server.c @@ -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