bugfix: socket id alloc

This commit is contained in:
云风
2013-07-16 18:19:40 +08:00
parent a06846710a
commit f998e988dc

View File

@@ -87,7 +87,8 @@ new_socket(struct socket_pool *p, int sock, uint32_t addr) {
s->id = id; s->id = id;
s->source = addr; s->source = addr;
p->count++; p->count++;
if (++p->id > MAX_ID) { p->id = id + 1;
if (p->id > MAX_ID) {
p->id = 1; p->id = 1;
} }
assert(s->head == NULL && s->tail == NULL); assert(s->head == NULL && s->tail == NULL);