mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
fix #863
This commit is contained in:
@@ -204,7 +204,7 @@ skynet_memalign(size_t alignment, size_t size) {
|
||||
|
||||
void *
|
||||
skynet_aligned_alloc(size_t alignment, size_t size) {
|
||||
void* ptr = je_aligned_alloc(alignment, size + (PREFIX_SIZE + alignment -1) & ~(alignment-1));
|
||||
void* ptr = je_aligned_alloc(alignment, size + (size_t)((PREFIX_SIZE + alignment -1) & ~(alignment-1)));
|
||||
if(!ptr) malloc_oom(size);
|
||||
return fill_prefix(ptr);
|
||||
}
|
||||
|
||||
@@ -359,6 +359,7 @@ socket_server_create() {
|
||||
s->type = SOCKET_TYPE_INVALID;
|
||||
clear_wb_list(&s->high);
|
||||
clear_wb_list(&s->low);
|
||||
spinlock_init(&s->dw_lock);
|
||||
}
|
||||
ss->alloc_id = 0;
|
||||
ss->event_n = 0;
|
||||
@@ -429,6 +430,7 @@ socket_server_release(struct socket_server *ss) {
|
||||
if (s->type != SOCKET_TYPE_RESERVE) {
|
||||
force_close(ss, s, &l, &dummy);
|
||||
}
|
||||
spinlock_destroy(&s->dw_lock);
|
||||
}
|
||||
close(ss->sendctrl_fd);
|
||||
close(ss->recvctrl_fd);
|
||||
@@ -464,7 +466,6 @@ new_fd(struct socket_server *ss, int id, int fd, int protocol, uintptr_t opaque,
|
||||
s->warn_size = 0;
|
||||
check_wb_list(&s->high);
|
||||
check_wb_list(&s->low);
|
||||
spinlock_init(&s->dw_lock);
|
||||
s->dw_buffer = NULL;
|
||||
s->dw_size = 0;
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user