[net][lwip] fix assert in the sys_arch_mbox_fetch function when close socket
This commit is contained in:
parent
c2322353aa
commit
a0e62f665f
|
@ -27,7 +27,7 @@
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2012-12-8 Bernard add file header
|
* 2012-12-8 Bernard add file header
|
||||||
* export bsd socket symbol for RT-Thread Application Module
|
* export bsd socket symbol for RT-Thread Application Module
|
||||||
* 2017-11-15 Bernard add lock for init_done callback.
|
* 2017-11-15 Bernard add lock for init_done callback.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ void sys_sem_signal(sys_sem_t *sem)
|
||||||
*
|
*
|
||||||
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
||||||
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
||||||
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
||||||
* wait for the semaphore, it will return zero
|
* wait for the semaphore, it will return zero
|
||||||
*/
|
*/
|
||||||
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||||
|
@ -498,14 +498,10 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
||||||
if(ret == -RT_ETIMEOUT)
|
if(ret != RT_EOK)
|
||||||
{
|
{
|
||||||
return SYS_ARCH_TIMEOUT;
|
return SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get elapse msecond */
|
/* get elapse msecond */
|
||||||
tick = rt_tick_get() - tick;
|
tick = rt_tick_get() - tick;
|
||||||
|
@ -536,7 +532,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ret == RT_EOK)
|
if (ret == RT_EOK)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2012-12-8 Bernard add file header
|
* 2012-12-8 Bernard add file header
|
||||||
* export bsd socket symbol for RT-Thread Application Module
|
* export bsd socket symbol for RT-Thread Application Module
|
||||||
* 2017-11-15 Bernard add lock for init_done callback.
|
* 2017-11-15 Bernard add lock for init_done callback.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ void sys_sem_signal(sys_sem_t *sem)
|
||||||
*
|
*
|
||||||
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
||||||
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
||||||
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
||||||
* wait for the semaphore, it will return zero
|
* wait for the semaphore, it will return zero
|
||||||
*/
|
*/
|
||||||
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||||
|
@ -509,12 +509,9 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
||||||
|
if(ret != RT_EOK)
|
||||||
if(ret == -RT_ETIMEOUT)
|
|
||||||
return SYS_ARCH_TIMEOUT;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK);
|
return SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get elapse msecond */
|
/* get elapse msecond */
|
||||||
|
@ -545,7 +542,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
||||||
return SYS_ARCH_TIMEOUT;
|
return SYS_ARCH_TIMEOUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ret == RT_EOK)
|
if (ret == RT_EOK)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2012-12-8 Bernard add file header
|
* 2012-12-8 Bernard add file header
|
||||||
* export bsd socket symbol for RT-Thread Application Module
|
* export bsd socket symbol for RT-Thread Application Module
|
||||||
* 2017-11-15 Bernard add lock for init_done callback.
|
* 2017-11-15 Bernard add lock for init_done callback.
|
||||||
* 2018-11-02 MurphyZhao port to lwip2.1.0
|
* 2018-11-02 MurphyZhao port to lwip2.1.0
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ static err_t netif_device_init(struct netif *netif)
|
||||||
/* copy device flags to netif flags */
|
/* copy device flags to netif flags */
|
||||||
netif->flags = ethif->flags;
|
netif->flags = ethif->flags;
|
||||||
netif->mtu = ETHERNET_MTU;
|
netif->mtu = ETHERNET_MTU;
|
||||||
|
|
||||||
/* set output */
|
/* set output */
|
||||||
netif->output = etharp_output;
|
netif->output = etharp_output;
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void sys_sem_signal(sys_sem_t *sem)
|
||||||
*
|
*
|
||||||
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
* @return If the timeout argument is non-zero, it will return the number of milliseconds
|
||||||
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
* spent waiting for the semaphore to be signaled; If the semaphore isn't signaled
|
||||||
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
* within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't
|
||||||
* wait for the semaphore, it will return zero
|
* wait for the semaphore, it will return zero
|
||||||
*/
|
*/
|
||||||
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||||
|
@ -523,12 +523,9 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t);
|
||||||
|
if(ret != RT_EOK)
|
||||||
if(ret == -RT_ETIMEOUT)
|
|
||||||
return SYS_ARCH_TIMEOUT;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK);
|
return SYS_ARCH_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get elapse msecond */
|
/* get elapse msecond */
|
||||||
|
@ -559,7 +556,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
||||||
return SYS_ARCH_TIMEOUT;
|
return SYS_ARCH_TIMEOUT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ret == RT_EOK)
|
if (ret == RT_EOK)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue