summaryrefslogtreecommitdiff
path: root/nuttx/net
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-17 15:34:50 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-17 15:34:50 -0600
commit1117846b864d3016a67d6130cf81a15b10bf085a (patch)
treea82d42d9f3489950ec3a5272b19f8539df9b73a0 /nuttx/net
parent3f5c77926b0d250d00b6e5d95223ad800ec0eb2d (diff)
downloadnuttx-1117846b864d3016a67d6130cf81a15b10bf085a.tar.gz
nuttx-1117846b864d3016a67d6130cf81a15b10bf085a.tar.bz2
nuttx-1117846b864d3016a67d6130cf81a15b10bf085a.zip
Update TODO; Cosmetic changes to comments
Diffstat (limited to 'nuttx/net')
-rw-r--r--nuttx/net/netdev/netdev_findbyaddr.c3
-rw-r--r--nuttx/net/udp/udp_conn.c27
2 files changed, 18 insertions, 12 deletions
diff --git a/nuttx/net/netdev/netdev_findbyaddr.c b/nuttx/net/netdev/netdev_findbyaddr.c
index 9130166c7..79ade21dc 100644
--- a/nuttx/net/netdev/netdev_findbyaddr.c
+++ b/nuttx/net/netdev/netdev_findbyaddr.c
@@ -166,7 +166,7 @@ FAR struct net_driver_s *netdev_findbyaddr(const net_ipaddr_t addr)
/* No.. The address lies on an external network */
#ifdef CONFIG_NET_ROUTE
- /* If we have a routing table, then perhaps we can find the the local
+ /* If we have a routing table, then perhaps we can find the local
* address of a router that can forward packets to the external network.
*/
@@ -202,6 +202,7 @@ FAR struct net_driver_s *netdev_findbyaddr(const net_ipaddr_t addr)
{
dev = g_netdevices;
}
+
netdev_semgive();
/* If we will did not find the network device, then we might as well fail
diff --git a/nuttx/net/udp/udp_conn.c b/nuttx/net/udp/udp_conn.c
index c7d7d2c14..3fb4d1ae2 100644
--- a/nuttx/net/udp/udp_conn.c
+++ b/nuttx/net/udp/udp_conn.c
@@ -129,7 +129,7 @@ static FAR struct udp_conn_s *udp_find_conn(uint16_t portno)
{
if (g_udp_connections[ i ].lport == portno)
{
- return &g_udp_connections[ i ];
+ return &g_udp_connections[i];
}
}
@@ -365,7 +365,7 @@ FAR struct udp_conn_s *udp_nextconn(FAR struct udp_conn_s *conn)
* Name: udp_bind()
*
* Description:
- * This function implements the UIP specific parts of the standard UDP
+ * This function implements the low level parts of the standard UDP
* bind() operation.
*
* Assumptions:
@@ -397,7 +397,7 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr_in *addr)
flags = net_lock();
- /* Is any other UDP connection bound to this port? */
+ /* Is any other UDP connection already bound to this port? */
if (!udp_find_conn(addr->sin_port))
{
@@ -417,14 +417,19 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr_in *addr)
* Name: udp_connect()
*
* Description:
- * This function sets up a new UDP connection. The function will
- * automatically allocate an unused local port for the new
- * connection. However, another port can be chosen by using the
- * udp_bind() call, after the udp_connect() function has been
- * called.
- *
- * This function is called as part of the implementation of sendto
- * and recvfrom.
+ * This function simply assigns a remote address to UDP "connection"
+ * structure. This function is called as part of the implementation of:
+ *
+ * - connect(). If connect() is called for a SOCK_DGRAM socket, then
+ * this logic performs the moral equivalent of connec() operation
+ * for the UDP socket.
+ * - recvfrom() and sendto(). This function is called to set the
+ * remote address of the peer.
+ *
+ * The function will automatically allocate an unused local port for the
+ * new connection if the socket is not yet bound to a local address.
+ * However, another port can be chosen by using the udp_bind() call,
+ * after the udp_connect() function has been called.
*
* Input Parameters:
* conn - A reference to UDP connection structure