Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamore committed May 7, 2024
1 parent 1615319 commit a5f1a8f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/platform/windows/win_clock.c
Expand Up @@ -24,7 +24,6 @@ nni_clock(void)
int
nni_time_get(uint64_t *seconds, uint32_t *nanoseconds)
{
int rv;
struct timespec ts;
if (timespec_get(&ts, TIME_UTC) == TIME_UTC) {
*seconds = ts.tv_sec;
Expand Down
4 changes: 2 additions & 2 deletions src/platform/windows/win_impl.h
@@ -1,5 +1,5 @@
//
// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
Expand Down Expand Up @@ -122,7 +122,7 @@ extern void nni_win_udp_sysfini(void);
extern int nni_win_resolv_sysinit(void);
extern void nni_win_resolv_sysfini(void);

extern int nni_win_io_init(nni_win_io *, nni_win_io_cb, void *);
extern int nni_win_io_init(nni_win_io *, HANDLE, nni_win_io_cb, void *);
extern void nni_win_io_fini(nni_win_io *);

extern int nni_win_io_register(HANDLE);
Expand Down
6 changes: 3 additions & 3 deletions src/platform/windows/win_io.c
Expand Up @@ -23,7 +23,7 @@ static int win_io_nthr = 0;
static HANDLE win_io_h = NULL;
static nni_thr *win_io_thrs;

static SRWLock win_io_lock = SRWLOCK_INIT;
static SRWLOCK win_io_lock = SRWLOCK_INIT;

static void
win_io_handler(void *arg)
Expand Down Expand Up @@ -85,8 +85,8 @@ nni_win_io_fini(nni_win_io *io)
{
DWORD num;
// Make absolutely sure there is no I/O running.
if (io->f != INVALID_HANDLE) {
CancelIoEx(io->f, &o->olpd);
if (io->f != INVALID_HANDLE_VALUE) {
CancelIoEx(io->f, &io->olpd);
(void) GetOverlappedResult(io->f, &io->olpd, &num, TRUE);
}

Expand Down
4 changes: 2 additions & 2 deletions src/platform/windows/win_ipclisten.c
Expand Up @@ -331,8 +331,8 @@ nni_ipc_listener_alloc(nng_stream_listener **lp, const nng_url *url)
if ((l = NNI_ALLOC_STRUCT(l)) == NULL) {
return (NNG_ENOMEM);
}
if ((rv = nni_win_io_init(&l->io, INVALID_HANDLE, ipc_accept_cb, l)) !=
0) {
if ((rv = nni_win_io_init(
&l->io, INVALID_HANDLE_VALUE, ipc_accept_cb, l)) != 0) {
NNI_FREE_STRUCT(l);
return (rv);
}
Expand Down
6 changes: 4 additions & 2 deletions src/platform/windows/win_tcpconn.c
Expand Up @@ -448,8 +448,10 @@ nni_win_tcp_init(nni_tcp_conn **connp, SOCKET s)
c->ops.s_get = tcp_get;
c->ops.s_set = tcp_set;

if (((rv = nni_win_io_init(&c->recv_io, s, tcp_recv_cb, c)) != 0) ||
((rv = nni_win_io_init(&c->send_io, s, tcp_send_cb, c)) != 0) ||
if (((rv = nni_win_io_init(&c->recv_io, (HANDLE) s, tcp_recv_cb, c)) !=
0) ||
((rv = nni_win_io_init(&c->send_io, (HANDLE) s, tcp_send_cb, c)) !=
0) ||
((rv = nni_win_io_register((HANDLE) s)) != 0)) {
tcp_free(c);
return (rv);
Expand Down
3 changes: 2 additions & 1 deletion src/platform/windows/win_tcpdial.c
Expand Up @@ -208,7 +208,8 @@ nni_tcp_dial(nni_tcp_dialer *d, const nni_sockaddr *sa, nni_aio *aio)

c->peername = ss;

if ((rv = nni_win_io_init(&c->conn_io, s, tcp_dial_cb, c)) != 0) {
if ((rv = nni_win_io_init(&c->conn_io, (HANDLE) s, tcp_dial_cb, c)) !=
0) {
nni_aio_finish_error(aio, rv);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/platform/windows/win_tcplisten.c
Expand Up @@ -322,7 +322,8 @@ nni_tcp_listener_accept(nni_tcp_listener *l, nni_aio *aio)
c->listener = l;
c->conn_aio = aio;
nni_aio_set_prov_data(aio, c);
if (((rv = nni_win_io_init(&c->conn_io, s, tcp_accept_cb, c)) != 0) ||
if (((rv = nni_win_io_init(
&c->conn_io, (HANDLE) s, tcp_accept_cb, c)) != 0) ||
((rv = nni_aio_schedule(aio, tcp_accept_cancel, l)) != 0)) {
nni_aio_set_prov_data(aio, NULL);
nni_mtx_unlock(&l->mtx);
Expand Down
5 changes: 3 additions & 2 deletions src/platform/windows/win_udp.c
@@ -1,5 +1,5 @@
//
// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
Expand Down Expand Up @@ -67,7 +67,8 @@ nni_plat_udp_open(nni_plat_udp **udpp, nni_sockaddr *sa)
(void) setsockopt(
u->s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &no, sizeof(no));

if (((rv = nni_win_io_init(&u->rxio, u->s, udp_recv_cb, u)) != 0) ||
if (((rv = nni_win_io_init(&u->rxio, (HANDLE) u->s, udp_recv_cb, u)) !=
0) ||
((rv = nni_win_io_register((HANDLE) u->s)) != 0)) {
nni_plat_udp_close(u);
return (rv);
Expand Down

0 comments on commit a5f1a8f

Please sign in to comment.