mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-30 05:11:14 +00:00
Fix #648
This commit is contained in:
+2
-2
@@ -278,7 +278,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
// connecting, wait until connected
|
||||
int r = connect(remote->fd, (struct sockaddr *)&(remote->addr), remote->addr_len);
|
||||
|
||||
if (r < 0 && errno != EINPROGRESS) {
|
||||
if (r < 0 && errno != CONNECT_IN_PROGRESS) {
|
||||
ERROR("connect");
|
||||
close_and_free_remote(EV_A_ remote);
|
||||
close_and_free_server(EV_A_ server);
|
||||
@@ -315,7 +315,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
(struct sockaddr *)&(remote->addr), remote->addr_len);
|
||||
#endif
|
||||
if (s == -1) {
|
||||
if (errno == EINPROGRESS) {
|
||||
if (errno == CONNECT_IN_PROGRESS) {
|
||||
// in progress, wait until connected
|
||||
remote->buf->idx = 0;
|
||||
ev_io_stop(EV_A_ & server_recv_ctx->io);
|
||||
|
||||
+1
-1
@@ -650,7 +650,7 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
|
||||
|
||||
int r = connect(remotefd, remote_addr, get_sockaddr_len(remote_addr));
|
||||
|
||||
if (r < 0 && errno != EINPROGRESS) {
|
||||
if (r < 0 && errno != CONNECT_IN_PROGRESS) {
|
||||
ERROR("connect");
|
||||
close_and_free_remote(EV_A_ remote);
|
||||
close_and_free_server(EV_A_ server);
|
||||
|
||||
+2
-2
@@ -457,7 +457,7 @@ static remote_t *connect_to_remote(struct addrinfo *res,
|
||||
res->ai_addrlen);
|
||||
#endif
|
||||
if (s == -1) {
|
||||
if (errno == EINPROGRESS || errno == EAGAIN
|
||||
if (errno == CONNECT_IN_PROGRESS || errno == EAGAIN
|
||||
|| errno == EWOULDBLOCK) {
|
||||
// The remote server doesn't support tfo or it's the first connection to the server.
|
||||
// It will automatically fall back to conventional TCP.
|
||||
@@ -482,7 +482,7 @@ static remote_t *connect_to_remote(struct addrinfo *res,
|
||||
if (!fast_open) {
|
||||
int r = connect(sockfd, res->ai_addr, res->ai_addrlen);
|
||||
|
||||
if (r < 0 && errno != EINPROGRESS) {
|
||||
if (r < 0 && errno != CONNECT_IN_PROGRESS) {
|
||||
ERROR("connect");
|
||||
close(sockfd);
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -660,7 +660,7 @@ static void accept_cb(EV_P_ ev_io *w, int revents)
|
||||
|
||||
int r = connect(remotefd, remote_addr, get_sockaddr_len(remote_addr));
|
||||
|
||||
if (r < 0 && errno != EINPROGRESS) {
|
||||
if (r < 0 && errno != CONNECT_IN_PROGRESS) {
|
||||
ERROR("connect");
|
||||
close_and_free_remote(EV_A_ remote);
|
||||
close_and_free_server(EV_A_ server);
|
||||
|
||||
Reference in New Issue
Block a user