Permalink
Browse files

set priority for upcoming clustering

  • Loading branch information...
Roberto De Ioris
Roberto De Ioris committed Aug 21, 2012
1 parent 28346ab commit 494d9cdab56fec60b75dec4ea79f51f88751655a
Showing with 14 additions and 1 deletion.
  1. +4 −0 blastbeat.h
  2. +9 −0 src/config.c
  3. +1 −1 src/main.c
View
@@ -488,6 +488,10 @@ struct bb_acceptor {
int ctx_configured;
ssize_t (*read)(struct bb_connection *, char *, size_t);
ssize_t (*write)(struct bb_connection *, char *, size_t);
// priority used by clustering
uint64_t priority;
// list of mapped virtualhosts
struct bb_acceptor_vhost *vhosts;
struct bb_acceptor *next;
View
@@ -96,6 +96,14 @@ static struct bb_acceptor *bb_get_acceptor(char *addr, int shared, void (*func)(
union bb_addr bba;
socklen_t addr_len;
memset(&bba, 0, sizeof(bba));
uint64_t priority = 1;
char *space = strchr(addr, ' ');
if (space) {
*space = 0;
priority = strtoll(space+1, NULL, 10);
}
char *colon = strrchr(addr, ':');
if (!colon) {
@@ -144,6 +152,7 @@ static struct bb_acceptor *bb_get_acceptor(char *addr, int shared, void (*func)(
memset(acceptor, 0, sizeof(struct bb_acceptor));
acceptor->shared = shared;
acceptor->name = addr;
acceptor->priority = priority;
acceptor->port_str = colon;
acceptor->read = bb_http_read;
acceptor->write = bb_http_write;
View
@@ -777,7 +777,7 @@ int main(int argc, char *argv[]) {
// report config, bind sockets and assign ssl keys/certificates
struct bb_acceptor *acceptor = blastbeat.acceptors;
while(acceptor) {
fprintf(stdout, "\n[acceptor %s]\n", acceptor->name);
fprintf(stdout, "\n[acceptor %s priority: %llu]\n", acceptor->name, (unsigned long long) acceptor->priority);
bb_acceptor_bind(acceptor);
struct bb_acceptor_vhost *vhost = acceptor->vhosts;
while(vhost) {

0 comments on commit 494d9cd

Please sign in to comment.