You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2021/11/02 07:59:13 UTC

[incubator-nuttx] branch master updated (dbaf8a9 -> 391ccdc)

This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from dbaf8a9  pipe: pipe close should notify block writting, and write will return -EPIPE
     new 1970ce5  local_socket: set lc_peer when accept() instead of connect()
     new 391ccdc  local_socket: recv should return 0 NOT -ECONNRESET if remote closed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 net/local/local_accept.c    | 1 +
 net/local/local_conn.c      | 1 +
 net/local/local_connect.c   | 3 ---
 net/local/local_recvutils.c | 9 ++++-----
 4 files changed, 6 insertions(+), 8 deletions(-)

[incubator-nuttx] 02/02: local_socket: recv should return 0 NOT -ECONNRESET if remote closed

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 391ccdc42b16ec634c0dd82d3ff81efb0300dd8e
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Oct 15 18:02:21 2021 +0800

    local_socket: recv should return 0 NOT -ECONNRESET if remote closed
    
    ref:
    https://man7.org/linux/man-pages/man2/recv.2.html
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 net/local/local_recvutils.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c
index de5170c..cdead61 100644
--- a/net/local/local_recvutils.c
+++ b/net/local/local_recvutils.c
@@ -53,13 +53,13 @@
  *   buf   - Local to store the received data
  *   len   - Length of data to receive [in]
  *           Length of data actually received [out]
+ *           Zero means *len[in] is zero,
+ *           or the sending side has closed the FIFO
  *   once  - Flag to indicate the buf may only be read once
  *
  * Returned Value:
  *   Zero is returned on success; a negated errno value is returned on any
- *   failure.  If -ECONNRESET is received, then the sending side has closed
- *   the FIFO. In this case, the returned data may still be valid (if the
- *   returned len > 0).
+ *   failure.
  *
  ****************************************************************************/
 
@@ -93,8 +93,7 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf,
            * has closed the FIFO.
            */
 
-          ret = -ECONNRESET;
-          goto errout;
+            break;
         }
       else
         {

[incubator-nuttx] 01/02: local_socket: set lc_peer when accept() instead of connect()

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1970ce5116b1c3e57866df09e5b47610bf68e1b0
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Oct 15 18:36:30 2021 +0800

    local_socket: set lc_peer when accept() instead of connect()
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 net/local/local_accept.c  | 1 +
 net/local/local_conn.c    | 1 +
 net/local/local_connect.c | 3 ---
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/local/local_accept.c b/net/local/local_accept.c
index 8d4bec5..c951b88 100644
--- a/net/local/local_accept.c
+++ b/net/local/local_accept.c
@@ -170,6 +170,7 @@ int local_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
               conn->lc_psock  = psock;
 #ifdef CONFIG_NET_LOCAL_SCM
               conn->lc_peer   = client;
+              client->lc_peer = conn;
 #endif /* CONFIG_NET_LOCAL_SCM */
 
               strncpy(conn->lc_path, client->lc_path, UNIX_PATH_MAX - 1);
diff --git a/net/local/local_conn.c b/net/local/local_conn.c
index c968cca..a32c874 100644
--- a/net/local/local_conn.c
+++ b/net/local/local_conn.c
@@ -176,6 +176,7 @@ void local_free(FAR struct local_conn_s *conn)
   if (local_peerconn(conn) && conn->lc_peer)
     {
       conn->lc_peer->lc_peer = NULL;
+      conn->lc_peer = NULL;
     }
 #endif /* CONFIG_NET_LOCAL_SCM */
 
diff --git a/net/local/local_connect.c b/net/local/local_connect.c
index 1c3f407..b3aff31 100644
--- a/net/local/local_connect.c
+++ b/net/local/local_connect.c
@@ -301,9 +301,6 @@ int psock_local_connect(FAR struct socket *psock,
                         UNIX_PATH_MAX - 1);
                 client->lc_path[UNIX_PATH_MAX - 1] = '\0';
                 client->lc_instance_id = local_generate_instance_id();
-#ifdef CONFIG_NET_LOCAL_SCM
-                client->lc_peer = conn;
-#endif /* CONFIG_NET_LOCAL_SCM */
 
                 /* The client is now bound to an address */