On Sun, Jun 02, 2019 at 04:57:13PM +0800, Alec Liu wrote:
> Hi Willy,
> 
> Just get it tested, nothing to do with check-send-proxy, still the
> same no response.

Hmmm that's annoying because I have one here. Thus probably it's a matter
of polling issue (wait vs immediate response).

> I have some change as below to make it work again.
> 
> =================
> diff --git a/src/connection.c b/src/connection.c
> index f0ca2bb16..c8ebe9da4 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -1017,17 +1017,12 @@ int conn_send_socks4_proxy_request(struct
> connection *conn)
>          if (conn->send_proxy_ofs != 0) {
>              goto out_wait;
>          }
> -    }
> -
> -    /* OK we've the whole request sent */
> -    conn->flags &= ~CO_FL_SOCKS4_SEND;
> -    __conn_sock_stop_send(conn);
> +
> +        /* OK we've the whole request sent */
> +        conn->flags &= ~CO_FL_SOCKS4_SEND;

Please be careful not to reindent the code in your changes, as that
complicates the review. So what I'm seeing is that you only removed
the conn_sock_stop_send() call above, right ?

> -    /* The connection is ready now, simply return and let the connection
> -     * handler notify upper layers if needed.
> -     */
> -    if (conn->flags & CO_FL_WAIT_L4_CONN)
> -        conn->flags &= ~CO_FL_WAIT_L4_CONN;
> +        __conn_sock_want_recv(conn);
> +    }

I disagree with adjusting the recv polling when sending. It should be
set (if needed) when entering the socks4 recv handler. Also I don't
see how that can fix the problem given that if I understand well, in
your case it's the server's response which fails, thus it's unrelated
to conn_sock (or we have a deeper issue here).

>      if (conn->flags & CO_FL_SEND_PROXY) {
>          /*
> @@ -1157,6 +1152,16 @@ int conn_recv_socks4_proxy_response(struct
> connection *conn)
>      } while (0);
> 
>      conn->flags &= ~CO_FL_SOCKS4_RECV;
> +
> +    if (conn->flags & CO_FL_WAIT_L4_CONN) {
> +        if (!(conn->flags & CO_FL_HANDSHAKE & ~CO_FL_SOCKS4)) {
> +            /* No more handshake needed, the connection is ready now,
> +             * simply return and let the connection handler notify
> +             * upper layers if needed.
> +             */
> +            conn->flags &= ~CO_FL_WAIT_L4_CONN;
> +            }
> +        }

Wow, I didn't notice this one was missing, this can actually be the
real cause. I'm going to run more tests as well. I was about to issue
dev5 but it can wait a few more minutes, I'll delete my tag.

Willy

Reply via email to