mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
address 0 is reserved
This commit is contained in:
@@ -39,8 +39,12 @@ skynet_handle_register(struct skynet_context *ctx) {
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<s->slot_size;i++) {
|
uint32_t handle = s->handle_index;
|
||||||
uint32_t handle = (i+s->handle_index) & HANDLE_MASK;
|
for (i=0;i<s->slot_size;i++,handle++) {
|
||||||
|
if (handle > HANDLE_MASK) {
|
||||||
|
// 0 is reserved
|
||||||
|
handle = 1;
|
||||||
|
}
|
||||||
int hash = handle & (s->slot_size-1);
|
int hash = handle & (s->slot_size-1);
|
||||||
if (s->slot[hash] == NULL) {
|
if (s->slot[hash] == NULL) {
|
||||||
s->slot[hash] = ctx;
|
s->slot[hash] = ctx;
|
||||||
|
|||||||
Reference in New Issue
Block a user