mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-04 21:39:49 +00:00
altcp: priority-based pcb/conn allocation required
altcp_tcp_new_ip_type: allocate the tcp pcb first to invoke the priority handling code if we're out of pcbs
This commit is contained in:
parent
f9bc3cae5d
commit
2a4dd0dc7b
@ -185,18 +185,20 @@ altcp_tcp_setup(struct altcp_pcb *conn, struct tcp_pcb *tpcb)
|
||||
struct altcp_pcb *
|
||||
altcp_tcp_new_ip_type(u8_t ip_type)
|
||||
{
|
||||
struct altcp_pcb *ret = altcp_alloc();
|
||||
if (ret != NULL) {
|
||||
/* Allocate the tcp pcb first to invoke the priority handling code
|
||||
if we're out of pcbs */
|
||||
struct tcp_pcb *tpcb = tcp_new_ip_type(ip_type);
|
||||
if (tpcb != NULL) {
|
||||
struct altcp_pcb *ret = altcp_alloc();
|
||||
if (ret != NULL) {
|
||||
altcp_tcp_setup(ret, tpcb);
|
||||
} else {
|
||||
/* tcp_pcb allocation failed -> free the altcp_pcb too */
|
||||
altcp_free(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
/* altcp_pcb allocation failed -> free the tcp_pcb too */
|
||||
tcp_close(tpcb);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct altcp_pcb *
|
||||
|
Loading…
x
Reference in New Issue
Block a user