Release TUN proxy connections when lwIP aborts their PCB
This commit is contained in:
1 parent
f19ff11b36
commit
09bc8c35c5
1 file changed
+5
-6
@@ -452,12 +452,11 @@ static void tcp_proxy_client_err_cb(void *arg, err_t err) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_PROXY, "TCP proxy client: error %d sid=%08x fin_local=%d rem_closed=%d",
|
||||
err, pc->stream_id, pc->fin_local, pc->rem_closed);
|
||||
pc->pcb = NULL; // pcb уже освобождён (или вот-вот) стеком lwip — не разыменовывать
|
||||
if (err == LERR_CLSD) { // graceful close активной стороной — ERROR слать не нужно
|
||||
tcp_proxy_client_conn_free(pc);
|
||||
return;
|
||||
if (err != LERR_CLSD) {
|
||||
pc->error = 1;
|
||||
if (tcp_proxy_client_send_error(pc) < 0) DEBUG_ERROR(DEBUG_CATEGORY_PROXY, "PROXY send_error failed sid=%08x", pc->stream_id);
|
||||
}
|
||||
pc->error = 1;
|
||||
if (tcp_proxy_client_send_error(pc) < 0) DEBUG_ERROR(DEBUG_CATEGORY_PROXY, "PROXY send_error failed sid=%08x", pc->stream_id);
|
||||
tcp_proxy_client_conn_free(pc);
|
||||
}
|
||||
|
||||
static err_t tcp_proxy_client_poll_cb(void *arg, struct tcp_pcb *pcb) {
|
||||
@@ -476,7 +475,7 @@ static err_t tcp_proxy_client_poll_cb(void *arg, struct tcp_pcb *pcb) {
|
||||
pc->pcb = NULL;
|
||||
}
|
||||
tcp_proxy_client_conn_free(pc);
|
||||
return LERR_OK;
|
||||
return LERR_ABRT;
|
||||
}
|
||||
|
||||
if (pc->close_pending) {
|
||||
|
||||
Reference in new issue
Block a user