When dup'ing sockets, need to clone fields for TCP write buffering too
This commit is contained in:
parent
f08cdc161d
commit
806af1f4e2
@ -6436,4 +6436,6 @@
|
|||||||
in the PX4 GIT repository.
|
in the PX4 GIT repository.
|
||||||
* fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
|
* fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
|
||||||
Tridge via Lorenz Meier (2014-1-14).
|
Tridge via Lorenz Meier (2014-1-14).
|
||||||
|
* net/net_clone.c: Need to clone fields for TCP write buffering
|
||||||
|
as well (2014-1-14).
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ struct socket
|
|||||||
|
|
||||||
FAR void *s_conn; /* Connection: struct uip_conn or uip_udp_conn */
|
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 */
|
/* Callback instance for TCP send */
|
||||||
|
|
||||||
FAR struct uip_callback_s *s_sndcb;
|
FAR struct uip_callback_s *s_sndcb;
|
||||||
|
@ -162,7 +162,7 @@ struct uip_conn
|
|||||||
uint16_t mss; /* Current maximum segment size for the
|
uint16_t mss; /* Current maximum segment size for the
|
||||||
* connection */
|
* connection */
|
||||||
uint16_t winsize; /* Current window size of 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 */
|
uint32_t unacked; /* Number bytes sent but not yet ACKed */
|
||||||
#else
|
#else
|
||||||
uint16_t unacked; /* Number bytes sent but not yet ACKed */
|
uint16_t unacked; /* Number bytes sent but not yet ACKed */
|
||||||
|
@ -194,7 +194,7 @@ config NET_TCP_RECVDELAY
|
|||||||
int "TCP Rx delay"
|
int "TCP Rx delay"
|
||||||
default 0
|
default 0
|
||||||
---help---
|
---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
|
of TCP/IP packets: Any TCP/IP packet received will be ACKed, but its contents
|
||||||
will be dropped in the bit-bucket.
|
will be dropped in the bit-bucket.
|
||||||
|
|
||||||
|
@ -78,9 +78,16 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2)
|
|||||||
#ifndef CONFIG_DISABLE_CLOCK
|
#ifndef CONFIG_DISABLE_CLOCK
|
||||||
psock2->s_rcvtimeo = psock1->s_rcvtimeo; /* Receive timeout value (in deciseconds) */
|
psock2->s_rcvtimeo = psock1->s_rcvtimeo; /* Receive timeout value (in deciseconds) */
|
||||||
psock2->s_sndtimeo = psock1->s_sndtimeo; /* Send 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
|
||||||
#endif
|
#endif
|
||||||
psock2->s_conn = psock1->s_conn; /* UDP or TCP connection structure */
|
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 */
|
/* Increment the reference count on the connection */
|
||||||
|
|
||||||
|
@ -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.
|
* 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;
|
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
|
* field expired can only be updated at UIP_ESTABLISHED state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
conn->expired ++;
|
conn->expired++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ static uint16_t send_interrupt(FAR struct uip_driver_s *dev, FAR void *pvconn,
|
|||||||
* second interval before expiration.
|
* second interval before expiration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
segment->wb_nrtx ++;
|
segment->wb_nrtx++;
|
||||||
|
|
||||||
/* The segment is waiting for ACK again */
|
/* 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)
|
while (completed < len)
|
||||||
{
|
{
|
||||||
struct uip_wrbuffer_s *segment = uip_tcpwrbuffer_alloc(NULL);
|
FAR struct uip_wrbuffer_s *segment = uip_tcpwrbuffer_alloc(NULL);
|
||||||
if (segment)
|
if (segment)
|
||||||
{
|
{
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
@ -158,9 +158,6 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
|||||||
DEBUGASSERT(conn->crefs == 0);
|
DEBUGASSERT(conn->crefs == 0);
|
||||||
psock->s_conn = conn;
|
psock->s_conn = conn;
|
||||||
conn->crefs = 1;
|
conn->crefs = 1;
|
||||||
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
||||||
psock->s_sndcb = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -193,7 +190,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Did we succesfully allocate some kind of connection structure? */
|
/* Did we successfully allocate some kind of connection structure? */
|
||||||
|
|
||||||
if (!psock->s_conn)
|
if (!psock->s_conn)
|
||||||
{
|
{
|
||||||
@ -205,7 +202,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
errno = err;
|
set_errno(err);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,4 +162,4 @@ void uip_tcpwrbuffer_release(FAR struct uip_wrbuffer_s *wrbuffer)
|
|||||||
sem_post(&g_wrbuffer.sem);
|
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 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user