|
|
|
|
@ -314,14 +314,16 @@ static err_t proxy_poll_cb(void *arg, struct tcp_pcb *pcb) {
|
|
|
|
|
int done = (pending == 0 && pc->pcb->unsent == NULL && pc->pcb->unacked == NULL); |
|
|
|
|
uint32_t sndbuf = tcp_sndbuf(pc->pcb); |
|
|
|
|
if (done || sndbuf == 0) { |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY CLOSE stream=%016llx tun=1 pending=%u done=%d sndbuf=%u", |
|
|
|
|
(unsigned long long)pc->remote_stream_id, pending, done, sndbuf); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY CLOSE stream=%016llx tun=1 pending=%u done=%d sndbuf=%u cwnd=%u unsent=%p unacked=%p", |
|
|
|
|
(unsigned long long)pc->remote_stream_id, pending, done, sndbuf, |
|
|
|
|
pc->pcb->cwnd, (void*)pc->pcb->unsent, (void*)pc->pcb->unacked); |
|
|
|
|
pc->transport->ops->close(pc->transport); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (pc->closing_tun && (pc->closing_rem || pc->closing_sent) && pc->pcb) { |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY CLEANUP stream=%016llx tun=1 rem=%d sent=%d", |
|
|
|
|
(unsigned long long)pc->remote_stream_id, pc->closing_rem, pc->closing_sent); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY CLEANUP stream=%016llx tun=1 rem=%d sent=%d cwnd=%u sndbuf=%u unsent=%p unacked=%p", |
|
|
|
|
(unsigned long long)pc->remote_stream_id, pc->closing_rem, pc->closing_sent, |
|
|
|
|
pc->pcb->cwnd, pc->pcb->snd_buf, (void*)pc->pcb->unsent, (void*)pc->pcb->unacked); |
|
|
|
|
struct tcp_pcb *save = pc->pcb; |
|
|
|
|
tcp_arg(save, NULL); pc->pcb = NULL; tcp_close(save); |
|
|
|
|
struct tcp_proxy *proxy = pc->proxy; |
|
|
|
|
@ -728,7 +730,15 @@ void tcp_proxy_etcp_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry) {
|
|
|
|
|
if (delta > 1) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "TCP proxy: seq gap seq=%u last=%u stream=%016llx, tearing down", seq, et->recv_last_seq, (unsigned long long)stream_id); |
|
|
|
|
pc->closing_rem = 1; |
|
|
|
|
if (pc->transport) { pc->transport->ops->destroy(pc->transport); pc->transport = NULL; } |
|
|
|
|
if (pc->transport) { pc->transport->ops->destroy(pc->transport); pc->transport = NULL; } |
|
|
|
|
{ |
|
|
|
|
int n_active = 0, n_tw = 0; |
|
|
|
|
struct tcp_pcb* pcb2; |
|
|
|
|
for (pcb2 = proxy->lwip->active_pcbs; pcb2; pcb2 = pcb2->next) n_active++; |
|
|
|
|
for (pcb2 = proxy->lwip->tw_pcbs; pcb2; pcb2 = pcb2->next) n_tw++; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY CLEANUP done stream=%016llx active_pcbs=%d tw_pcbs=%d", |
|
|
|
|
(unsigned long long)pc->remote_stream_id, n_active, n_tw); |
|
|
|
|
} |
|
|
|
|
queue_dgram_free(entry); queue_entry_free(entry); return; |
|
|
|
|
} |
|
|
|
|
et->recv_last_seq = seq; |
|
|
|
|
|