if LWIP_TCPIP_CORE_LOCKING is 0, we send a copy of the message to TCPIP thread
This commit is contained in:
parent
b9ae214510
commit
25222e4abc
1 changed files with 13 additions and 0 deletions
|
@ -58,7 +58,20 @@ static ssize_t socket_write(fildes_t* file, uint8_t* buffer, size_t size)
|
|||
{
|
||||
int ret = 0;
|
||||
#if defined(CONFIG_LWIP) && LWIP_SOCKET
|
||||
if (BUILTIN_EXPECT(!size, 0))
|
||||
return 0;
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
ret = lwip_write(file->offset, buffer, size);
|
||||
#else
|
||||
// create a copy and forward this copy to the TCP/IP stack
|
||||
uint8_t* tmp = kmalloc(size);
|
||||
if (BUILTIN_EXPECT(!tmp, 0))
|
||||
return -ENOMEM;
|
||||
memcpy(tmp, buffer, size);
|
||||
ret = lwip_write(file->offset, tmp, size);
|
||||
kfree(tmp, size);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
ret = -errno;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue