Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Changed SelectSet to use dyad_Socket in place of int
Browse files Browse the repository at this point in the history
  • Loading branch information
rxi committed Aug 9, 2015
1 parent a85bfbe commit e459370
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/dyad.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ enum {
};

typedef struct {
int capacity, maxfd;
int capacity;
dyad_Socket maxfd;
fd_set *fds[SELECT_MAX];
} SelectSet;

Expand Down Expand Up @@ -219,15 +220,15 @@ static void select_zero(SelectSet *s) {
}


static void select_add(SelectSet *s, int set, int fd) {
static void select_add(SelectSet *s, int set, dyad_Socket fd) {
#ifdef _WIN32
fd_set *f;
if (s->capacity == 0) select_grow(s);
while ((unsigned) (s->capacity * FD_SETSIZE) < s->fds[set]->fd_count + 1) {
select_grow(s);
}
f = s->fds[set];
f->fd_array[f->fd_count++] = (SOCKET) fd;
f->fd_array[f->fd_count++] = fd;
#else
unsigned *p;
while (s->capacity * FD_SETSIZE < fd) {
Expand All @@ -240,14 +241,14 @@ static void select_add(SelectSet *s, int set, int fd) {
}


static int select_has(SelectSet *s, int set, int fd) {
static int select_has(SelectSet *s, int set, dyad_Socket fd) {
#ifdef _WIN32
unsigned i;
fd_set *f;
if (s->capacity == 0) return 0;
f = s->fds[set];
for (i = 0; i < f->fd_count; i++) {
if (f->fd_array[i] == (SOCKET) fd) {
if (f->fd_array[i] == fd) {
return 1;
}
}
Expand Down

0 comments on commit e459370

Please sign in to comment.