From 98b5c7c7c655db658f1f92b9cd5175b56b1d9298 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 8 Oct 2018 14:20:53 +0800 Subject: [PATCH] address 0 is reserved --- skynet-src/skynet_handle.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/skynet-src/skynet_handle.c b/skynet-src/skynet_handle.c index d904288e..f20324ee 100644 --- a/skynet-src/skynet_handle.c +++ b/skynet-src/skynet_handle.c @@ -39,8 +39,12 @@ skynet_handle_register(struct skynet_context *ctx) { for (;;) { int i; - for (i=0;islot_size;i++) { - uint32_t handle = (i+s->handle_index) & HANDLE_MASK; + uint32_t handle = s->handle_index; + for (i=0;islot_size;i++,handle++) { + if (handle > HANDLE_MASK) { + // 0 is reserved + handle = 1; + } int hash = handle & (s->slot_size-1); if (s->slot[hash] == NULL) { s->slot[hash] = ctx;