@@ -156,7 +156,8 @@
}
void
-dco_create_socket(HANDLE handle, struct addrinfo *remoteaddr, bool bind_local,
+dco_create_socket(HANDLE handle, OVERLAPPED *ov,
+ struct addrinfo *remoteaddr, bool bind_local,
struct addrinfo *bind, int timeout,
struct signal_info *sig_info)
{
@@ -229,8 +230,8 @@
ASSERT(0);
}
- OVERLAPPED ov = { 0 };
- if (!DeviceIoControl(handle, OVPN_IOCTL_NEW_PEER, &peer, sizeof(peer), NULL, 0, NULL, &ov))
+ CLEAR(*ov);
+ if (!DeviceIoControl(handle, OVPN_IOCTL_NEW_PEER, &peer, sizeof(peer), NULL, 0, NULL, ov))
{
DWORD err = GetLastError();
if (err != ERROR_IO_PENDING)
@@ -239,7 +240,7 @@
}
else
{
- dco_connect_wait(handle, &ov, timeout, sig_info);
+ dco_connect_wait(handle, ov, timeout, sig_info);
}
}
}
@@ -41,7 +41,8 @@
create_dco_handle(const char *devname, struct gc_arena *gc);
void
-dco_create_socket(HANDLE handle, struct addrinfo *remoteaddr, bool bind_local,
+dco_create_socket(HANDLE handle, OVERLAPPED *ov,
+ struct addrinfo *remoteaddr, bool bind_local,
struct addrinfo *bind, int timeout,
struct signal_info *sig_info);
@@ -2148,7 +2148,7 @@
c->c1.tuntap = tt;
}
- dco_create_socket(c->c1.tuntap->hand,
+ dco_create_socket(c->c1.tuntap->hand, &c->c1.tuntap->dco_new_peer_ov,
sock->info.lsa->current_remote,
sock->bind_local, sock->info.lsa->bind_local,
get_server_poll_remaining_time(sock->server_poll_timeout),
@@ -196,6 +196,7 @@
#ifdef _WIN32
HANDLE hand;
+ OVERLAPPED dco_new_peer_ov; /* used for async NEW_PEER dco call, which might wait for TCP connect */
struct overlapped_io reads;
struct overlapped_io writes;
struct rw_handle rw_handle;