You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/04/30 12:17:33 UTC
[incubator-nuttx-apps] branch master updated: wireless: gs2200m:
Fix to release a bound socket
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 06e7420 wireless: gs2200m: Fix to release a bound socket
06e7420 is described below
commit 06e74202b5bd8bf770ebfc367f7a35e466f652cf
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Thu Apr 30 15:54:59 2020 +0900
wireless: gs2200m: Fix to release a bound socket
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
wireless/gs2200m/gs2200m_main.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/wireless/gs2200m/gs2200m_main.c b/wireless/gs2200m/gs2200m_main.c
index 851231c..438dc99 100644
--- a/wireless/gs2200m/gs2200m_main.c
+++ b/wireless/gs2200m/gs2200m_main.c
@@ -90,6 +90,7 @@ enum sock_state_e
{
CLOSED,
OPENED,
+ BOUND,
CONNECTED,
};
@@ -527,19 +528,12 @@ static int close_request(int fd, FAR struct gs2200m_s *priv,
cid = usock->cid;
- if (SOCK_STREAM == usock->type && CONNECTED != usock->state)
+ if ((BOUND != usock->state) && (CONNECTED != usock->state))
{
ret = -EBADFD;
goto errout;
}
- if (SOCK_DGRAM == usock->type && 'z' == cid)
- {
- /* the udp socket is not bound */
-
- goto errout;
- }
-
memset(&clmsg, 0, sizeof(clmsg));
clmsg.cid = cid;
ioctl(priv->gsfd, GS2200M_IOC_CLOSE, (unsigned long)&clmsg);
@@ -783,7 +777,10 @@ static int sendto_request(int fd, FAR struct gs2200m_s *priv,
if (usock->cid != smsg.cid)
{
+ /* cid is newly assigned (bound) */
+
usock->cid = smsg.cid;
+ usock->state = BOUND;
}
if (0 != nret)
@@ -1023,6 +1020,7 @@ static int bind_request(int fd, FAR struct gs2200m_s *priv,
if (0 == ret)
{
usock->cid = bmsg.cid;
+ usock->state = BOUND;
}
prepare: