a little improvement of hashid code: move the calculation of hashcap into the hashid_init function and remove the assertions

This commit is contained in:
Chen Puqing
2014-02-19 00:07:34 +08:00
parent 224a1eebfb
commit 59e6029432
2 changed files with 8 additions and 9 deletions

View File

@@ -368,11 +368,7 @@ gate_init(struct gate *g , struct skynet_context * ctx, char * parm) {
g->ctx = ctx;
int cap = 16;
while (cap < max) {
cap *= 2;
}
hashid_init(&g->hash, max, cap);
hashid_init(&g->hash, max);
g->conn = malloc(max * sizeof(struct connection));
memset(g->conn, 0, max *sizeof(struct connection));
g->max_connection = max;