Raw sockets: Various fixes for closing, free connections, TX from Daniel Lazo Sitzer
This commit is contained in:
parent
3ec359d14c
commit
04e564c9c3
@ -433,6 +433,32 @@ int psock_close(FAR struct socket *psock)
|
|||||||
|
|
||||||
switch (psock->s_type)
|
switch (psock->s_type)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NET_PKT
|
||||||
|
case SOCK_RAW:
|
||||||
|
{
|
||||||
|
struct uip_pkt_conn *conn = psock->s_conn;
|
||||||
|
|
||||||
|
/* Is this the last reference to the connection structure (there
|
||||||
|
* could be more if the socket was dup'ed).
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (conn->crefs <= 1)
|
||||||
|
{
|
||||||
|
/* Yes... free the connection structure */
|
||||||
|
|
||||||
|
conn->crefs = 0; /* No more references on the connection */
|
||||||
|
uip_pktfree(psock->s_conn); /* Free uIP resources */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* No.. Just decrement the reference count */
|
||||||
|
|
||||||
|
conn->crefs--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_TCP
|
#ifdef CONFIG_NET_TCP
|
||||||
case SOCK_STREAM:
|
case SOCK_STREAM:
|
||||||
{
|
{
|
||||||
|
@ -195,6 +195,10 @@ static uint16_t pktsend_interrupt(FAR struct uip_driver_s *dev,
|
|||||||
if (pstate->snd_buflen > 0 && pstate->snd_buflen < CONFIG_NET_BUFSIZE)
|
if (pstate->snd_buflen > 0 && pstate->snd_buflen < CONFIG_NET_BUFSIZE)
|
||||||
{
|
{
|
||||||
memcpy(dev->d_buf, pstate->snd_buffer, pstate->snd_buflen);
|
memcpy(dev->d_buf, pstate->snd_buffer, pstate->snd_buflen);
|
||||||
|
|
||||||
|
/* Set the number of bytes to send */
|
||||||
|
|
||||||
|
dev->d_len = pstate->snd_buflen;
|
||||||
dev->d_sndlen = pstate->snd_buflen;
|
dev->d_sndlen = pstate->snd_buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user