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

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Apr 18, 2012
1 parent 43cb459 commit c7d43bd
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 57 deletions.
5 changes: 5 additions & 0 deletions include/uv-private/uv-win.h
Expand Up @@ -146,6 +146,7 @@ typedef struct _AFD_POLL_INFO {
AFD_POLL_HANDLE_INFO Handles[1];
} AFD_POLL_INFO, *PAFD_POLL_INFO;

#define UV_MSAFD_PROVIDER_COUNT 3

/**
* It should be possible to cast uv_buf_t[] to WSABUF[]
Expand Down Expand Up @@ -217,6 +218,9 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_prepare_t* next_prepare_handle; \
uv_check_t* next_check_handle; \
uv_idle_t* next_idle_handle; \
/* This handle holds the peer sockets for the fast variant of uv_poll_t */ \
SOCKET poll_peer_sockets[UV_MSAFD_PROVIDER_COUNT]; \
/* State used by uv_ares. */ \
ares_channel ares_chan; \
int ares_active_sockets; \
uv_timer_t ares_polling_timer; \
Expand Down Expand Up @@ -386,6 +390,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
/* Used in fast mode */ \
struct { \
AFD_POLL_INFO afd_poll_info; \
SOCKET peer_socket; \
}; \
/* Used in slow (fallback) mode */ \
struct { \
Expand Down
10 changes: 10 additions & 0 deletions src/win/core.c
Expand Up @@ -84,6 +84,8 @@ static void uv_loop_init(uv_loop_t* loop) {
loop->next_check_handle = NULL;
loop->next_idle_handle = NULL;

memset(&loop->poll_peer_sockets, 0, sizeof loop->poll_peer_sockets);

loop->ares_active_sockets = 0;
loop->ares_chan = NULL;

Expand Down Expand Up @@ -130,6 +132,14 @@ uv_loop_t* uv_loop_new(void) {

void uv_loop_delete(uv_loop_t* loop) {
if (loop != &uv_default_loop_) {
int i;
for (i = 0; i < ARRAY_SIZE(loop->poll_peer_sockets); i++) {
SOCKET sock = loop->poll_peer_sockets[i];
if (sock != 0 && sock != INVALID_SOCKET) {
closesocket(sock);
}
}

free(loop);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/win/internal.h
Expand Up @@ -85,6 +85,7 @@ void uv_process_timers(uv_loop_t* loop);
/* Only used by uv_poll_t handles. */
#define UV_HANDLE_POLL_CANCELED 0x01000000
#define UV_HANDLE_POLL_SLOW 0x02000000
#define UV_HANDLE_POLL_ASSUME_WRITABLE 0x04000000


void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle);
Expand Down Expand Up @@ -357,7 +358,8 @@ int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers,
int* addr_len, WSAOVERLAPPED *overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);

int WSAAPI uv_msafd_poll(AFD_POLL_INFO* info, OVERLAPPED* overlapped);
int WSAAPI uv_msafd_poll(SOCKET socket, AFD_POLL_INFO* info,
OVERLAPPED* overlapped);

/* Whether ipv6 is supported */
extern int uv_allow_ipv6;
Expand Down

0 comments on commit c7d43bd

Please sign in to comment.