mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-24 23:25:58 +00:00
Fixed tabs into spaces. Fixed other stylos.
This commit is contained in:
parent
7662015de6
commit
9bc16878ea
@ -33,9 +33,6 @@
|
|||||||
#include "lwip/ip_addr.h"
|
#include "lwip/ip_addr.h"
|
||||||
#include "lwip/inet.h"
|
#include "lwip/inet.h"
|
||||||
|
|
||||||
|
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */
|
||||||
const struct ip_addr ip_addr_any = { 0x00000000UL };
|
const struct ip_addr ip_addr_any = { 0x00000000UL };
|
||||||
const struct ip_addr ip_addr_broadcast = { 0xffffffffUL };
|
const struct ip_addr ip_addr_broadcast = { 0xffffffffUL };
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
|
||||||
|
@ -529,10 +529,11 @@ pbuf_free(struct pbuf *p)
|
|||||||
*/
|
*/
|
||||||
SYS_ARCH_PROTECT(old_level);
|
SYS_ARCH_PROTECT(old_level);
|
||||||
/* de-allocate all consecutive pbufs from the head of the chain that
|
/* de-allocate all consecutive pbufs from the head of the chain that
|
||||||
* obtain a zero reference count */
|
* obtain a zero reference count after decrementing*/
|
||||||
while (p != NULL) {
|
while (p != NULL) {
|
||||||
/* all pbufs in a chain are referenced at least once */
|
/* all pbufs in a chain are referenced at least once */
|
||||||
LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
|
LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
|
||||||
|
/* decrease reference count (number of pointers to pbuf) */
|
||||||
p->ref--;
|
p->ref--;
|
||||||
/* this pbuf is no longer referenced to? */
|
/* this pbuf is no longer referenced to? */
|
||||||
if (p->ref == 0) {
|
if (p->ref == 0) {
|
||||||
@ -543,10 +544,10 @@ pbuf_free(struct pbuf *p)
|
|||||||
p->len = p->tot_len = PBUF_POOL_BUFSIZE;
|
p->len = p->tot_len = PBUF_POOL_BUFSIZE;
|
||||||
p->payload = (void *)((u8_t *)p + sizeof(struct pbuf));
|
p->payload = (void *)((u8_t *)p + sizeof(struct pbuf));
|
||||||
PBUF_POOL_FREE(p);
|
PBUF_POOL_FREE(p);
|
||||||
/* a RAM/ROM referencing pbuf */
|
/* a ROM or RAM referencing pbuf */
|
||||||
} else if (p->flags == PBUF_FLAG_ROM || p->flags == PBUF_FLAG_REF) {
|
} else if (p->flags == PBUF_FLAG_ROM || p->flags == PBUF_FLAG_REF) {
|
||||||
memp_freep(MEMP_PBUF, p);
|
memp_freep(MEMP_PBUF, p);
|
||||||
/* pbuf with data */
|
/* p->flags == PBUF_FLAG_RAM */
|
||||||
} else {
|
} else {
|
||||||
mem_free(p);
|
mem_free(p);
|
||||||
}
|
}
|
||||||
@ -554,7 +555,7 @@ pbuf_free(struct pbuf *p)
|
|||||||
/* proceed to next pbuf */
|
/* proceed to next pbuf */
|
||||||
p = q;
|
p = q;
|
||||||
/* p->ref > 0, this pbuf is still referenced to */
|
/* p->ref > 0, this pbuf is still referenced to */
|
||||||
/* (so the remaining pbufs in chain as well) */
|
/* (and so the remaining pbufs in chain as well) */
|
||||||
} else {
|
} else {
|
||||||
/* stop walking through chain */
|
/* stop walking through chain */
|
||||||
p = NULL;
|
p = NULL;
|
||||||
|
@ -500,13 +500,11 @@ tcp_slowtmr(void)
|
|||||||
pcb->rtime, pcb->rto));
|
pcb->rtime, pcb->rto));
|
||||||
|
|
||||||
/* Double retransmission time-out unless we are trying to
|
/* Double retransmission time-out unless we are trying to
|
||||||
connect to somebody (i.e., we are in SYN_SENT). */
|
* connect to somebody (i.e., we are in SYN_SENT). */
|
||||||
if (pcb->state != SYN_SENT) {
|
if (pcb->state != SYN_SENT) {
|
||||||
pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[pcb->nrtx];
|
pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[pcb->nrtx];
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = MIN(pcb->cwnd, pcb->snd_wnd);
|
||||||
pcb->ssthresh = eff_wnd >> 1;
|
pcb->ssthresh = eff_wnd >> 1;
|
||||||
@ -514,12 +512,10 @@ tcp_slowtmr(void)
|
|||||||
pcb->ssthresh = pcb->mss * 2;
|
pcb->ssthresh = pcb->mss * 2;
|
||||||
}
|
}
|
||||||
pcb->cwnd = pcb->mss;
|
pcb->cwnd = pcb->mss;
|
||||||
|
|
||||||
DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: cwnd %u ssthresh %u\n",
|
DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: cwnd %u ssthresh %u\n",
|
||||||
pcb->cwnd, pcb->ssthresh));
|
pcb->cwnd, pcb->ssthresh));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this PCB has stayed too long in FIN-WAIT-2 */
|
/* Check if this PCB has stayed too long in FIN-WAIT-2 */
|
||||||
if (pcb->state == FIN_WAIT_2) {
|
if (pcb->state == FIN_WAIT_2) {
|
||||||
if((u32_t)(tcp_ticks - pcb->tmr) >
|
if((u32_t)(tcp_ticks - pcb->tmr) >
|
||||||
|
@ -337,12 +337,12 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
|
|
||||||
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_send\n"));
|
DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_send\n"));
|
||||||
|
|
||||||
/* if the PCB is not yet bound, bind it here */
|
/* if the PCB is not yet bound to a port, bind it here */
|
||||||
if (pcb->local_port == 0) {
|
if (pcb->local_port == 0) {
|
||||||
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: not yet bound\n"));
|
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: not yet bound to a port, binding now\n"));
|
||||||
err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
|
err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
|
||||||
if (err != ERR_OK) {
|
if (err != ERR_OK) {
|
||||||
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: forced bind failed\n"));
|
DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: forced port bind failed\n"));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,6 +360,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
pbuf_chain(q, p);
|
pbuf_chain(q, p);
|
||||||
/* { first pbuf q points to header pbuf } */
|
/* { first pbuf q points to header pbuf } */
|
||||||
DEBUGF(UDP_DEBUG, ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p));
|
DEBUGF(UDP_DEBUG, ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p));
|
||||||
|
/* adding a header within p succeeded */
|
||||||
} else {
|
} else {
|
||||||
/* first pbuf q equals given pbuf */
|
/* first pbuf q equals given pbuf */
|
||||||
q = p;
|
q = p;
|
||||||
@ -380,7 +381,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
}
|
}
|
||||||
/* using IP_ANY_ADDR? */
|
/* using IP_ANY_ADDR? */
|
||||||
if (ip_addr_isany(&pcb->local_ip)) {
|
if (ip_addr_isany(&pcb->local_ip)) {
|
||||||
/* use network interface IP address as source address */
|
/* use outgoing network interface IP address as source address */
|
||||||
src_ip = &(netif->ip_addr);
|
src_ip = &(netif->ip_addr);
|
||||||
} else {
|
} else {
|
||||||
/* use UDP PCB local IP address as source address */
|
/* use UDP PCB local IP address as source address */
|
||||||
|
@ -209,7 +209,6 @@ struct tcp_pcb {
|
|||||||
u32_t rcv_nxt; /* next seqno expected */
|
u32_t rcv_nxt; /* next seqno expected */
|
||||||
u16_t rcv_wnd; /* receiver window */
|
u16_t rcv_wnd; /* receiver window */
|
||||||
|
|
||||||
|
|
||||||
/* Timers */
|
/* Timers */
|
||||||
u32_t tmr;
|
u32_t tmr;
|
||||||
u8_t polltmr, pollinterval;
|
u8_t polltmr, pollinterval;
|
||||||
|
Loading…
Reference in New Issue
Block a user