Skip to content

Commit

Permalink
Fix: shadowsocks not working
Browse files Browse the repository at this point in the history
  • Loading branch information
semigodking committed Nov 23, 2019
1 parent cba154c commit d32011d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion shadowsocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ typedef union {
unsigned char addr_type;
ss_header_ipv4 v4;
ss_header_ipv6 v6;
} ss_header;
} PACKED ss_header;

#endif
13 changes: 7 additions & 6 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ struct bufferevent* red_connect_relay_tfo(const char *ifname,

retval = red_prepare_relay(ifname, addr->ss_family, readcb, writecb, errorcb, cbarg);
if (retval) {
// write data to evbuffer so that data can be sent when connection is set up
if (bufferevent_write(retval, data, *len) != 0) {
log_errno(LOG_NOTICE, "bufferevent_write");
*len = 0; // Nothing sent, caller needs to write data again when connection is setup.
goto fail;
}

relay_fd = bufferevent_getfd(retval);
if (timeout_write)
bufferevent_set_timeouts(retval, NULL, timeout_write);
Expand Down Expand Up @@ -345,12 +352,6 @@ struct bufferevent* red_connect_relay_tfo(const char *ifname,
log_errno(LOG_NOTICE, "connect");
goto fail;
}
// write data to evbuffer so that data can be sent when connection is set up
if (bufferevent_write(retval, data, *len) != 0) {
log_errno(LOG_NOTICE, "bufferevent_write");
*len = 0; // Nothing sent, caller needs to write data again when connection is setup.
goto fail;
}
}
return retval;

Expand Down

0 comments on commit d32011d

Please sign in to comment.