diff --git a/src/tcp_proxy.c b/src/tcp_proxy.c index 26b73483..84d96257 100644 --- a/src/tcp_proxy.c +++ b/src/tcp_proxy.c @@ -157,7 +157,7 @@ static int tcp_proxy_handle_non_tcp(struct tcp_proxy* p, uint8_t* buf, size_t le // Помощник: передача данных из очереди to_lwip в lwIP TCP // ==================================================================== static void proxy_feed_from_transport(struct proxy_conn *pc) { - if (!pc->to_lwip || !pc->pcb) return; + if (!pc->to_lwip || !pc->pcb || pc->tun_closed) return; int sent_any = 0; uint32_t q_pre = queue_entry_count(pc->to_lwip); while (1) { @@ -410,7 +410,7 @@ static void handle_data(struct tcp_proxy* p, struct ETCP_CONN* conn, uint32_t st if (conn) proxy_send_msg(p->inst, conn->peer_node_id, TCP_PROXY_SUBCMD_CLOSE, stream_id, NULL, 0); queue_dgram_free(entry); queue_entry_free(entry); return; } - if (pc->rem_closed || pc->error) { queue_dgram_free(entry); queue_entry_free(entry); return; } + if (pc->rem_closed || pc->error || pc->tun_closed) { queue_dgram_free(entry); queue_entry_free(entry); return; } size_t data_len = entry->len - TCP_PROXY_HDR_SIZE; DEBUG_INFO(DEBUG_CATEGORY_TRAFFIC, "PROXY DATA <- sid=%08x len=%zu", stream_id, data_len); if (data_len > 0) {