#ifdef SO_REUSE to #if SO_REUSE. Updated copyright years.

This commit is contained in:
likewise 2004-04-23 14:53:18 +00:00
parent 3efda64604
commit 95e738a955
3 changed files with 22 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -1079,7 +1079,7 @@ int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *opt
/* UNIMPL case SO_DONTROUTE: */ /* UNIMPL case SO_DONTROUTE: */
case SO_KEEPALIVE: case SO_KEEPALIVE:
/* UNIMPL case SO_OOBINCLUDE: */ /* UNIMPL case SO_OOBINCLUDE: */
#ifdef SO_REUSE #if SO_REUSE
case SO_REUSEADDR: case SO_REUSEADDR:
case SO_REUSEPORT: case SO_REUSEPORT:
#endif /* SO_REUSE */ #endif /* SO_REUSE */
@ -1182,7 +1182,7 @@ int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_
/* UNIMPL case SO_SNDBUF: */ /* UNIMPL case SO_SNDBUF: */
/* UNIMPL case SO_RCVLOWAT: */ /* UNIMPL case SO_RCVLOWAT: */
/* UNIMPL case SO_SNDLOWAT: */ /* UNIMPL case SO_SNDLOWAT: */
#ifdef SO_REUSE #if SO_REUSE
case SO_REUSEADDR: case SO_REUSEADDR:
case SO_REUSEPORT: case SO_REUSEPORT:
#endif /* SO_REUSE */ #endif /* SO_REUSE */
@ -1264,7 +1264,7 @@ int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_
/* UNIMPL case SO_DONTROUTE: */ /* UNIMPL case SO_DONTROUTE: */
case SO_KEEPALIVE: case SO_KEEPALIVE:
/* UNIMPL case SO_OOBINCLUDE: */ /* UNIMPL case SO_OOBINCLUDE: */
#ifdef SO_REUSE #if SO_REUSE
case SO_REUSEADDR: case SO_REUSEADDR:
case SO_REUSEPORT: case SO_REUSEPORT:
#endif /* SO_REUSE */ #endif /* SO_REUSE */

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -249,7 +249,7 @@ tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
if (port == 0) { if (port == 0) {
port = tcp_new_port(); port = tcp_new_port();
} }
#ifndef SO_REUSE #if SO_REUSE == 0
/* Check if the address already is in use. */ /* Check if the address already is in use. */
for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs; for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs;
cpcb != NULL; cpcb = cpcb->next) { cpcb != NULL; cpcb = cpcb->next) {
@ -444,6 +444,16 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len)
} }
if (!(pcb->flags & TF_ACK_DELAY) && if (!(pcb->flags & TF_ACK_DELAY) &&
!(pcb->flags & TF_ACK_NOW)) { !(pcb->flags & TF_ACK_NOW)) {
/*
* We send an ACK here (if one is not already pending, hence
* the above tests) as tcp_recved() implies that the application
* has processed some data, and so we can open the receiver's
* window to allow more to be transmitted. This could result in
* two ACKs being sent for each received packet in some limited cases
* (where the application is only receiving data, and is slow to
* process it) but it is necessary to guarantee that the sender can
* continue to transmit.
*/
tcp_ack(pcb); tcp_ack(pcb);
} }

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science. * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
@ -153,7 +153,6 @@ tcp_input(struct pbuf *p, struct netif *inp)
return; return;
} }
/* Move the payload pointer in the pbuf so that it points to the /* Move the payload pointer in the pbuf so that it points to the
TCP data instead of the TCP header. */ TCP data instead of the TCP header. */
hdrlen = TCPH_HDRLEN(tcphdr); hdrlen = TCPH_HDRLEN(tcphdr);
@ -173,7 +172,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
for an active connection. */ for an active connection. */
prev = NULL; prev = NULL;
#ifdef SO_REUSE #if SO_REUSE
pcb_temp = tcp_active_pcbs; pcb_temp = tcp_active_pcbs;
again_1: again_1:
@ -191,7 +190,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) && ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) &&
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) { ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) {
#ifdef SO_REUSE #if SO_REUSE
if(pcb->so_options & SOF_REUSEPORT) { if(pcb->so_options & SOF_REUSEPORT) {
if(reuse) { if(reuse) {
/* We processed one PCB already */ /* We processed one PCB already */
@ -361,7 +360,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
tcp_debug_print_state(pcb->state); tcp_debug_print_state(pcb->state);
#endif /* TCP_DEBUG */ #endif /* TCP_DEBUG */
#endif /* TCP_INPUT_DEBUG */ #endif /* TCP_INPUT_DEBUG */
#ifdef SO_REUSE #if SO_REUSE
/* First socket should receive now */ /* First socket should receive now */
if(reuse_port) { if(reuse_port) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: searching next PCB.\n")); LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: searching next PCB.\n"));
@ -373,7 +372,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
#endif /* SO_REUSE */ #endif /* SO_REUSE */
} else { } else {
#ifdef SO_REUSE #if SO_REUSE
if(reuse) { if(reuse) {
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: freeing PBUF with reference counter set to %i\n", p->ref)); LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: freeing PBUF with reference counter set to %i\n", p->ref));
pbuf_free(p); pbuf_free(p);
@ -392,7 +391,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
} }
pbuf_free(p); pbuf_free(p);
} }
#ifdef SO_REUSE #if SO_REUSE
end: end:
#endif /* SO_REUSE */ #endif /* SO_REUSE */
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane()); LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());