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 2020/10/26 11:42:16 UTC
[incubator-nuttx-apps] 02/04: wireless: gs2200m: Fix to handle
address info in accept()
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-apps.git
commit 0e9594e1074efb5cc26ef6d58e20a87ef39e1ecc
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon Oct 12 14:02:18 2020 +0900
wireless: gs2200m: Fix to handle address info in accept()
Summary:
- This commit fixes to handle address info in accept()
Impact:
- All use cases which use accept() with gs2200m
- Need to update nuttx as well
Testing:
- Tested with spresene:wifi
- Tested with telnet daemon
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
wireless/gs2200m/gs2200m_main.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/wireless/gs2200m/gs2200m_main.c b/wireless/gs2200m/gs2200m_main.c
index 628ea61..b95be57 100644
--- a/wireless/gs2200m/gs2200m_main.c
+++ b/wireless/gs2200m/gs2200m_main.c
@@ -1132,7 +1132,6 @@ static int accept_request(int fd, FAR struct gs2200m_s *priv,
struct gs2200m_accept_msg amsg;
FAR struct usock_s *usock;
FAR struct usock_s *new_usock = NULL;
- struct sockaddr_in ep_addr;
int ret = 0;
int16_t usockid; /* usockid for new client */
@@ -1173,6 +1172,7 @@ static int accept_request(int fd, FAR struct gs2200m_s *priv,
new_usock->cid = amsg.cid;
new_usock->state = CONNECTED;
+ new_usock->raddr = amsg.addr;
prepare:
@@ -1185,8 +1185,8 @@ prepare:
if (0 == ret)
{
- resp.reqack.result = 2; /* ep_addr + usock */
- resp.valuelen_nontrunc = sizeof(ep_addr);
+ resp.reqack.result = 2; /* new_usock->raddr + usock */
+ resp.valuelen_nontrunc = sizeof(new_usock->raddr);
resp.valuelen = resp.valuelen_nontrunc;
}
else
@@ -1208,11 +1208,7 @@ prepare:
{
/* Send address (value) */
- /* TODO: ep_addr should be set */
-
- memset(&ep_addr, 0, sizeof(ep_addr));
-
- ret = _write_to_usock(fd, &ep_addr, resp.valuelen);
+ ret = _write_to_usock(fd, &new_usock->raddr, resp.valuelen);
if (0 > ret)
{