Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed Dec 18, 2024
1 parent fea96ed commit 5c1e9d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/coap_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ coap_update_io_timer(coap_context_t *context, coap_tick_t delay) {
char byte = 0;

#ifdef _WIN32
#include <io.h>
#define write(a,b,c) _write(a,b,c)
#endif
if (write(context->pipefd[1], &byte, 1) == -1) {
Expand Down
8 changes: 6 additions & 2 deletions src/coap_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,8 @@ coap_new_context(const coap_address_t *listen_addr) {
}
#else /* COAP_EPOLL_SUPPORT */
#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI)
int flags;

#ifdef _WIN32
#include <io.h>
#define pipe(a) _pipe(a, 128, _O_BINARY)
#endif
if (pipe(c->pipefd) == -1) {
Expand All @@ -710,6 +709,8 @@ coap_new_context(const coap_address_t *listen_addr) {
errno);
} else {
#ifndef _WIN32
int flags;

flags = fcntl(c->pipefd[0], F_GETFL);
flags |= O_NONBLOCK;
fcntl(c->pipefd[0], F_SETFL, flags);
Expand Down Expand Up @@ -856,6 +857,9 @@ coap_free_context_lkd(coap_context_t *context) {
#else /* COAP_EPOLL_SUPPORT */
#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI)
if (context->pipefd[0] != -1) {
#ifdef _WIN32
#define close(a) _close(a)
#endif
close(context->pipefd[0]);
close(context->pipefd[0]);
context->pipefd[0] = -1;
Expand Down

0 comments on commit 5c1e9d5

Please sign in to comment.