Skip to content

Commit

Permalink
For Windows builds, socket is always TCP socket
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaivel committed May 27, 2024
1 parent 195de90 commit 121f2e1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/network/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ long net_recv_udp_timeout(struct net_context *ctx, void *__restrict __buf, size_

bool net_recv_tcp(struct net_context *ctx, int fd, void *__restrict __buf, size_t __n)
{
#ifdef _WIN32
int socket = ctx->tcp_socket;
#else
int socket = fd != NET_SOCKET_SERVER ? ctx->fds[fd].fd : ctx->tcp_socket;
#endif

// for (int i = 0; i < 5; i++)
// if (__n == table[i].size)
Expand All @@ -397,7 +401,11 @@ bool net_recv_tcp(struct net_context *ctx, int fd, void *__restrict __buf, size_

bool net_send_tcp(struct net_context *ctx, int fd, const void *__buf, size_t __n)
{
#ifdef _WIN32
int socket = ctx->tcp_socket;
#else
int socket = fd != NET_SOCKET_SERVER ? ctx->fds[fd].fd : ctx->tcp_socket;
#endif

// for (int i = 0; i < 5; i++)
// if (__n == table[i].size)
Expand Down Expand Up @@ -425,7 +433,11 @@ bool net_send_tcp(struct net_context *ctx, int fd, const void *__buf, size_t __n

bool net_recv_tcp_timeout(struct net_context *ctx, int fd, void *__restrict __buf, size_t __n, size_t timeout_ms)
{
#ifdef _WIN32
int socket = ctx->tcp_socket;
#else
int socket = fd != NET_SOCKET_SERVER ? ctx->fds[fd].fd : ctx->tcp_socket;
#endif
size_t initial = time_ms();

// for (int i = 0; i < 5; i++)
Expand Down

0 comments on commit 121f2e1

Please sign in to comment.