2018-07-30 04:38:14 +00:00
|
|
|
#ifndef EV_WIN32_HPP
|
|
|
|
#define EV_WIN32_HPP
|
|
|
|
#include <llarp/buffer.h>
|
|
|
|
#include <llarp/net.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <cstdio>
|
2018-08-03 06:03:34 +00:00
|
|
|
#include <llarp/net.hpp>
|
2018-07-30 04:38:14 +00:00
|
|
|
#include "ev.hpp"
|
|
|
|
#include "logger.hpp"
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
struct udp_listener : public ev_io
|
|
|
|
{
|
|
|
|
llarp_udp_io* udp;
|
|
|
|
|
2018-08-03 06:03:34 +00:00
|
|
|
// we receive queued data in the OVERLAPPED data field,
|
|
|
|
// much like the pipefds in the UNIX kqueue and loonix
|
|
|
|
// epoll handles
|
2018-10-05 05:06:54 +00:00
|
|
|
WSAOVERLAPPED portfd;
|
2018-08-03 06:03:34 +00:00
|
|
|
size_t iosz;
|
|
|
|
|
2018-10-04 13:32:33 +00:00
|
|
|
udp_listener(SOCKET fd, llarp_udp_io* u) : ev_io(fd), udp(u)
|
|
|
|
{
|
2018-10-05 07:57:48 +00:00
|
|
|
memset((void*)&portfd, 0, sizeof(WSAOVERLAPPED));
|
2018-10-04 13:32:33 +00:00
|
|
|
};
|
2018-07-30 04:38:14 +00:00
|
|
|
|
|
|
|
~udp_listener()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-03 06:03:34 +00:00
|
|
|
int
|
|
|
|
getData(void* buf, size_t sz, size_t ret)
|
|
|
|
{
|
|
|
|
iosz = ret;
|
|
|
|
return read(buf, sz);
|
|
|
|
}
|
|
|
|
|
2018-07-30 04:38:14 +00:00
|
|
|
virtual int
|
|
|
|
read(void* buf, size_t sz)
|
|
|
|
{
|
|
|
|
sockaddr_in6 src;
|
2018-08-03 06:03:34 +00:00
|
|
|
socklen_t slen = sizeof(src);
|
|
|
|
sockaddr* addr = (sockaddr*)&src;
|
|
|
|
unsigned long flags = 0;
|
|
|
|
WSABUF wbuf = {sz, static_cast< char* >(buf)};
|
2018-07-30 04:38:14 +00:00
|
|
|
// WSARecvFrom
|
2018-10-05 05:06:54 +00:00
|
|
|
llarp::LogDebug("read ", sz, " bytes into socket");
|
2018-10-05 07:57:48 +00:00
|
|
|
int ret = ::WSARecvFrom(std::get< SOCKET >(fd), &wbuf, 1, nullptr, &flags,
|
|
|
|
addr, &slen, &portfd, nullptr);
|
2018-08-03 06:03:34 +00:00
|
|
|
// 997 is the error code for queued ops
|
|
|
|
int s_errno = ::WSAGetLastError();
|
|
|
|
if(ret && s_errno != 997)
|
|
|
|
{
|
|
|
|
llarp::LogWarn("recv socket error ", s_errno);
|
2018-07-30 04:38:14 +00:00
|
|
|
return -1;
|
2018-08-03 06:03:34 +00:00
|
|
|
}
|
2018-08-04 00:05:45 +00:00
|
|
|
// get the _real_ payload size from tick()
|
2018-08-03 06:03:34 +00:00
|
|
|
udp->recvfrom(udp, addr, buf, iosz);
|
2018-07-30 04:38:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual int
|
|
|
|
sendto(const sockaddr* to, const void* data, size_t sz)
|
|
|
|
{
|
|
|
|
socklen_t slen;
|
|
|
|
WSABUF wbuf = {sz, (char*)data};
|
|
|
|
switch(to->sa_family)
|
|
|
|
{
|
|
|
|
case AF_INET:
|
|
|
|
slen = sizeof(struct sockaddr_in);
|
|
|
|
break;
|
|
|
|
case AF_INET6:
|
|
|
|
slen = sizeof(struct sockaddr_in6);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
// WSASendTo
|
2018-10-05 05:06:54 +00:00
|
|
|
llarp::LogDebug("write ", sz, " bytes into socket");
|
2018-10-04 11:20:08 +00:00
|
|
|
ssize_t sent = ::WSASendTo(std::get< SOCKET >(fd), &wbuf, 1, nullptr, 0,
|
2018-10-05 05:06:54 +00:00
|
|
|
to, slen, &portfd, nullptr);
|
2018-10-04 11:20:08 +00:00
|
|
|
int s_errno = ::WSAGetLastError();
|
2018-08-03 06:03:34 +00:00
|
|
|
if(sent && s_errno != 997)
|
2018-07-30 04:38:14 +00:00
|
|
|
{
|
2018-08-03 06:03:34 +00:00
|
|
|
llarp::LogWarn("send socket error ", s_errno);
|
|
|
|
return -1;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
2018-08-03 06:03:34 +00:00
|
|
|
return 0;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
};
|
2018-09-29 08:16:54 +00:00
|
|
|
|
2018-10-01 02:08:03 +00:00
|
|
|
struct tun : public ev_io
|
2018-09-29 08:16:54 +00:00
|
|
|
{
|
|
|
|
llarp_tun_io* t;
|
|
|
|
device* tunif;
|
2018-10-04 13:32:33 +00:00
|
|
|
OVERLAPPED* tun_async;
|
2018-09-29 08:16:54 +00:00
|
|
|
tun(llarp_tun_io* tio)
|
2018-10-04 11:20:08 +00:00
|
|
|
: ev_io(INVALID_HANDLE_VALUE)
|
2018-09-29 08:16:54 +00:00
|
|
|
, t(tio)
|
|
|
|
, tunif(tuntap_init())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
sendto(const sockaddr* to, const void* data, size_t sz)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
flush_write()
|
|
|
|
{
|
|
|
|
if(t->before_write)
|
|
|
|
{
|
|
|
|
t->before_write(t);
|
|
|
|
}
|
|
|
|
ev_io::flush_write();
|
|
|
|
}
|
|
|
|
|
2018-10-05 07:57:48 +00:00
|
|
|
bool
|
2018-10-04 13:32:33 +00:00
|
|
|
do_write(void* data, size_t sz)
|
|
|
|
{
|
|
|
|
return WriteFile(std::get< HANDLE >(fd), data, sz, nullptr, tun_async);
|
|
|
|
}
|
|
|
|
|
2018-09-29 08:16:54 +00:00
|
|
|
int
|
|
|
|
read(void* buf, size_t sz)
|
|
|
|
{
|
|
|
|
ssize_t ret = tuntap_read(tunif, buf, sz);
|
2018-10-01 20:14:36 +00:00
|
|
|
if(ret > 4 && t->recvpkt)
|
|
|
|
// should have pktinfo
|
|
|
|
t->recvpkt(t, ((byte_t*)buf) + 4, ret - 4);
|
2018-09-29 08:16:54 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
setup()
|
|
|
|
{
|
|
|
|
llarp::LogDebug("set ifname to ", t->ifname);
|
|
|
|
strncpy(tunif->if_name, t->ifname, sizeof(tunif->if_name));
|
|
|
|
|
|
|
|
if(tuntap_start(tunif, TUNTAP_MODE_TUNNEL, 0) == -1)
|
|
|
|
{
|
|
|
|
llarp::LogWarn("failed to start interface");
|
|
|
|
return false;
|
|
|
|
}
|
2018-10-03 00:47:53 +00:00
|
|
|
if(tuntap_set_ip(tunif, t->ifaddr, t->ifaddr, t->netmask) == -1)
|
2018-09-29 08:16:54 +00:00
|
|
|
{
|
2018-10-03 00:47:53 +00:00
|
|
|
llarp::LogWarn("failed to set ip");
|
2018-09-29 08:16:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
2018-10-03 00:47:53 +00:00
|
|
|
if(tuntap_up(tunif) == -1)
|
2018-09-29 08:16:54 +00:00
|
|
|
{
|
2018-10-03 00:47:53 +00:00
|
|
|
llarp::LogWarn("failed to put interface up: ", strerror(errno));
|
2018-09-29 08:16:54 +00:00
|
|
|
return false;
|
|
|
|
}
|
2018-10-03 00:47:53 +00:00
|
|
|
|
2018-10-04 13:32:33 +00:00
|
|
|
fd = tunif->tun_fd;
|
|
|
|
tun_async = &tunif->ovl;
|
2018-10-04 11:20:08 +00:00
|
|
|
if(std::get< HANDLE >(fd) == INVALID_HANDLE_VALUE)
|
2018-09-29 08:16:54 +00:00
|
|
|
return false;
|
|
|
|
|
2018-10-03 00:47:53 +00:00
|
|
|
// we're already non-blocking
|
2018-10-04 11:20:08 +00:00
|
|
|
return true;
|
2018-09-29 08:16:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~tun()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2018-07-30 04:38:14 +00:00
|
|
|
}; // namespace llarp
|
|
|
|
|
|
|
|
struct llarp_win32_loop : public llarp_ev_loop
|
|
|
|
{
|
|
|
|
HANDLE iocpfd;
|
|
|
|
|
|
|
|
llarp_win32_loop() : iocpfd(INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~llarp_win32_loop()
|
|
|
|
{
|
|
|
|
if(iocpfd != INVALID_HANDLE_VALUE)
|
|
|
|
::CloseHandle(iocpfd);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
init()
|
|
|
|
{
|
|
|
|
if(iocpfd == INVALID_HANDLE_VALUE)
|
|
|
|
iocpfd = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 0);
|
|
|
|
|
2018-08-10 03:51:38 +00:00
|
|
|
if(iocpfd == INVALID_HANDLE_VALUE)
|
|
|
|
return false;
|
2018-08-11 09:48:24 +00:00
|
|
|
|
2018-08-10 03:51:38 +00:00
|
|
|
return true;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
2018-08-03 06:03:34 +00:00
|
|
|
// it works! -despair86, 3-Aug-18 @0420
|
2018-07-30 04:38:14 +00:00
|
|
|
int
|
|
|
|
tick(int ms)
|
|
|
|
{
|
2018-08-03 06:03:34 +00:00
|
|
|
// The only field we really care about is
|
|
|
|
// the listener_id, as it contains the address
|
|
|
|
// of the udp_listener instance.
|
|
|
|
DWORD iolen = 0;
|
|
|
|
// ULONG_PTR is guaranteed to be the same size
|
|
|
|
// as an arch-specific pointer value
|
|
|
|
ULONG_PTR ev_id = 0;
|
|
|
|
WSAOVERLAPPED* qdata = nullptr;
|
2018-10-05 07:57:48 +00:00
|
|
|
int idx = 0;
|
2018-10-04 13:32:33 +00:00
|
|
|
BOOL result =
|
|
|
|
::GetQueuedCompletionStatus(iocpfd, &iolen, &ev_id, &qdata, ms);
|
2018-10-05 05:06:54 +00:00
|
|
|
|
|
|
|
if(result && qdata)
|
2018-08-03 06:03:34 +00:00
|
|
|
{
|
2018-10-04 13:32:33 +00:00
|
|
|
llarp::udp_listener* ev = reinterpret_cast< llarp::udp_listener* >(ev_id);
|
|
|
|
if(ev && !ev->fd.valueless_by_exception())
|
2018-08-03 06:03:34 +00:00
|
|
|
{
|
2018-10-05 07:57:48 +00:00
|
|
|
llarp::LogDebug("size: ", iolen, "\tev_id: ", ev_id,
|
|
|
|
"\tqdata: ", qdata);
|
2018-10-04 13:32:33 +00:00
|
|
|
ev->getData(readbuf, sizeof(readbuf), iolen);
|
2018-08-03 06:03:34 +00:00
|
|
|
}
|
|
|
|
++idx;
|
2018-10-04 13:32:33 +00:00
|
|
|
}
|
2018-08-03 06:03:34 +00:00
|
|
|
|
|
|
|
if(!idx)
|
|
|
|
return -1;
|
|
|
|
else
|
2018-10-04 11:20:08 +00:00
|
|
|
{
|
|
|
|
tick_listeners();
|
2018-08-03 06:03:34 +00:00
|
|
|
result = idx;
|
2018-10-04 11:20:08 +00:00
|
|
|
}
|
2018-08-03 06:03:34 +00:00
|
|
|
|
|
|
|
return result;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
2018-08-03 06:03:34 +00:00
|
|
|
// ok apparently this isn't being used yet...
|
2018-07-30 04:38:14 +00:00
|
|
|
int
|
|
|
|
run()
|
|
|
|
{
|
2018-08-03 06:03:34 +00:00
|
|
|
// The only field we really care about is
|
|
|
|
// the listener_id, as it contains the address
|
|
|
|
// of the udp_listener instance.
|
|
|
|
DWORD iolen = 0;
|
|
|
|
// ULONG_PTR is guaranteed to be the same size
|
|
|
|
// as an arch-specific pointer value
|
|
|
|
ULONG_PTR ev_id = 0;
|
|
|
|
WSAOVERLAPPED* qdata = nullptr;
|
|
|
|
int idx = 0;
|
2018-10-05 07:57:48 +00:00
|
|
|
int result =
|
|
|
|
::GetQueuedCompletionStatus(iocpfd, &iolen, &ev_id, &qdata, 10);
|
2018-08-03 06:03:34 +00:00
|
|
|
|
2018-08-04 00:05:45 +00:00
|
|
|
// unlike epoll and kqueue, we only need to run so long as the
|
|
|
|
// system call returns TRUE
|
2018-10-05 07:57:48 +00:00
|
|
|
if(result)
|
|
|
|
{
|
|
|
|
llarp::udp_listener* ev = reinterpret_cast< llarp::udp_listener* >(ev_id);
|
|
|
|
if(ev && !ev->fd.valueless_by_exception())
|
2018-08-03 06:03:34 +00:00
|
|
|
{
|
2018-10-05 07:57:48 +00:00
|
|
|
llarp::LogInfo("size: ", iolen, "\tev_id: ", ev_id, "\tqdata: ", qdata);
|
|
|
|
ev->getData(readbuf, sizeof(readbuf), iolen);
|
2018-08-03 06:03:34 +00:00
|
|
|
}
|
2018-10-05 07:57:48 +00:00
|
|
|
++idx;
|
|
|
|
}
|
2018-08-03 06:03:34 +00:00
|
|
|
|
|
|
|
if(!idx)
|
|
|
|
return -1;
|
|
|
|
else
|
2018-10-04 11:20:08 +00:00
|
|
|
{
|
|
|
|
tick_listeners();
|
2018-08-03 06:03:34 +00:00
|
|
|
result = idx;
|
2018-10-04 11:20:08 +00:00
|
|
|
}
|
2018-08-03 06:03:34 +00:00
|
|
|
|
|
|
|
return result;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SOCKET
|
|
|
|
udp_bind(const sockaddr* addr)
|
|
|
|
{
|
|
|
|
socklen_t slen;
|
|
|
|
switch(addr->sa_family)
|
|
|
|
{
|
|
|
|
case AF_INET:
|
|
|
|
slen = sizeof(struct sockaddr_in);
|
|
|
|
break;
|
|
|
|
case AF_INET6:
|
|
|
|
slen = sizeof(struct sockaddr_in6);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return INVALID_SOCKET;
|
|
|
|
}
|
2018-10-05 07:57:48 +00:00
|
|
|
DWORD on = 1;
|
2018-10-05 05:06:54 +00:00
|
|
|
SOCKET fd = ::socket(addr->sa_family, SOCK_DGRAM, 0);
|
2018-07-30 04:38:14 +00:00
|
|
|
if(fd == INVALID_SOCKET)
|
|
|
|
{
|
|
|
|
perror("WSASocket()");
|
2018-08-03 06:03:34 +00:00
|
|
|
return INVALID_SOCKET;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(addr->sa_family == AF_INET6)
|
|
|
|
{
|
|
|
|
// enable dual stack explicitly
|
|
|
|
int dual = 1;
|
2018-08-03 06:03:34 +00:00
|
|
|
if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&dual,
|
|
|
|
sizeof(dual))
|
|
|
|
== -1)
|
2018-07-30 04:38:14 +00:00
|
|
|
{
|
|
|
|
// failed
|
|
|
|
perror("setsockopt()");
|
|
|
|
closesocket(fd);
|
|
|
|
return INVALID_SOCKET;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
llarp::Addr a(*addr);
|
2018-10-05 05:06:54 +00:00
|
|
|
llarp::LogDebug("bind to ", a);
|
2018-07-30 04:38:14 +00:00
|
|
|
if(bind(fd, addr, slen) == -1)
|
|
|
|
{
|
|
|
|
perror("bind()");
|
|
|
|
closesocket(fd);
|
|
|
|
return INVALID_SOCKET;
|
|
|
|
}
|
2018-10-05 05:06:54 +00:00
|
|
|
llarp::LogDebug("socket fd is ", fd);
|
|
|
|
ioctlsocket(fd, FIONBIO, &on);
|
2018-07-30 04:38:14 +00:00
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
close_ev(llarp::ev_io* ev)
|
|
|
|
{
|
|
|
|
// On Windows, just close the socket to decrease the iocp refcount
|
2018-08-03 06:03:34 +00:00
|
|
|
// and stop any pending I/O
|
2018-10-04 11:20:08 +00:00
|
|
|
BOOL stopped =
|
|
|
|
::CancelIo(reinterpret_cast< HANDLE >(std::get< SOCKET >(ev->fd)));
|
|
|
|
return closesocket(std::get< SOCKET >(ev->fd)) == 0 && stopped == TRUE;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 16:19:22 +00:00
|
|
|
llarp::ev_io*
|
|
|
|
create_udp(llarp_udp_io* l, const sockaddr* src)
|
2018-07-30 04:38:14 +00:00
|
|
|
{
|
|
|
|
SOCKET fd = udp_bind(src);
|
2018-08-03 06:03:34 +00:00
|
|
|
llarp::LogDebug("new socket fd is ", fd);
|
2018-07-30 04:38:14 +00:00
|
|
|
if(fd == INVALID_SOCKET)
|
2018-08-15 16:21:51 +00:00
|
|
|
return nullptr;
|
2018-07-30 04:38:14 +00:00
|
|
|
llarp::udp_listener* listener = new llarp::udp_listener(fd, l);
|
2018-08-15 16:19:22 +00:00
|
|
|
l->impl = listener;
|
|
|
|
udp_listeners.push_back(l);
|
|
|
|
return listener;
|
|
|
|
}
|
|
|
|
|
|
|
|
llarp::ev_io*
|
|
|
|
create_tun(llarp_tun_io* tun)
|
|
|
|
{
|
2018-09-29 08:16:54 +00:00
|
|
|
llarp::tun* t = new llarp::tun(tun);
|
|
|
|
if(t->setup())
|
|
|
|
return t;
|
|
|
|
delete t;
|
2018-08-15 16:19:22 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2018-08-18 03:19:00 +00:00
|
|
|
add_ev(llarp::ev_io* ev, bool write)
|
2018-08-15 16:19:22 +00:00
|
|
|
{
|
2018-10-05 07:57:48 +00:00
|
|
|
uint8_t buf[1024];
|
|
|
|
llarp::udp_listener* udp = nullptr;
|
|
|
|
llarp::tun* t = nullptr;
|
|
|
|
ev->listener_id = reinterpret_cast< ULONG_PTR >(ev);
|
2018-10-05 05:06:54 +00:00
|
|
|
memset(&buf, 0, 1024);
|
|
|
|
|
2018-10-04 11:20:08 +00:00
|
|
|
switch(ev->fd.index())
|
2018-07-30 04:38:14 +00:00
|
|
|
{
|
2018-10-04 11:20:08 +00:00
|
|
|
case 0:
|
2018-10-05 07:57:48 +00:00
|
|
|
udp = dynamic_cast< llarp::udp_listener* >(ev);
|
2018-10-04 11:20:08 +00:00
|
|
|
if(!::CreateIoCompletionPort((HANDLE)std::get< 0 >(ev->fd), iocpfd,
|
|
|
|
ev->listener_id, 0))
|
|
|
|
{
|
|
|
|
delete ev;
|
|
|
|
return false;
|
|
|
|
}
|
2018-10-05 07:57:48 +00:00
|
|
|
::ReadFile((HANDLE)std::get< 0 >(ev->fd), &buf, 1024, nullptr,
|
|
|
|
&udp->portfd);
|
2018-10-04 11:20:08 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2018-10-05 07:57:48 +00:00
|
|
|
t = dynamic_cast< llarp::tun* >(ev);
|
2018-10-04 11:20:08 +00:00
|
|
|
if(!::CreateIoCompletionPort(std::get< 1 >(ev->fd), iocpfd,
|
|
|
|
ev->listener_id, 0))
|
|
|
|
{
|
|
|
|
delete ev;
|
|
|
|
return false;
|
|
|
|
}
|
2018-10-05 07:57:48 +00:00
|
|
|
::ReadFile(std::get< 1 >(ev->fd), &buf, 1024, nullptr, t->tun_async);
|
2018-10-04 11:20:08 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
udp_close(llarp_udp_io* l)
|
|
|
|
{
|
|
|
|
bool ret = false;
|
|
|
|
llarp::udp_listener* listener =
|
|
|
|
static_cast< llarp::udp_listener* >(l->impl);
|
|
|
|
if(listener)
|
|
|
|
{
|
2018-08-03 06:03:34 +00:00
|
|
|
ret = close_ev(listener);
|
2018-07-30 04:38:14 +00:00
|
|
|
l->impl = nullptr;
|
|
|
|
delete listener;
|
2018-10-10 11:48:44 +00:00
|
|
|
// std::remove_if
|
|
|
|
auto itr = udp_listeners.begin();
|
|
|
|
while(itr != udp_listeners.end())
|
|
|
|
{
|
|
|
|
if((*itr) == l)
|
|
|
|
itr = udp_listeners.remove(itr);
|
|
|
|
else
|
|
|
|
++itr;
|
|
|
|
}
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-10 03:51:38 +00:00
|
|
|
bool
|
|
|
|
running() const
|
|
|
|
{
|
2018-08-11 09:48:24 +00:00
|
|
|
return iocpfd != INVALID_HANDLE_VALUE;
|
2018-08-10 03:51:38 +00:00
|
|
|
}
|
|
|
|
|
2018-07-30 04:38:14 +00:00
|
|
|
void
|
|
|
|
stop()
|
|
|
|
{
|
2018-08-11 09:48:24 +00:00
|
|
|
// still does nothing
|
2018-07-30 04:38:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|