Better log socks5 to find infinite loop source
This commit is contained in:
parent
cd02554eba
commit
86c2b2d9a6
1 changed files with 3 additions and 0 deletions
|
@ -241,6 +241,7 @@ int on_socks5_recv_server_reply(struct evt_core_ctx* ctx, struct evt_core_fdinfo
|
||||||
|
|
||||||
// Read headers
|
// Read headers
|
||||||
if (s5ctx->sr_cursor < fixed_headers_size) {
|
if (s5ctx->sr_cursor < fixed_headers_size) {
|
||||||
|
printf(" [socks5] read headers\n");
|
||||||
readn = read(fdinfo->fd, (char*)&s5ctx->sr + s5ctx->sr_cursor, fixed_headers_size - s5ctx->sr_cursor);
|
readn = read(fdinfo->fd, (char*)&s5ctx->sr + s5ctx->sr_cursor, fixed_headers_size - s5ctx->sr_cursor);
|
||||||
if (readn == -1 && errno == EAGAIN) return 1;
|
if (readn == -1 && errno == EAGAIN) return 1;
|
||||||
if (readn < 0) goto move_to_failed;
|
if (readn < 0) goto move_to_failed;
|
||||||
|
@ -250,6 +251,7 @@ int on_socks5_recv_server_reply(struct evt_core_ctx* ctx, struct evt_core_fdinfo
|
||||||
|
|
||||||
// Read host
|
// Read host
|
||||||
if (!s5ctx->sr_host_read) {
|
if (!s5ctx->sr_host_read) {
|
||||||
|
printf(" [socks5] read host\n");
|
||||||
if (s5ctx->sr.atyp == ATYP_IPV4) return socks5_server_reply_atyp_ipv4(ctx, fdinfo);
|
if (s5ctx->sr.atyp == ATYP_IPV4) return socks5_server_reply_atyp_ipv4(ctx, fdinfo);
|
||||||
else if (s5ctx->sr.atyp == ATYP_IPV6) return socks5_server_reply_atyp_ipv6(ctx, fdinfo);
|
else if (s5ctx->sr.atyp == ATYP_IPV6) return socks5_server_reply_atyp_ipv6(ctx, fdinfo);
|
||||||
else if (s5ctx->sr.atyp == ATYP_DOMAINNAME) return socks5_server_reply_atyp_dn(ctx, fdinfo);
|
else if (s5ctx->sr.atyp == ATYP_DOMAINNAME) return socks5_server_reply_atyp_dn(ctx, fdinfo);
|
||||||
|
@ -259,6 +261,7 @@ int on_socks5_recv_server_reply(struct evt_core_ctx* ctx, struct evt_core_fdinfo
|
||||||
// Read port
|
// Read port
|
||||||
size_t final_size = socks5_server_reply_size(&s5ctx->sr);
|
size_t final_size = socks5_server_reply_size(&s5ctx->sr);
|
||||||
if (s5ctx->sr_cursor < final_size) {
|
if (s5ctx->sr_cursor < final_size) {
|
||||||
|
printf(" [socks5] read port\n");
|
||||||
size_t relative_cursor = s5ctx->sr_cursor - (final_size - sizeof(s5ctx->sr.port));
|
size_t relative_cursor = s5ctx->sr_cursor - (final_size - sizeof(s5ctx->sr.port));
|
||||||
readn = read(fdinfo->fd, (char*)&s5ctx->sr.port + relative_cursor, sizeof(s5ctx->sr.port) - relative_cursor);
|
readn = read(fdinfo->fd, (char*)&s5ctx->sr.port + relative_cursor, sizeof(s5ctx->sr.port) - relative_cursor);
|
||||||
if (readn == -1 && errno == EAGAIN) return 1;
|
if (readn == -1 && errno == EAGAIN) return 1;
|
||||||
|
|
Loading…
Reference in a new issue