Skip to content

Commit

Permalink
fixup! posix_sockets: make pool type its own type
Browse files Browse the repository at this point in the history
This reverts commit 5ee26bb.

Not required anymore due to sock_async callback arguments
  • Loading branch information
miri64 committed Jun 30, 2020
1 parent 141a14d commit 1e4ae21
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions sys/posix/sockets/posix_sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,8 @@ typedef struct {
sock_tcp_ep_t local; /* to store bind before connect/listen */
} socket_t;

typedef struct {
socket_sock_t sock;
} socket_sock_pool_t;

static socket_t _socket_pool[_ACTUAL_SOCKET_POOL_SIZE];
static socket_sock_pool_t _sock_pool[SOCKET_POOL_SIZE];
static socket_sock_t _sock_pool[SOCKET_POOL_SIZE];
#ifdef MODULE_SOCK_TCP
static sock_tcp_t _tcp_sock_pool[SOCKET_POOL_SIZE][SOCKET_TCP_QUEUE_SIZE];
#endif
Expand Down Expand Up @@ -144,7 +140,7 @@ static socket_sock_t *_get_free_sock(void)
if (i < 0) {
return NULL;
}
return &_sock_pool[i].sock;
return &_sock_pool[i];
}

static socket_t *_get_socket(int fd)
Expand All @@ -166,11 +162,10 @@ static socket_t *_get_socket(int fd)

static int _get_sock_idx(socket_sock_t *sock)
{
if ((sock < &_sock_pool[0].sock) ||
(sock > &_sock_pool[SOCKET_POOL_SIZE - 1].sock)) {
if ((sock < &_sock_pool[0]) || (sock > &_sock_pool[SOCKET_POOL_SIZE - 1])) {
return -1;
}
return sock - &_sock_pool[0].sock;
return sock - &_sock_pool[0];
}

static inline int _choose_ipproto(int type, int protocol)
Expand Down

0 comments on commit 1e4ae21

Please sign in to comment.