Skip to content

Commit

Permalink
stub out listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
pquerna committed Mar 28, 2012
1 parent cad4d68 commit 30ae5fd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/spedye.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ struct spedye_listener_t {
spedye_listener_t *next;
/* Bellow here are owned by spedye core */
SSL_CTX *sslctx;
uv_tcp_t* handle;
};

typedef struct spedye_conn_t {
Expand Down
32 changes: 32 additions & 0 deletions src/spedye_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,38 @@ master_destroy_workers(spedye_master_t *m)
}
}

static int
setup_listener(spedye_master_t *m, spedye_listener_t *lrec)
{
struct sockaddr_in address;
lrec->handle = calloc(1, sizeof(uv_tcp_t));

uv_tcp_init(m->loop, lrec->handle);

address = uv_ip4_addr(lrec->address, lrec->port);

if (uv_tcp_bind(lrec->handle, address)) {
/* TODO: error handling */
}

return 0;
}

static int
setup_listeners(spedye_master_t *m)
{
int rv = 0;
spedye_listener_t *lrec;

for (lrec = m->conf->listeners;
rv == 0 && lrec != NULL;
lrec = lrec->next)
{
rv = setup_listener(m, lrec);
}
return rv;
}

static void
master_entry(void* arg)
{
Expand Down

0 comments on commit 30ae5fd

Please sign in to comment.