mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-22 22:25:54 +00:00
patches 1492, 1493 and 1494 from Marc
This commit is contained in:
parent
cda867d52b
commit
cd65d36822
|
@ -63,8 +63,8 @@ The following functions must be implemented by the sys_arch:
|
||||||
If the timeout argument is non-zero, the return value is the number of
|
If the timeout argument is non-zero, the return value is the number of
|
||||||
milliseconds spent waiting for the semaphore to be signaled. If the
|
milliseconds spent waiting for the semaphore to be signaled. If the
|
||||||
semaphore wasn't signaled within the specified time, the return value is
|
semaphore wasn't signaled within the specified time, the return value is
|
||||||
0xffffffff. If the thread didn't have to wait for the semaphore (i.e., it
|
SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore
|
||||||
was already signaled), the function may return zero.
|
(i.e., it was already signaled), the function may return zero.
|
||||||
|
|
||||||
Notice that lwIP implements a function with a similar name,
|
Notice that lwIP implements a function with a similar name,
|
||||||
sys_sem_wait(), that uses the sys_arch_sem_wait() function.
|
sys_sem_wait(), that uses the sys_arch_sem_wait() function.
|
||||||
|
@ -93,7 +93,8 @@ The following functions must be implemented by the sys_arch:
|
||||||
should be dropped.
|
should be dropped.
|
||||||
|
|
||||||
The return values are the same as for the sys_arch_sem_wait() function:
|
The return values are the same as for the sys_arch_sem_wait() function:
|
||||||
Number of milliseconds spent waitng or 0xffffffff if there was a timeout.
|
Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a
|
||||||
|
timeout.
|
||||||
|
|
||||||
Note that a function with a similar name, sys_mbox_fetch(), is
|
Note that a function with a similar name, sys_mbox_fetch(), is
|
||||||
implemented by lwIP.
|
implemented by lwIP.
|
||||||
|
|
|
@ -511,7 +511,7 @@ netconn_recv(struct netconn *conn)
|
||||||
if (conn->callback)
|
if (conn->callback)
|
||||||
(*conn->callback)(conn, NETCONN_EVT_RCVMINUS, len);
|
(*conn->callback)(conn, NETCONN_EVT_RCVMINUS, len);
|
||||||
|
|
||||||
/* If we are closed, we indicate that we no longer wish to recieve
|
/* If we are closed, we indicate that we no longer wish to receive
|
||||||
data by setting conn->recvmbox to SYS_MBOX_NULL. */
|
data by setting conn->recvmbox to SYS_MBOX_NULL. */
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
memp_freep(MEMP_NETBUF, buf);
|
memp_freep(MEMP_NETBUF, buf);
|
||||||
|
|
|
@ -237,7 +237,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
|
||||||
/* send ICMP destination protocol unreachable */
|
/* send ICMP destination protocol unreachable */
|
||||||
icmp_dest_unreach(p, ICMP_DUR_PROTO);
|
icmp_dest_unreach(p, ICMP_DUR_PROTO);
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
DEBUGF(IP_DEBUG, ("Unsupported transportation protocol %u\n",
|
DEBUGF(IP_DEBUG, ("Unsupported transport protocol %u\n",
|
||||||
iphdr->nexthdr));
|
iphdr->nexthdr));
|
||||||
|
|
||||||
#ifdef IP_STATS
|
#ifdef IP_STATS
|
||||||
|
|
|
@ -64,12 +64,12 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||||
if (timeouts->next->time > 0) {
|
if (timeouts->next->time > 0) {
|
||||||
time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
|
time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
|
||||||
} else {
|
} else {
|
||||||
time = 0xffffffff;
|
time = SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time == 0xffffffff) {
|
if (time == SYS_ARCH_TIMEOUT) {
|
||||||
/* If time == 0xffffffff, a timeout occured before a message could be
|
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
||||||
fetched. We should now call the timeout handler and
|
could be fetched. We should now call the timeout handler and
|
||||||
deallocate the memory allocated for the timeout. */
|
deallocate the memory allocated for the timeout. */
|
||||||
tmptimeout = timeouts->next;
|
tmptimeout = timeouts->next;
|
||||||
timeouts->next = tmptimeout->next;
|
timeouts->next = tmptimeout->next;
|
||||||
|
@ -84,7 +84,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **msg)
|
||||||
/* We try again to fetch a message from the mbox. */
|
/* We try again to fetch a message from the mbox. */
|
||||||
goto again;
|
goto again;
|
||||||
} else {
|
} else {
|
||||||
/* If time != 0xffffffff, a message was received before the timeout
|
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
||||||
occured. The time variable is set to the number of
|
occured. The time variable is set to the number of
|
||||||
milliseconds we waited for the message. */
|
milliseconds we waited for the message. */
|
||||||
if (time <= timeouts->next->time) {
|
if (time <= timeouts->next->time) {
|
||||||
|
@ -119,12 +119,12 @@ sys_sem_wait(sys_sem_t sem)
|
||||||
if (timeouts->next->time > 0) {
|
if (timeouts->next->time > 0) {
|
||||||
time = sys_arch_sem_wait(sem, timeouts->next->time);
|
time = sys_arch_sem_wait(sem, timeouts->next->time);
|
||||||
} else {
|
} else {
|
||||||
time = 0xffffffff;
|
time = SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time == 0xffffffff) {
|
if (time == SYS_ARCH_TIMEOUT) {
|
||||||
/* If time == 0xffffffff, a timeout occured before a message could be
|
/* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
|
||||||
fetched. We should now call the timeout handler and
|
could be fetched. We should now call the timeout handler and
|
||||||
deallocate the memory allocated for the timeout. */
|
deallocate the memory allocated for the timeout. */
|
||||||
tmptimeout = timeouts->next;
|
tmptimeout = timeouts->next;
|
||||||
timeouts->next = tmptimeout->next;
|
timeouts->next = tmptimeout->next;
|
||||||
|
@ -140,7 +140,7 @@ sys_sem_wait(sys_sem_t sem)
|
||||||
/* We try again to fetch a message from the mbox. */
|
/* We try again to fetch a message from the mbox. */
|
||||||
goto again;
|
goto again;
|
||||||
} else {
|
} else {
|
||||||
/* If time != 0xffffffff, a message was received before the timeout
|
/* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
|
||||||
occured. The time variable is set to the number of
|
occured. The time variable is set to the number of
|
||||||
milliseconds we waited for the message. */
|
milliseconds we waited for the message. */
|
||||||
if (time <= timeouts->next->time) {
|
if (time <= timeouts->next->time) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */
|
||||||
|
|
||||||
struct tcp_pcb *tcp_tmp_pcb;
|
struct tcp_pcb *tcp_tmp_pcb;
|
||||||
|
|
||||||
#define MIN(x,y) (x) < (y)? (x): (y)
|
#define LWIP_MIN(x,y) (x) < (y)? (x): (y)
|
||||||
|
|
||||||
static u8_t tcp_timer;
|
static u8_t tcp_timer;
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ tcp_slowtmr(void)
|
||||||
}
|
}
|
||||||
tcp_rexmit(pcb);
|
tcp_rexmit(pcb);
|
||||||
/* Reduce congestion window and ssthresh. */
|
/* Reduce congestion window and ssthresh. */
|
||||||
eff_wnd = MIN(pcb->cwnd, pcb->snd_wnd);
|
eff_wnd = LWIP_MIN(pcb->cwnd, pcb->snd_wnd);
|
||||||
pcb->ssthresh = eff_wnd >> 1;
|
pcb->ssthresh = eff_wnd >> 1;
|
||||||
if (pcb->ssthresh < pcb->mss) {
|
if (pcb->ssthresh < pcb->mss) {
|
||||||
pcb->ssthresh = pcb->mss * 2;
|
pcb->ssthresh = pcb->mss * 2;
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
#include "lwip/stats.h"
|
#include "lwip/stats.h"
|
||||||
|
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
#define MIN(x,y) (x) < (y)? (x): (y)
|
#define LWIP_MIN(x,y) (x) < (y)? (x): (y)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ tcp_output(struct tcp_pcb *pcb)
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
wnd = MIN(pcb->snd_wnd, pcb->cwnd);
|
wnd = LWIP_MIN(pcb->snd_wnd, pcb->cwnd);
|
||||||
|
|
||||||
|
|
||||||
seg = pcb->unsent;
|
seg = pcb->unsent;
|
||||||
|
|
|
@ -252,8 +252,8 @@ struct tcp_pcb {
|
||||||
|
|
||||||
u16_t acked;
|
u16_t acked;
|
||||||
|
|
||||||
u16_t snd_buf; /* Avaliable buffer space for sending (in bytes). */
|
u16_t snd_buf; /* Available buffer space for sending (in bytes). */
|
||||||
u8_t snd_queuelen; /* Avaliable buffer space for sending (in tcp_segs). */
|
u8_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
|
||||||
|
|
||||||
|
|
||||||
/* These are ordered by sequence number: */
|
/* These are ordered by sequence number: */
|
||||||
|
@ -424,7 +424,7 @@ extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. *
|
||||||
|
|
||||||
extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
|
extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
|
||||||
|
|
||||||
/* Axoims about the above lists:
|
/* Axioms about the above lists:
|
||||||
1) Every TCP PCB that is not CLOSED is in one of the lists.
|
1) Every TCP PCB that is not CLOSED is in one of the lists.
|
||||||
2) A PCB is only in one of the lists.
|
2) A PCB is only in one of the lists.
|
||||||
3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
|
3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user