wireless: gs2200m: Fix to release a bound socket
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
ed3c1cbe2d
commit
06e74202b5
@ -90,6 +90,7 @@ enum sock_state_e
|
|||||||
{
|
{
|
||||||
CLOSED,
|
CLOSED,
|
||||||
OPENED,
|
OPENED,
|
||||||
|
BOUND,
|
||||||
CONNECTED,
|
CONNECTED,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -527,19 +528,12 @@ static int close_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
|
|
||||||
cid = usock->cid;
|
cid = usock->cid;
|
||||||
|
|
||||||
if (SOCK_STREAM == usock->type && CONNECTED != usock->state)
|
if ((BOUND != usock->state) && (CONNECTED != usock->state))
|
||||||
{
|
{
|
||||||
ret = -EBADFD;
|
ret = -EBADFD;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SOCK_DGRAM == usock->type && 'z' == cid)
|
|
||||||
{
|
|
||||||
/* the udp socket is not bound */
|
|
||||||
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&clmsg, 0, sizeof(clmsg));
|
memset(&clmsg, 0, sizeof(clmsg));
|
||||||
clmsg.cid = cid;
|
clmsg.cid = cid;
|
||||||
ioctl(priv->gsfd, GS2200M_IOC_CLOSE, (unsigned long)&clmsg);
|
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)
|
if (usock->cid != smsg.cid)
|
||||||
{
|
{
|
||||||
|
/* cid is newly assigned (bound) */
|
||||||
|
|
||||||
usock->cid = smsg.cid;
|
usock->cid = smsg.cid;
|
||||||
|
usock->state = BOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != nret)
|
if (0 != nret)
|
||||||
@ -1023,6 +1020,7 @@ static int bind_request(int fd, FAR struct gs2200m_s *priv,
|
|||||||
if (0 == ret)
|
if (0 == ret)
|
||||||
{
|
{
|
||||||
usock->cid = bmsg.cid;
|
usock->cid = bmsg.cid;
|
||||||
|
usock->state = BOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare:
|
prepare:
|
||||||
|
Loading…
Reference in New Issue
Block a user