Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Merge branch 'v0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Aug 30, 2012
2 parents a75e105 + 24c062c commit 5eb1d19
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/win/tcp.c
Expand Up @@ -540,7 +540,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {

if(!handle->accept_reqs) {
handle->accept_reqs = (uv_tcp_accept_t*)
malloc(simultaneous_accepts * sizeof(uv_tcp_accept_t));
malloc(uv_simultaneous_server_accepts * sizeof(uv_tcp_accept_t));
if (!handle->accept_reqs) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
}
Expand All @@ -564,6 +564,18 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {

uv_tcp_queue_accept(handle, req);
}

/* Initialize other unused requests too, because uv_tcp_endgame */
/* doesn't know how how many requests were intialized, so it will */
/* try to clean up {uv_simultaneous_server_accepts} requests. */
for (i = simultaneous_accepts; i < uv_simultaneous_server_accepts; i++) {
req = &handle->accept_reqs[i];
uv_req_init(loop, (uv_req_t*) req);
req->type = UV_ACCEPT;
req->accept_socket = INVALID_SOCKET;
req->data = handle;
req->wait_handle = INVALID_HANDLE_VALUE;
}
}

return 0;
Expand Down

0 comments on commit 5eb1d19

Please sign in to comment.