pull/179/head
despair 6 years ago committed by Rick
parent d1cbd58a3f
commit afa83f0646
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

@ -27,6 +27,16 @@ struct asio_evt_pkt
bool write = false; // true, or false if read pkt
size_t sz; // if this doesn't match what is in the packet, note the error
};
// From the preview SDK, should take a look at that
// periodically in case its definition changes
#define UNIX_PATH_MAX 108
typedef struct sockaddr_un
{
ADDRESS_FAMILY sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* pathname */
} SOCKADDR_UN, *PSOCKADDR_UN;
#else
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
@ -519,17 +529,6 @@ namespace llarp
// finally create aliases by platform
#ifdef _WIN32
using ev_io = win32_ev_io;
// From the preview SDK, should take a look at that
// periodically in case its definition changes
#define UNIX_PATH_MAX 108
typedef struct sockaddr_un
{
ADDRESS_FAMILY sun_family; /* AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* pathname */
} SOCKADDR_UN, *PSOCKADDR_UN;
#else
using ev_io = posix_ev_io;
#endif

@ -10,10 +10,6 @@
#include <cstdio>
#ifdef sizeof
#undef sizeof
#endif
namespace llarp
{
int
@ -117,6 +113,7 @@ namespace llarp
{
llarp_tun_io* t;
device* tunif;
tun(llarp_tun_io* tio, llarp_ev_loop* l)
: ev_io(INVALID_HANDLE_VALUE,
new LossyWriteQueue_t("win32_tun_write_queue", l, l))
@ -324,8 +321,8 @@ struct llarp_win32_loop : public llarp_ev_loop
// beta
else if(bindaddr->sa_family == AF_UNIX)
{
sz = 110; // current size in 10.0.17763, verify each time the beta PSDK
// is updated
sz = sizeof(sockaddr_un); // current size in 10.0.17763, verify each time
// the beta PSDK is updated
}
if(::bind(fd, bindaddr, sz) == -1)
{
@ -370,7 +367,7 @@ struct llarp_win32_loop : public llarp_ev_loop
upollfd = upoll_create(1);
if(tun_event_queue == INVALID_HANDLE_VALUE)
tun_event_queue =
CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 1024);
CreateIoCompletionPort(INVALID_HANDLE_VALUE, nullptr, 0, 0);
return upollfd && (tun_event_queue != INVALID_HANDLE_VALUE);
}
@ -572,9 +569,7 @@ struct llarp_win32_loop : public llarp_ev_loop
memset(pkt, 0, sizeof(asio_evt_pkt));
pkt->write = false;
pkt->sz = sizeof(readbuf);
CreateIoCompletionPort(e->fd.tun, tun_event_queue, (ULONG_PTR)e, 1024);
// queue an initial read
ReadFile(e->fd.tun, readbuf, sizeof(readbuf), nullptr, &pkt->pkt);
CreateIoCompletionPort(e->fd.tun, tun_event_queue, (ULONG_PTR)e, 0);
goto add;
}
upoll_event_t ev;

Loading…
Cancel
Save