summaryrefslogtreecommitdiff
path: root/nuttx/net/socket/net_close.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/net/socket/net_close.c')
-rw-r--r--nuttx/net/socket/net_close.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/nuttx/net/socket/net_close.c b/nuttx/net/socket/net_close.c
index 618c1f7f5..4a8c2d464 100644
--- a/nuttx/net/socket/net_close.c
+++ b/nuttx/net/socket/net_close.c
@@ -258,6 +258,61 @@ end_wait:
#endif /* CONFIG_NET_TCP */
/****************************************************************************
+ * Function: netclose_txnotify
+ *
+ * Description:
+ * Notify the appropriate device driver that we are have data ready to
+ * be send (TCP)
+ *
+ * Parameters:
+ * psock - Socket state structure
+ * conn - The TCP connection structure
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static inline void netclose_txnotify(FAR struct socket *psock,
+ FAR struct tcp_conn_s *conn)
+{
+#ifdef CONFIG_NET_IPv4
+#ifdef CONFIG_NET_IPv6
+ /* If both IPv4 and IPv6 support are enabled, then we will need to select
+ * the device driver using the appropriate IP domain.
+ */
+
+ if (psock->domain == PF_INET)
+#endif
+ {
+ /* Notify the device driver that send data is available */
+
+#ifdef CONFIG_NET_MULTILINK
+ netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
+#else
+ netdev_ipv4_txnotify(conn->u.ipv4.raddr);
+#endif
+ }
+#endif /* CONFIG_NET_IPv4 */
+
+#ifdef CONFIG_NET_IPv6
+#ifdef CONFIG_NET_IPv4
+ else /* if (psock->domain == PF_INET6) */
+#endif /* CONFIG_NET_IPv4 */
+ {
+ /* Notify the device driver that send data is available */
+
+ DEBUGASSERT(psock->domain == PF_INET6);
+#ifdef CONFIG_NET_MULTILINK
+ netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
+#else
+ netdev_ipv6_txnotify(conn->u.ipv6.raddr);
+#endif
+ }
+#endif /* CONFIG_NET_IPv6 */
+}
+
+/****************************************************************************
* Function: netclose_disconnect
*
* Description:
@@ -357,11 +412,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
/* Notify the device driver of the availability of TX data */
-#ifdef CONFIG_NET_MULTILINK
- netdev_ipv4_txnotify(conn->u.ipv4.laddr, conn->u.ipv4.raddr);
-#else
- netdev_ipv4_txnotify(conn->u.ipv4.raddr);
-#endif
+ netclose_txnotify(psock, conn);
#ifdef CONFIG_NET_SOLINGER
/* Wait only if we are lingering */