mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 04:33:05 +00:00
fix bug
This commit is contained in:
@@ -76,18 +76,17 @@ skynet_handle_retire(uint32_t handle) {
|
|||||||
s->slot[hash] = NULL;
|
s->slot[hash] = NULL;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int j=0;
|
int j=0, n=s->name_count;
|
||||||
for (i=0;i<s->name_count;i++,j++) {
|
for (i=0; i<n; ++i) {
|
||||||
if (s->name[i].handle == handle) {
|
if (s->name[i].handle == handle) {
|
||||||
free(s->name[i].name);
|
free(s->name[i].name);
|
||||||
++j;
|
continue;
|
||||||
--s->name_count;
|
} else if (i!=j) {
|
||||||
} else {
|
s->name[j] = s->name[i];
|
||||||
if (i!=j) {
|
|
||||||
s->name[i] = s->name[j];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
++j;
|
||||||
}
|
}
|
||||||
|
s->name_count = j;
|
||||||
}
|
}
|
||||||
|
|
||||||
rwlock_wunlock(&s->lock);
|
rwlock_wunlock(&s->lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user