Kaynağa Gözat

Retry requests when the worker has the connection close

When a tcp_closed or ssl_closed message is handled while ibrowse is
trying to send a request to a worker, ibrowse would incorrectly return a
req_timedout message, when, in fact, the request had not even been
handled.

This patch attempts to avoid that race condition by signalling tcp or
ssl closed messages back to ibrowse differently than a normal exit.
pull/100/head
Andrew Thompson 11 yıl önce
ebeveyn
işleme
07d1d75d54
2 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. +2
    -0
      src/ibrowse.erl
  2. +2
    -2
      src/ibrowse_http_client.erl

+ 2
- 0
src/ibrowse.erl Dosyayı Görüntüle

@ -443,6 +443,8 @@ do_send_req(Conn_Pid, Parsed_url, Headers, Method, Body, Options, Timeout) ->
{error, sel_conn_closed};
{'EXIT', {normal, _}} ->
{error, req_timedout};
{'EXIT', {connection_closed, _}} ->
{error, sel_conn_closed};
{error, connection_closed} ->
{error, sel_conn_closed};
{'EXIT', Reason} ->

+ 2
- 2
src/ibrowse_http_client.erl Dosyayı Görüntüle

@ -215,11 +215,11 @@ handle_info({stream_close, _Req_id}, State) ->
handle_info({tcp_closed, _Sock}, State) ->
do_trace("TCP connection closed by peer!~n", []),
handle_sock_closed(State),
{stop, normal, State};
{stop, connection_closed, State};
handle_info({ssl_closed, _Sock}, State) ->
do_trace("SSL connection closed by peer!~n", []),
handle_sock_closed(State),
{stop, normal, State};
{stop, connection_closed, State};
handle_info({tcp_error, _Sock, Reason}, State) ->
do_trace("Error on connection to ~1000.p:~1000.p -> ~1000.p~n",

Yükleniyor…
İptal
Kaydet