When dup'ing sockets, need to clone fields for TCP write buffering too

This commit is contained in:
Gregory Nutt 2014-01-14 15:17:53 -06:00
parent f08cdc161d
commit 806af1f4e2
8 changed files with 19 additions and 13 deletions

View File

@ -6436,4 +6436,6 @@
in the PX4 GIT repository.
* fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
Tridge via Lorenz Meier (2014-1-14).
* net/net_clone.c: Need to clone fields for TCP write buffering
as well (2014-1-14).

View File

@ -106,7 +106,7 @@ struct socket
FAR void *s_conn; /* Connection: struct uip_conn or uip_udp_conn */
#ifdef CONFIG_NET_NTCP_WRITE_BUFFERS
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
/* Callback instance for TCP send */
FAR struct uip_callback_s *s_sndcb;

View File

@ -162,7 +162,7 @@ struct uip_conn
uint16_t mss; /* Current maximum segment size for the
* connection */
uint16_t winsize; /* Current window size of the connection */
#ifdef CONFIG_NET_NTCP_WRITE_BUFFERS
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
uint32_t unacked; /* Number bytes sent but not yet ACKed */
#else
uint16_t unacked; /* Number bytes sent but not yet ACKed */

View File

@ -194,7 +194,7 @@ config NET_TCP_RECVDELAY
int "TCP Rx delay"
default 0
---help---
If NET_NTCP_READAHEAD_BUFFERS is zero, then there will be no buffering
If NET_TCP_READAHEAD_BUFFERS is undefined, then there will be no buffering
of TCP/IP packets: Any TCP/IP packet received will be ACKed, but its contents
will be dropped in the bit-bucket.

View File

@ -78,9 +78,16 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2)
#ifndef CONFIG_DISABLE_CLOCK
psock2->s_rcvtimeo = psock1->s_rcvtimeo; /* Receive timeout value (in deciseconds) */
psock2->s_sndtimeo = psock1->s_sndtimeo; /* Send timeout value (in deciseconds) */
#ifdef CONFIG_NET_SOLINGER
psock2->s_linger = psock1->s_linger; /* Linger timeout value (in deciseconds) */
#endif
#endif
#endif
psock2->s_conn = psock1->s_conn; /* UDP or TCP connection structure */
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
psock2->s_sndcb = NULL; /* Force allocation of new callback
* instance for TCP send */
#endif
/* Increment the reference count on the connection */

View File

@ -211,7 +211,7 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
* so it can be sent as soon as possible.
*/
while ((entry=sq_remlast(&conn->unacked_q)))
while ((entry = sq_remlast(&conn->unacked_q)))
{
struct uip_wrbuffer_s *segment = (struct uip_wrbuffer_s*)entry;
@ -231,7 +231,7 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
* field expired can only be updated at UIP_ESTABLISHED state
*/
conn->expired ++;
conn->expired++;
continue;
}
@ -338,7 +338,7 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
* second interval before expiration.
*/
segment->wb_nrtx ++;
segment->wb_nrtx++;
/* The segment is waiting for ACK again */
@ -481,7 +481,7 @@ ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len,
while (completed < len)
{
struct uip_wrbuffer_s *segment = uip_tcpwrbuffer_alloc(NULL);
FAR struct uip_wrbuffer_s *segment = uip_tcpwrbuffer_alloc(NULL);
if (segment)
{
size_t cnt;

View File

@ -158,9 +158,6 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
DEBUGASSERT(conn->crefs == 0);
psock->s_conn = conn;
conn->crefs = 1;
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
psock->s_sndcb = NULL;
#endif
}
}
break;
@ -193,7 +190,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
break;
}
/* Did we succesfully allocate some kind of connection structure? */
/* Did we successfully allocate some kind of connection structure? */
if (!psock->s_conn)
{
@ -205,7 +202,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
return OK;
errout:
errno = err;
set_errno(err);
return ERROR;
}

View File

@ -162,4 +162,4 @@ void uip_tcpwrbuffer_release(FAR struct uip_wrbuffer_s *wrbuffer)
sem_post(&g_wrbuffer.sem);
}
#endif /* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_NTCP_WRITE_BUFFERS */
#endif /* CONFIG_NET && CONFIG_NET_TCP && CONFIG_NET_TCP_WRITE_BUFFERS */