mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 23:49:44 +08:00
Merge pull request #2134 from cesanta/freertos-tcp
Fix FreeRTOS-Plus-TCP
This commit is contained in:
commit
2b8586d1b7
@ -4598,8 +4598,9 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
|
||||
EventBits_t bits = FreeRTOS_FD_ISSET(c->fd, mgr->ss);
|
||||
c->is_readable = bits & (eSELECT_READ | eSELECT_EXCEPT) ? 1U : 0;
|
||||
c->is_writable = bits & eSELECT_WRITE ? 1U : 0;
|
||||
FreeRTOS_FD_CLR(c->fd, mgr->ss,
|
||||
eSELECT_READ | eSELECT_EXCEPT | eSELECT_WRITE);
|
||||
if (c->fd != MG_INVALID_SOCKET)
|
||||
FreeRTOS_FD_CLR(c->fd, mgr->ss,
|
||||
eSELECT_READ | eSELECT_EXCEPT | eSELECT_WRITE);
|
||||
}
|
||||
#elif MG_ENABLE_EPOLL
|
||||
size_t max = 1;
|
||||
|
25
mongoose.h
25
mongoose.h
@ -537,17 +537,20 @@ int sscanf(const char *, const char *, ...);
|
||||
#define SO_ERROR 0
|
||||
#define SOL_SOCKET 0
|
||||
#define SO_REUSEADDR 0
|
||||
#undef EINTR
|
||||
#undef EWOULDBLOCK
|
||||
#undef EINPROGRESS
|
||||
#undef EPIPE
|
||||
#undef ECONNRESET
|
||||
#define EINTR pdFREERTOS_ERRNO_EINTR
|
||||
#define EWOULDBLOCK pdFREERTOS_ERRNO_EWOULDBLOCK
|
||||
#define EINPROGRESS pdFREERTOS_ERRNO_EINPROGRESS
|
||||
#define EPIPE 0
|
||||
#define ECONNRESET 0
|
||||
#define EINTR pdFREERTOS_ERRNO_EINTR
|
||||
|
||||
#define MG_SOCK_ERR(errcode) ((errcode) < 0 ? (errcode) : 0)
|
||||
|
||||
#define MG_SOCK_PENDING(errcode) \
|
||||
((errcode) == -pdFREERTOS_ERRNO_EWOULDBLOCK || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EISCONN || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EINPROGRESS || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EAGAIN)
|
||||
|
||||
#define MG_SOCK_RESET(errcode) ((errcode) == -pdFREERTOS_ERRNO_ENOTCONN)
|
||||
|
||||
// actually only if optional timeout is enabled
|
||||
#define MG_SOCK_INTR(fd) (fd == NULL)
|
||||
|
||||
#define sockaddr_in freertos_sockaddr
|
||||
#define sockaddr freertos_sockaddr
|
||||
#define accept(a, b, c) FreeRTOS_accept((a), (b), (c))
|
||||
|
25
src/net_ft.h
25
src/net_ft.h
@ -23,17 +23,20 @@
|
||||
#define SO_ERROR 0
|
||||
#define SOL_SOCKET 0
|
||||
#define SO_REUSEADDR 0
|
||||
#undef EINTR
|
||||
#undef EWOULDBLOCK
|
||||
#undef EINPROGRESS
|
||||
#undef EPIPE
|
||||
#undef ECONNRESET
|
||||
#define EINTR pdFREERTOS_ERRNO_EINTR
|
||||
#define EWOULDBLOCK pdFREERTOS_ERRNO_EWOULDBLOCK
|
||||
#define EINPROGRESS pdFREERTOS_ERRNO_EINPROGRESS
|
||||
#define EPIPE 0
|
||||
#define ECONNRESET 0
|
||||
#define EINTR pdFREERTOS_ERRNO_EINTR
|
||||
|
||||
#define MG_SOCK_ERR(errcode) ((errcode) < 0 ? (errcode) : 0)
|
||||
|
||||
#define MG_SOCK_PENDING(errcode) \
|
||||
((errcode) == -pdFREERTOS_ERRNO_EWOULDBLOCK || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EISCONN || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EINPROGRESS || \
|
||||
(errcode) == -pdFREERTOS_ERRNO_EAGAIN)
|
||||
|
||||
#define MG_SOCK_RESET(errcode) ((errcode) == -pdFREERTOS_ERRNO_ENOTCONN)
|
||||
|
||||
// actually only if optional timeout is enabled
|
||||
#define MG_SOCK_INTR(fd) (fd == NULL)
|
||||
|
||||
#define sockaddr_in freertos_sockaddr
|
||||
#define sockaddr freertos_sockaddr
|
||||
#define accept(a, b, c) FreeRTOS_accept((a), (b), (c))
|
||||
|
@ -499,8 +499,9 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
|
||||
EventBits_t bits = FreeRTOS_FD_ISSET(c->fd, mgr->ss);
|
||||
c->is_readable = bits & (eSELECT_READ | eSELECT_EXCEPT) ? 1U : 0;
|
||||
c->is_writable = bits & eSELECT_WRITE ? 1U : 0;
|
||||
FreeRTOS_FD_CLR(c->fd, mgr->ss,
|
||||
eSELECT_READ | eSELECT_EXCEPT | eSELECT_WRITE);
|
||||
if (c->fd != MG_INVALID_SOCKET)
|
||||
FreeRTOS_FD_CLR(c->fd, mgr->ss,
|
||||
eSELECT_READ | eSELECT_EXCEPT | eSELECT_WRITE);
|
||||
}
|
||||
#elif MG_ENABLE_EPOLL
|
||||
size_t max = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user