net/: Fix alignment and spacing problems found by tools/nxstyle.
This commit is contained in:
parent
7b554d6665
commit
1346f29151
42 changed files with 198 additions and 194 deletions
|
@ -82,15 +82,15 @@ static void arp_send_terminate(FAR struct arp_send_s *state, int result)
|
|||
{
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
state->snd_sent = true;
|
||||
state->snd_result = (int16_t)result;
|
||||
state->snd_cb->flags = 0;
|
||||
state->snd_cb->priv = NULL;
|
||||
state->snd_cb->event = NULL;
|
||||
state->snd_sent = true;
|
||||
state->snd_result = (int16_t)result;
|
||||
state->snd_cb->flags = 0;
|
||||
state->snd_cb->priv = NULL;
|
||||
state->snd_cb->event = NULL;
|
||||
|
||||
/* Wake up the waiting thread */
|
||||
/* Wake up the waiting thread */
|
||||
|
||||
nxsem_post(&state->snd_sem);
|
||||
nxsem_post(&state->snd_sem);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -167,10 +167,10 @@ FAR struct bluetooth_container_s *bluetooth_container_allocate(void)
|
|||
|
||||
if (container != NULL)
|
||||
{
|
||||
/* Zero and tag the allocated meta-data structure. */
|
||||
/* Zero and tag the allocated meta-data structure. */
|
||||
|
||||
memset(container, 0, sizeof(struct bluetooth_container_s));
|
||||
container->bn_pool = pool;
|
||||
memset(container, 0, sizeof(struct bluetooth_container_s));
|
||||
container->bn_pool = pool;
|
||||
}
|
||||
|
||||
return container;
|
||||
|
|
|
@ -146,28 +146,28 @@ static int bluetooth_queue_frame(FAR struct bluetooth_conn_s *conn,
|
|||
|
||||
if (conn->bc_backlog >= CONFIG_NET_BLUETOOTH_BACKLOG)
|
||||
{
|
||||
DEBUGASSERT(conn->bc_backlog == CONFIG_NET_BLUETOOTH_BACKLOG);
|
||||
DEBUGASSERT(conn->bc_backlog == CONFIG_NET_BLUETOOTH_BACKLOG);
|
||||
|
||||
/* Remove the container from the tail RX input queue. */
|
||||
/* Remove the container from the tail RX input queue. */
|
||||
|
||||
container = conn->bc_rxhead;
|
||||
DEBUGASSERT(container != NULL);
|
||||
conn->bc_rxhead = container->bn_flink;
|
||||
container->bn_flink = NULL;
|
||||
container = conn->bc_rxhead;
|
||||
DEBUGASSERT(container != NULL);
|
||||
conn->bc_rxhead = container->bn_flink;
|
||||
container->bn_flink = NULL;
|
||||
|
||||
/* Did the RX queue become empty? */
|
||||
/* Did the RX queue become empty? */
|
||||
|
||||
if (conn->bc_rxhead == NULL)
|
||||
{
|
||||
conn->bc_rxtail = NULL;
|
||||
}
|
||||
if (conn->bc_rxhead == NULL)
|
||||
{
|
||||
conn->bc_rxtail = NULL;
|
||||
}
|
||||
|
||||
DEBUGASSERT(container != NULL && container->bn_iob != NULL);
|
||||
DEBUGASSERT(container != NULL && container->bn_iob != NULL);
|
||||
|
||||
/* Free both the IOB and the container */
|
||||
/* Free both the IOB and the container */
|
||||
|
||||
iob_free(container->bn_iob);
|
||||
bluetooth_container_free(container);
|
||||
iob_free(container->bn_iob);
|
||||
bluetooth_container_free(container);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -163,11 +163,11 @@ static ssize_t bluetooth_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
|||
}
|
||||
|
||||
#if CONFIG_NET_BLUETOOTH_BACKLOG > 0
|
||||
/* Decrement the count of frames in the queue. */
|
||||
/* Decrement the count of frames in the queue. */
|
||||
|
||||
DEBUGASSERT(conn->bc_backlog > 0);
|
||||
conn->bc_backlog--;
|
||||
DEBUGASSERT((int)conn->bc_backlog == bluetooth_count_frames(conn));
|
||||
DEBUGASSERT(conn->bc_backlog > 0);
|
||||
conn->bc_backlog--;
|
||||
DEBUGASSERT((int)conn->bc_backlog == bluetooth_count_frames(conn));
|
||||
#endif
|
||||
|
||||
/* Extract the IOB containing the frame from the container */
|
||||
|
|
|
@ -167,10 +167,10 @@ FAR struct ieee802154_container_s *ieee802154_container_allocate(void)
|
|||
|
||||
if (container != NULL)
|
||||
{
|
||||
/* Zero and tag the allocated meta-data structure. */
|
||||
/* Zero and tag the allocated meta-data structure. */
|
||||
|
||||
memset(container, 0, sizeof(struct ieee802154_container_s));
|
||||
container->ic_pool = pool;
|
||||
memset(container, 0, sizeof(struct ieee802154_container_s));
|
||||
container->ic_pool = pool;
|
||||
}
|
||||
|
||||
return container;
|
||||
|
|
|
@ -154,8 +154,8 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn,
|
|||
* delete the oldest frame from the head of the RX queue.
|
||||
*/
|
||||
|
||||
if (conn->backlog >= CONFIG_NET_IEEE802154_BACKLOG)
|
||||
{
|
||||
if (conn->backlog >= CONFIG_NET_IEEE802154_BACKLOG)
|
||||
{
|
||||
DEBUGASSERT(conn->backlog == CONFIG_NET_IEEE802154_BACKLOG);
|
||||
|
||||
/* Remove the container from the tail RX input queue. */
|
||||
|
@ -178,15 +178,15 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn,
|
|||
|
||||
iob_free(container->ic_iob);
|
||||
ieee802154_container_free(container);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Increment the count of frames in the queue. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Increment the count of frames in the queue. */
|
||||
|
||||
conn->backlog++;
|
||||
}
|
||||
conn->backlog++;
|
||||
}
|
||||
|
||||
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
|
||||
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -161,11 +161,11 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
|
|||
}
|
||||
|
||||
#if CONFIG_NET_IEEE802154_BACKLOG > 0
|
||||
/* Decrement the count of frames in the queue. */
|
||||
/* Decrement the count of frames in the queue. */
|
||||
|
||||
DEBUGASSERT(conn->backlog > 0);
|
||||
conn->backlog--;
|
||||
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
|
||||
DEBUGASSERT(conn->backlog > 0);
|
||||
conn->backlog--;
|
||||
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
|
||||
#endif
|
||||
|
||||
/* Extract the IOB containing the frame from the container */
|
||||
|
|
|
@ -291,7 +291,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
|
|||
|
||||
ret = clock_gettime(CLOCK_REALTIME, &abstime);
|
||||
if (ret >= 0)
|
||||
{
|
||||
{
|
||||
/* NOTE: s_linger's unit is deciseconds so we don't need to update
|
||||
* abstime.tv_nsec here.
|
||||
*/
|
||||
|
|
|
@ -255,7 +255,7 @@ static inline void inet_tcp_newdata(FAR struct net_driver_s *dev,
|
|||
#else
|
||||
nerr("ERROR: packet data lost (%d bytes)\n", dev->d_len - recvlen);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Indicate no data in the buffer */
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@ int ipv6_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
* been implemented.
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/* Verify that the socket has been connected */
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||
* been implemented.
|
||||
*/
|
||||
|
||||
return -ENOSYS;
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
/* Set the port number */
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ static int ipv6_packet_conversion(FAR struct net_driver_s *dev,
|
|||
}
|
||||
}
|
||||
|
||||
/* The packet was not forwarded (or the HOP limit was exceeded) */
|
||||
/* The packet was not forwarded (or the HOP limit was exceeded) */
|
||||
|
||||
ipv6_dropstats(ipv6);
|
||||
return ret;
|
||||
|
|
|
@ -118,9 +118,9 @@ ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
|
||||
if (tolen < sizeof(sa_family_t) + 2)
|
||||
{
|
||||
/* EFAULT - An invalid user space address was specified for a parameter */
|
||||
/* EFAULT - An invalid user space address was specified for a parameter */
|
||||
|
||||
return -EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/* Make sure that half duplex FIFO has been created.
|
||||
|
|
|
@ -106,7 +106,7 @@ FAR struct net_driver_s *netdev_findbyindex(int ifindex)
|
|||
* registered.
|
||||
*/
|
||||
|
||||
if (dev->d_ifindex == ifindex)
|
||||
if (dev->d_ifindex == ifindex)
|
||||
#else
|
||||
/* NOTE that this option is not a safe way to enumerate network
|
||||
* devices: There could be changes to the list of registered device
|
||||
|
@ -165,7 +165,7 @@ int netdev_nextindex(int ifindex)
|
|||
|
||||
net_unlock();
|
||||
return ifindex + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
|
|
|
@ -144,9 +144,9 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg)
|
|||
net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr);
|
||||
}
|
||||
|
||||
/* Increment the size of the buffer in any event */
|
||||
/* Increment the size of the buffer in any event */
|
||||
|
||||
ifc->ifc_len += sizeof(struct ifreq);
|
||||
ifc->ifc_len += sizeof(struct ifreq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -221,9 +221,9 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg)
|
|||
net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr);
|
||||
}
|
||||
|
||||
/* Increment the size of the buffer in any event */
|
||||
/* Increment the size of the buffer in any event */
|
||||
|
||||
lifc->lifc_len += sizeof(struct lifreq);
|
||||
lifc->lifc_len += sizeof(struct lifreq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -153,9 +153,9 @@ int netdev_unregister(FAR struct net_driver_s *dev)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* The entry was at the beginning of the list */
|
||||
/* The entry was at the beginning of the list */
|
||||
|
||||
g_netdevices = curr->flink;
|
||||
g_netdevices = curr->flink;
|
||||
}
|
||||
|
||||
curr->flink = NULL;
|
||||
|
|
|
@ -425,10 +425,10 @@ static int netprocfs_retransmissions(FAR struct netprocfs_file_s *netfile)
|
|||
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ICMP
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
|
||||
#endif
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
|
||||
#endif
|
||||
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len, "\n");
|
||||
|
|
|
@ -90,8 +90,8 @@ int net_addroute_ipv4(in_addr_t target, in_addr_t netmask, in_addr_t router)
|
|||
ret = net_openroute_ipv4(O_WRONLY | O_APPEND | O_CREAT, &fshandle);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Then append the new entry to the end of the routing table */
|
||||
|
@ -124,8 +124,8 @@ int net_addroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask,
|
|||
ret = net_openroute_ipv6(O_WRONLY | O_APPEND | O_CREAT, &fshandle);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Then append the new entry to the end of the routing table */
|
||||
|
|
|
@ -161,7 +161,7 @@ static sem_t g_ipv6_cachelock;
|
|||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -206,8 +206,8 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
|
|||
ret = net_lockroute_ipv4();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: net_lockroute_ipv4 failed: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: net_lockroute_ipv4 faled: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the size of the routing table (in entries) */
|
||||
|
@ -252,8 +252,8 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
|
|||
ret = net_openroute_ipv4(O_RDWR, &fshandle);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
goto errout_with_lock;
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
goto errout_with_lock;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ROUTE_IPv4_CACHEROUTE
|
||||
|
@ -354,8 +354,8 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
|
|||
ret = net_lockroute_ipv6();
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: net_lockroute_ipv6 failed: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: net_lockroute_ipv6 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the size of the routing table (in entries) */
|
||||
|
|
|
@ -517,7 +517,7 @@ ssize_t net_writeroute_ipv6(FAR struct file *filep,
|
|||
|
||||
ntotal = nwritten;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ntotal += nwritten;
|
||||
src += nwritten;
|
||||
|
|
|
@ -90,18 +90,18 @@ int net_foreachroute_ipv4(route_handler_ipv4_t handler, FAR void *arg)
|
|||
* the traversal.
|
||||
*/
|
||||
|
||||
if (ret == -ENOENT)
|
||||
{
|
||||
/* The routing table does not exit.. return successful completion */
|
||||
if (ret == -ENOENT)
|
||||
{
|
||||
/* The routing table does not exit.. return successful completion */
|
||||
|
||||
ninfo("The IPv4 routing table file does not exist\n");
|
||||
return OK;
|
||||
}
|
||||
ninfo("The IPv4 routing table file does not exist\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Some other error occurred. */
|
||||
/* Some other error occurred. */
|
||||
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read each entry from the routing table */
|
||||
|
@ -159,18 +159,18 @@ int net_foreachroute_ipv6(route_handler_ipv6_t handler, FAR void *arg)
|
|||
* the traversal.
|
||||
*/
|
||||
|
||||
if (ret == -ENOENT)
|
||||
{
|
||||
/* The routing table does not exit.. return successful completion */
|
||||
if (ret == -ENOENT)
|
||||
{
|
||||
/* The routing table does not exit.. return successful completion */
|
||||
|
||||
ninfo("The IPv6 routing table file does not exist\n");
|
||||
return OK;
|
||||
}
|
||||
ninfo("The IPv6 routing table file does not exist\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Some other error occurred. */
|
||||
/* Some other error occurred. */
|
||||
|
||||
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read each entry from the routing table */
|
||||
|
|
|
@ -151,40 +151,40 @@ static uint16_t sixlowpan_protosize(FAR const struct ipv6_hdr_s *ipv6hdr,
|
|||
|
||||
/* Copy the following protocol header, */
|
||||
|
||||
switch (ipv6hdr->proto)
|
||||
{
|
||||
switch (ipv6hdr->proto)
|
||||
{
|
||||
#ifdef CONFIG_NET_TCP
|
||||
case IP_PROTO_TCP:
|
||||
{
|
||||
FAR struct tcp_hdr_s *tcp =
|
||||
&((FAR struct ipv6tcp_hdr_s *)ipv6hdr)->tcp;
|
||||
case IP_PROTO_TCP:
|
||||
{
|
||||
FAR struct tcp_hdr_s *tcp =
|
||||
&((FAR struct ipv6tcp_hdr_s *)ipv6hdr)->tcp;
|
||||
|
||||
/* The TCP header length is encoded in the top 4 bits of the
|
||||
* tcpoffset field (in units of 32-bit words).
|
||||
*/
|
||||
/* The TCP header length is encoded in the top 4 bits of the
|
||||
* tcpoffset field (in units of 32-bit words).
|
||||
*/
|
||||
|
||||
protosize = ((uint16_t)tcp->tcpoffset >> 4) << 2;
|
||||
}
|
||||
break;
|
||||
protosize = ((uint16_t)tcp->tcpoffset >> 4) << 2;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_UDP
|
||||
case IP_PROTO_UDP:
|
||||
protosize = UDP_HDRLEN;
|
||||
break;
|
||||
case IP_PROTO_UDP:
|
||||
protosize = UDP_HDRLEN;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
case IP_PROTO_ICMP6:
|
||||
protosize = ICMPv6_HDRLEN;
|
||||
break;
|
||||
case IP_PROTO_ICMP6:
|
||||
protosize = ICMPv6_HDRLEN;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto);
|
||||
protosize = 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto);
|
||||
protosize = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return protosize;
|
||||
}
|
||||
|
@ -495,8 +495,8 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
ret = sixlowpan_radio_framelen(radio);
|
||||
if (ret < 0)
|
||||
{
|
||||
nerr("ERROR: sixlowpan_radio_framelen() failed: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: sixlowpan_radio_framelen() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Limit to the maximum size supported by the IOBs */
|
||||
|
@ -513,8 +513,8 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
|||
ret -= SIXLOWPAN_MAC_FCSSIZE;
|
||||
if (ret < MAX_MACHDR || ret > UINT16_MAX)
|
||||
{
|
||||
nerr("ERROR: Invalid frame size: %d\n", ret);
|
||||
return ret;
|
||||
nerr("ERROR: Invalid frame size: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
framelen = (uint16_t)ret;
|
||||
|
|
|
@ -457,11 +457,11 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
|
||||
DEBUGASSERT(psock != NULL);
|
||||
if (_SS_ISCONNECTED(psock->s_flags))
|
||||
{
|
||||
/* Report the disconnection event to all socket clones */
|
||||
{
|
||||
/* Report the disconnection event to all socket clones */
|
||||
|
||||
tcp_lost_connection(psock, sinfo->s_cb, flags);
|
||||
}
|
||||
tcp_lost_connection(psock, sinfo->s_cb, flags);
|
||||
}
|
||||
|
||||
/* Report not connected to the sender */
|
||||
|
||||
|
|
|
@ -186,5 +186,5 @@ int net_fstat(int sockfd, FAR struct stat *buf)
|
|||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -174,10 +174,10 @@ int sockfd_allocate(int minsd)
|
|||
* as the socket descriptor.
|
||||
*/
|
||||
|
||||
memset(&list->sl_sockets[i], 0, sizeof(struct socket));
|
||||
list->sl_sockets[i].s_crefs = 1;
|
||||
_net_semgive(list);
|
||||
return i + __SOCKFD_OFFSET;
|
||||
memset(&list->sl_sockets[i], 0, sizeof(struct socket));
|
||||
list->sl_sockets[i].s_crefs = 1;
|
||||
_net_semgive(list);
|
||||
return i + __SOCKFD_OFFSET;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ static int accept_eventhandler(FAR struct tcp_conn_s *listener,
|
|||
listener->accept_private = NULL;
|
||||
listener->accept = NULL;
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -179,30 +179,30 @@ int tcp_backlogdestroy(FAR struct tcp_conn_s *conn)
|
|||
|
||||
if (conn->backlog)
|
||||
{
|
||||
/* Remove the backlog structure reference from the connection */
|
||||
/* Remove the backlog structure reference from the connection */
|
||||
|
||||
blg = conn->backlog;
|
||||
conn->backlog = NULL;
|
||||
blg = conn->backlog;
|
||||
conn->backlog = NULL;
|
||||
|
||||
/* Handle any pending connections in the backlog */
|
||||
/* Handle any pending connections in the backlog */
|
||||
|
||||
while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL)
|
||||
{
|
||||
blconn = blc->bc_conn;
|
||||
if (blconn)
|
||||
{
|
||||
/* REVISIT -- such connections really need to be gracefully closed */
|
||||
while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL)
|
||||
{
|
||||
blconn = blc->bc_conn;
|
||||
if (blconn)
|
||||
{
|
||||
/* REVISIT -- such connections really need to be gracefully closed */
|
||||
|
||||
blconn->blparent = NULL;
|
||||
blconn->backlog = NULL;
|
||||
blconn->crefs = 0;
|
||||
tcp_free(blconn);
|
||||
}
|
||||
}
|
||||
blconn->blparent = NULL;
|
||||
blconn->backlog = NULL;
|
||||
blconn->crefs = 0;
|
||||
tcp_free(blconn);
|
||||
}
|
||||
}
|
||||
|
||||
/* Then free the entire backlog structure */
|
||||
/* Then free the entire backlog structure */
|
||||
|
||||
kmm_free(blg);
|
||||
kmm_free(blg);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -548,13 +548,13 @@ found:
|
|||
conn->rto = (conn->sa >> 3) + conn->sv;
|
||||
}
|
||||
|
||||
/* Set the acknowledged flag. */
|
||||
/* Set the acknowledged flag. */
|
||||
|
||||
flags |= TCP_ACKDATA;
|
||||
flags |= TCP_ACKDATA;
|
||||
|
||||
/* Reset the retransmission timer. */
|
||||
/* Reset the retransmission timer. */
|
||||
|
||||
conn->timer = conn->rto;
|
||||
conn->timer = conn->rto;
|
||||
}
|
||||
|
||||
/* Do different things depending on in what state the connection is. */
|
||||
|
|
|
@ -286,7 +286,7 @@ int tcp_accept_connection(FAR struct net_driver_s *dev,
|
|||
|
||||
if (listener->accept)
|
||||
{
|
||||
/* Yes.. accept the connection */
|
||||
/* Yes.. accept the connection */
|
||||
|
||||
ret = listener->accept(listener, conn);
|
||||
}
|
||||
|
|
|
@ -641,9 +641,9 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
return flags;
|
||||
}
|
||||
|
||||
/* Check if we are being asked to retransmit data */
|
||||
/* Check if we are being asked to retransmit data */
|
||||
|
||||
else if ((flags & TCP_REXMIT) != 0)
|
||||
else if ((flags & TCP_REXMIT) != 0)
|
||||
{
|
||||
FAR struct tcp_wrbuffer_s *wrb;
|
||||
FAR sq_entry_t *entry;
|
||||
|
@ -872,7 +872,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
|
|||
* be set for this write buffer.
|
||||
*/
|
||||
|
||||
if (TCP_WBSEQNO(wrb) == (unsigned)-1)
|
||||
if (TCP_WBSEQNO(wrb) == (unsigned)-1)
|
||||
{
|
||||
TCP_WBSEQNO(wrb) = conn->isn + conn->sent;
|
||||
}
|
||||
|
|
|
@ -472,11 +472,11 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
|
|||
|
||||
DEBUGASSERT(psock != NULL);
|
||||
if (_SS_ISCONNECTED(psock->s_flags))
|
||||
{
|
||||
/* Report not connected */
|
||||
{
|
||||
/* Report not connected */
|
||||
|
||||
tcp_lost_connection(psock, pstate->snd_cb, flags);
|
||||
}
|
||||
tcp_lost_connection(psock, pstate->snd_cb, flags);
|
||||
}
|
||||
|
||||
pstate->snd_sent = -ENOTCONN;
|
||||
goto end_wait;
|
||||
|
|
|
@ -234,11 +234,11 @@ static uint16_t ack_eventhandler(FAR struct net_driver_s *dev,
|
|||
|
||||
DEBUGASSERT(psock != NULL);
|
||||
if (_SS_ISCONNECTED(psock->s_flags))
|
||||
{
|
||||
/* Report not connected */
|
||||
{
|
||||
/* Report not connected */
|
||||
|
||||
tcp_lost_connection(psock, pstate->snd_ackcb, flags);
|
||||
}
|
||||
tcp_lost_connection(psock, pstate->snd_ackcb, flags);
|
||||
}
|
||||
|
||||
/* Report not connected */
|
||||
|
||||
|
@ -377,11 +377,11 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
|
|||
|
||||
DEBUGASSERT(psock != NULL);
|
||||
if (_SS_ISCONNECTED(psock->s_flags))
|
||||
{
|
||||
/* Report not connected */
|
||||
{
|
||||
/* Report not connected */
|
||||
|
||||
tcp_lost_connection(psock, pstate->snd_datacb, flags);
|
||||
}
|
||||
tcp_lost_connection(psock, pstate->snd_datacb, flags);
|
||||
}
|
||||
|
||||
/* Report not connected */
|
||||
|
||||
|
|
|
@ -103,11 +103,11 @@ uint32_t tcp_getsequence(FAR uint8_t *seqno)
|
|||
|
||||
/* Combine the sequence number from network (big-endian) order */
|
||||
|
||||
value = (uint32_t)seqno[0] << 24 |
|
||||
(uint32_t)seqno[1] << 16 |
|
||||
(uint32_t)seqno[2] << 8 |
|
||||
(uint32_t)seqno[3];
|
||||
return value;
|
||||
value = (uint32_t)seqno[0] << 24 |
|
||||
(uint32_t)seqno[1] << 16 |
|
||||
(uint32_t)seqno[2] << 8 |
|
||||
(uint32_t)seqno[3];
|
||||
return value;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -291,7 +291,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Exponential backoff. */
|
||||
/* Exponential backoff. */
|
||||
|
||||
conn->timer = TCP_RTO << (conn->nrtx > 4 ? 4: conn->nrtx);
|
||||
(conn->nrtx)++;
|
||||
|
|
|
@ -143,10 +143,10 @@ static int udp_input(FAR struct net_driver_s *dev, unsigned int iplen)
|
|||
chksum = ~udp_ipv4_chksum(dev);
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
}
|
||||
}
|
||||
|
||||
if (chksum != 0)
|
||||
{
|
||||
if (chksum != 0)
|
||||
{
|
||||
#ifdef CONFIG_NET_STATISTICS
|
||||
g_netstats.udp.drop++;
|
||||
g_netstats.udp.chkerr++;
|
||||
|
|
|
@ -378,7 +378,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
|
|||
fds->revents |= (POLLRDNORM & fds->events);
|
||||
}
|
||||
|
||||
if (psock_udp_cansend(psock) >= 0)
|
||||
if (psock_udp_cansend(psock) >= 0)
|
||||
{
|
||||
/* Normal data may be sent without blocking (at least one byte). */
|
||||
|
||||
|
|
|
@ -190,8 +190,8 @@ static void sendto_writebuffer_release(FAR struct socket *psock,
|
|||
* the write buffer queue.
|
||||
*/
|
||||
|
||||
ret = sendto_next_transfer(psock, conn);
|
||||
}
|
||||
ret = sendto_next_transfer(psock, conn);
|
||||
}
|
||||
}
|
||||
while (wrb != NULL && ret < 0);
|
||||
}
|
||||
|
@ -864,12 +864,12 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
* write buffer queue.
|
||||
*/
|
||||
|
||||
ret = sendto_next_transfer(psock, conn);
|
||||
if (ret < 0)
|
||||
{
|
||||
(void)sq_remlast(&conn->write_q);
|
||||
goto errout_with_wrb;
|
||||
}
|
||||
ret = sendto_next_transfer(psock, conn);
|
||||
if (ret < 0)
|
||||
{
|
||||
(void)sq_remlast(&conn->write_q);
|
||||
goto errout_with_wrb;
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
}
|
||||
|
|
|
@ -246,9 +246,9 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
|
|||
else
|
||||
#endif /* CONFIG_NET_SOCKOPTS */
|
||||
{
|
||||
/* No timeout. Just wait for the next polling cycle */
|
||||
/* No timeout. Just wait for the next polling cycle */
|
||||
|
||||
return flags;
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||
nerr("ERROR: udp_find_raddr_device failed\n");
|
||||
ret = -ENETUNREACH;
|
||||
goto errout_with_lock;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure that the device is in the UP state */
|
||||
|
||||
|
|
|
@ -238,7 +238,9 @@ FAR struct usrsock_conn_s *usrsock_active(int16_t usockid)
|
|||
while ((conn = usrsock_nextconn(conn)) != NULL)
|
||||
{
|
||||
if (conn->usockid == usockid)
|
||||
return conn;
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -81,8 +81,10 @@ static uint16_t poll_event(FAR struct net_driver_s *dev, FAR void *pvconn,
|
|||
|
||||
DEBUGASSERT(!info || (info->psock && info->fds));
|
||||
|
||||
if (!info)
|
||||
return flags;
|
||||
if (info == NULL)
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
|
||||
if (flags & USRSOCK_EVENT_ABORT)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ static uint8_t net_msbits8(uint8_t byval)
|
|||
|
||||
static inline uint8_t net_msbits16(uint16_t hword)
|
||||
{
|
||||
uint8_t ones;
|
||||
uint8_t ones;
|
||||
|
||||
/* Look at the MS byte of the 16-bit value */
|
||||
|
||||
|
|
Loading…
Reference in a new issue