aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/args_test.c5
-rw-r--r--src/core/buf_size_test.c2
-rw-r--r--src/core/defs.h2
-rw-r--r--src/core/device.c7
-rw-r--r--src/core/device.h1
-rw-r--r--src/core/dialer.c4
-rw-r--r--src/core/errors_test.c2
-rw-r--r--src/core/file.c6
-rw-r--r--src/core/id_test.c2
-rw-r--r--src/core/idhash.c2
-rw-r--r--src/core/idhash_test.c2
-rw-r--r--src/core/init.c13
-rw-r--r--src/core/init.h2
-rw-r--r--src/core/init_test.c3
-rw-r--r--src/core/list.c8
-rw-r--r--src/core/list_test.c4
-rw-r--r--src/core/listener.c2
-rw-r--r--src/core/lmq.c21
-rw-r--r--src/core/log_test.c3
-rw-r--r--src/core/message.c4
-rw-r--r--src/core/message_test.c6
-rw-r--r--src/core/msgqueue.c7
-rw-r--r--src/core/options.c5
-rw-r--r--src/core/panic.c3
-rw-r--r--src/core/pollable.c6
-rw-r--r--src/core/reap.c6
-rw-r--r--src/core/reconnect_test.c16
-rw-r--r--src/core/refcnt.c2
-rw-r--r--src/core/sock_test.c3
-rw-r--r--src/core/sockaddr.c3
-rw-r--r--src/core/sockaddr_test.c6
-rw-r--r--src/core/socket.c1
-rw-r--r--src/core/sockfd.c11
-rw-r--r--src/core/sockfd.h2
-rw-r--r--src/core/stats.c8
-rw-r--r--src/core/stats_test.c4
-rw-r--r--src/core/stream.c2
-rw-r--r--src/core/strs.c7
-rw-r--r--src/core/synch_test.c4
-rw-r--r--src/core/taskq.c5
-rw-r--r--src/core/taskq.h2
-rw-r--r--src/core/tcp.c4
-rw-r--r--src/core/tcp.h2
-rw-r--r--src/core/thread.c2
-rw-r--r--src/core/url.c9
-rw-r--r--src/core/url_test.c6
46 files changed, 111 insertions, 116 deletions
diff --git a/src/core/args_test.c b/src/core/args_test.c
index 5139fece..f7e69d83 100644
--- a/src/core/args_test.c
+++ b/src/core/args_test.c
@@ -8,9 +8,8 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nng/args.h>
-#include <nng/nng.h>
-#include <nuts.h>
+#include "../include/nng/args.h"
+#include "../testing/nuts.h"
static nng_arg_spec case1[] = {
// clang-format off
diff --git a/src/core/buf_size_test.c b/src/core/buf_size_test.c
index 24069f80..93fbe04f 100644
--- a/src/core/buf_size_test.c
+++ b/src/core/buf_size_test.c
@@ -8,7 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nuts.h>
+#include "../testing/nuts.h"
void
test_buffer_options(void)
diff --git a/src/core/defs.h b/src/core/defs.h
index 97d3dd06..c94d9bd3 100644
--- a/src/core/defs.h
+++ b/src/core/defs.h
@@ -15,7 +15,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "nng/nng.h"
+#include "../include/nng/nng.h"
// C compilers may get unhappy when named arguments are not used. While
// there are things like __attribute__((unused)) which are arguably
diff --git a/src/core/device.c b/src/core/device.c
index 68ab2f38..8f8c7115 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -8,7 +8,12 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
+#include "device.h"
+#include "aio.h"
+#include "defs.h"
+#include "message.h"
+#include "protocol.h"
+#include "socket.h"
typedef struct device_data_s device_data;
typedef struct device_path_s device_path;
diff --git a/src/core/device.h b/src/core/device.h
index 8d11aeb8..a8594ae5 100644
--- a/src/core/device.h
+++ b/src/core/device.h
@@ -14,6 +14,7 @@
// It works in both directions. Arguably we should build versions of this
// that are unidirectional, and we could extend this API with user-defined
// filtering functions.
+#include "defs.h"
extern void nni_device(nni_aio *aio, nni_sock *, nni_sock *);
#endif // CORE_DEVICE_H
diff --git a/src/core/dialer.c b/src/core/dialer.c
index 50f9e072..0208355f 100644
--- a/src/core/dialer.c
+++ b/src/core/dialer.c
@@ -10,11 +10,9 @@
//
#include "defs.h"
-#include "nng/nng.h"
#include "nng_impl.h"
#include "sockimpl.h"
-#include <stdio.h>
#include <string.h>
// Functionality related to dialing.
@@ -481,7 +479,7 @@ nni_dialer_start(nni_dialer *d, unsigned flags)
int
nni_dialer_start_aio(nni_dialer *d, unsigned flags, nni_aio *aiop)
{
- int rv = 0;
+ int rv = 0;
if (nni_atomic_flag_test_and_set(&d->d_started)) {
return (NNG_ESTATE);
diff --git a/src/core/errors_test.c b/src/core/errors_test.c
index b02bd36b..4c17074b 100644
--- a/src/core/errors_test.c
+++ b/src/core/errors_test.c
@@ -10,7 +10,7 @@
#include <errno.h>
#include <string.h>
-#include <nuts.h>
+#include "../testing/nuts.h"
static void
test_known_errors(void)
diff --git a/src/core/file.c b/src/core/file.c
index 173a864d..8957a940 100644
--- a/src/core/file.c
+++ b/src/core/file.c
@@ -8,7 +8,9 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
+#include "file.h"
+#include "defs.h"
+#include "platform.h"
int
nni_file_put(const char *name, const void *data, size_t sz)
@@ -50,7 +52,7 @@ nni_file_is_dir(const char *name)
struct walkdata {
nni_file_walker fn;
- void * arg;
+ void *arg;
};
static int
diff --git a/src/core/id_test.c b/src/core/id_test.c
index 78be63b8..72049062 100644
--- a/src/core/id_test.c
+++ b/src/core/id_test.c
@@ -7,7 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nuts.h>
+#include "../testing/nuts.h"
#include "idhash.h"
diff --git a/src/core/idhash.c b/src/core/idhash.c
index d3d3ec10..630739ec 100644
--- a/src/core/idhash.c
+++ b/src/core/idhash.c
@@ -10,7 +10,7 @@
#include "idhash.h"
#include "defs.h"
-#include "nng_impl.h"
+#include "thread.h"
#include <string.h>
diff --git a/src/core/idhash_test.c b/src/core/idhash_test.c
index 2bf65dae..e242e9ad 100644
--- a/src/core/idhash_test.c
+++ b/src/core/idhash_test.c
@@ -7,7 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nuts.h>
+#include "../testing/nuts.h"
void
test_id_basic(void)
diff --git a/src/core/init.c b/src/core/init.c
index 2e776daa..77fb4e60 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -8,12 +8,11 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-#include "core/platform.h"
-#include "core/socket.h"
-#include "nng/nng.h"
+#include "defs.h"
+#include "nng_impl.h"
+#include "platform.h"
+#include "socket.h"
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -32,6 +31,10 @@ extern void nni_tls_sys_fini(void);
#define NNG_NUM_POLLER_THREADS (nni_plat_ncpu())
#endif
+#ifndef NNG_MAX_POLLER_THREADS
+#define NNG_MAX_POLLER_THREADS 8
+#endif
+
#ifndef NNG_RESOLV_CONCURRENCY
#define NNG_RESOLV_CONCURRENCY 1
#endif
diff --git a/src/core/init.h b/src/core/init.h
index 2826870b..524d9c25 100644
--- a/src/core/init.h
+++ b/src/core/init.h
@@ -11,7 +11,7 @@
#ifndef CORE_INIT_H
#define CORE_INIT_H
-#include "nng/nng.h"
+#include "defs.h"
// subsystems can call this to obtain a parameter value.
nng_init_params *nni_init_get_params(void);
diff --git a/src/core/init_test.c b/src/core/init_test.c
index c891ba8e..cc51a19b 100644
--- a/src/core/init_test.c
+++ b/src/core/init_test.c
@@ -7,8 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng/nng.h"
-#include <nuts.h>
+#include "../testing/nuts.h"
nng_init_params *nng_init_get_params(void);
diff --git a/src/core/list.c b/src/core/list.c
index 65e86670..dd5406f7 100644
--- a/src/core/list.c
+++ b/src/core/list.c
@@ -8,16 +8,14 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <stdlib.h>
-#include <string.h>
-
-#include "core/nng_impl.h"
+#include "list.h"
+#include "defs.h"
// Linked list implementation. We implement a doubly linked list.
// Using pointer arithmetic, we can operate as a list of "anything".
#define NODE(list, item) \
- (nni_list_node *) (void *)(((char *) item) + list->ll_offset)
+ (nni_list_node *) (void *) (((char *) item) + list->ll_offset)
#define ITEM(list, node) (void *) (((char *) node) - list->ll_offset)
void
diff --git a/src/core/list_test.c b/src/core/list_test.c
index ec56cd93..cb03e917 100644
--- a/src/core/list_test.c
+++ b/src/core/list_test.c
@@ -7,8 +7,8 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng_impl.h"
-#include <nuts.h>
+#include "../testing/nuts.h"
+#include "list.h"
typedef struct {
int pad[2];
diff --git a/src/core/listener.c b/src/core/listener.c
index e9a853ed..57e498de 100644
--- a/src/core/listener.c
+++ b/src/core/listener.c
@@ -13,10 +13,8 @@
#include "nng_impl.h"
#include "strs.h"
-#include "nng/nng.h"
#include "sockimpl.h"
-#include <stdio.h>
#include <string.h>
// Functionality related to listeners.
diff --git a/src/core/lmq.c b/src/core/lmq.c
index d01afe50..5edce182 100644
--- a/src/core/lmq.c
+++ b/src/core/lmq.c
@@ -7,28 +7,29 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng_impl.h"
+#include "lmq.h"
+#include "defs.h"
+#include "message.h"
// Light-weight message queue. These are derived from our heavy-weight
// message queues, but are less "featured", but more useful for
// performance sensitive contexts. Locking must be done by the caller.
-
// Note that initialization of a queue is guaranteed to succeed.
// However, if the requested capacity is larger than 2, and memory
// cannot be allocated, then the capacity will only be 2.
void
nni_lmq_init(nni_lmq *lmq, size_t cap)
{
- lmq->lmq_len = 0;
- lmq->lmq_get = 0;
- lmq->lmq_put = 0;
+ lmq->lmq_len = 0;
+ lmq->lmq_get = 0;
+ lmq->lmq_put = 0;
lmq->lmq_alloc = 0;
- lmq->lmq_mask = 0;
- lmq->lmq_msgs = NULL;
- lmq->lmq_msgs = lmq->lmq_buf;
- lmq->lmq_cap = 2;
- lmq->lmq_mask = 0x1; // only index 0 and 1
+ lmq->lmq_mask = 0;
+ lmq->lmq_msgs = NULL;
+ lmq->lmq_msgs = lmq->lmq_buf;
+ lmq->lmq_cap = 2;
+ lmq->lmq_mask = 0x1; // only index 0 and 1
if (cap > 2) {
(void) nni_lmq_resize(lmq, cap);
} else {
diff --git a/src/core/log_test.c b/src/core/log_test.c
index 0bee1d47..b5b32490 100644
--- a/src/core/log_test.c
+++ b/src/core/log_test.c
@@ -10,8 +10,7 @@
#include <stdio.h>
#include <string.h>
-#include "nuts.h"
-#include <nng/nng.h>
+#include "../testing/nuts.h"
#ifdef NNG_PLATFORM_POSIX
#include <stdlib.h>
diff --git a/src/core/message.c b/src/core/message.c
index 78538194..53de4536 100644
--- a/src/core/message.c
+++ b/src/core/message.c
@@ -10,7 +10,9 @@
#include <string.h>
-#include "core/nng_impl.h"
+#include "defs.h"
+#include "message.h"
+#include "platform.h"
// Message API.
diff --git a/src/core/message_test.c b/src/core/message_test.c
index 35fca849..440420ac 100644
--- a/src/core/message_test.c
+++ b/src/core/message_test.c
@@ -8,11 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <string.h>
-
-#include <nng/nng.h>
-
-#include "nuts.h"
+#include "../testing/nuts.h"
void
test_msg_option(void)
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c
index 5d33fd94..9377b803 100644
--- a/src/core/msgqueue.c
+++ b/src/core/msgqueue.c
@@ -8,7 +8,12 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng_impl.h"
+#include "msgqueue.h"
+#include "aio.h"
+#include "defs.h"
+#include "list.h"
+#include "message.h"
+#include "pollable.h"
// Message queue. These operate in some respects like Go channels,
// but as we have access to the internals, we have made some fundamental
diff --git a/src/core/options.c b/src/core/options.c
index f3843c0d..22eeb140 100644
--- a/src/core/options.c
+++ b/src/core/options.c
@@ -9,11 +9,10 @@
// found online at https://opensource.org/licenses/MIT.
//
+#include "options.h"
#include "defs.h"
-#include "nng/nng.h"
-#include "nng_impl.h"
+#include "strs.h"
-#include <stdio.h>
#include <string.h>
nng_err
diff --git a/src/core/panic.c b/src/core/panic.c
index c6cb068e..b8b83cf5 100644
--- a/src/core/panic.c
+++ b/src/core/panic.c
@@ -17,7 +17,8 @@
#include <execinfo.h>
#endif
-#include "core/nng_impl.h"
+#include "panic.h"
+#include "platform.h"
// Panic handling.
void
diff --git a/src/core/pollable.c b/src/core/pollable.c
index d07c9b10..25e4cbb5 100644
--- a/src/core/pollable.c
+++ b/src/core/pollable.c
@@ -8,11 +8,13 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
+#include "pollable.h"
+#include "defs.h"
+#include "platform.h"
// We pack the wfd and rfd into a uint64_t so that we can update the pair
// atomically and use nni_atomic_cas64, to be lock free.
-#define WFD(fds) ((int) ((fds) &0xffffffffu))
+#define WFD(fds) ((int) ((fds) & 0xffffffffu))
#define RFD(fds) ((int) (((fds) >> 32u) & 0xffffffffu))
#define FD_JOIN(wfd, rfd) ((uint64_t) (wfd) + ((uint64_t) (rfd) << 32u))
diff --git a/src/core/reap.c b/src/core/reap.c
index c236e9ce..b0fee3fb 100644
--- a/src/core/reap.c
+++ b/src/core/reap.c
@@ -8,11 +8,9 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng_impl.h"
-
#include "reap.h"
-
-#include <stdbool.h>
+#include "defs.h"
+#include "thread.h"
static nni_reap_list *reap_list = NULL;
static nni_thr reap_thr;
diff --git a/src/core/reconnect_test.c b/src/core/reconnect_test.c
index 120f0517..904eb5b4 100644
--- a/src/core/reconnect_test.c
+++ b/src/core/reconnect_test.c
@@ -8,16 +8,14 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <string.h>
-
-#include <nuts.h>
+#include "../testing/nuts.h"
void
test_dial_before_listen(void)
{
nng_socket s1;
nng_socket s2;
- char *addr;
+ char *addr;
NUTS_OPEN(s1);
NUTS_OPEN(s2);
@@ -44,7 +42,7 @@ test_reconnect(void)
nng_socket s1;
nng_socket s2;
nng_listener l;
- char *addr;
+ char *addr;
NUTS_OPEN(s1);
NUTS_OPEN(s2);
@@ -82,8 +80,8 @@ test_reconnect_pipe(void)
nng_socket s1;
nng_socket s2;
nng_listener l;
- nng_msg * msg;
- char * addr;
+ nng_msg *msg;
+ char *addr;
NUTS_OPEN(s1);
NUTS_OPEN(s2);
@@ -126,7 +124,7 @@ test_reconnect_back_off_zero(void)
nng_socket s1;
nng_socket s2;
uint64_t start;
- char * addr;
+ char *addr;
NUTS_OPEN(s1);
NUTS_OPEN(s2);
@@ -163,4 +161,4 @@ NUTS_TESTS = {
{ "reconnect back-off zero", test_reconnect_back_off_zero },
{ "reconnect pipe", test_reconnect_pipe },
{ NULL, NULL },
-}; \ No newline at end of file
+};
diff --git a/src/core/refcnt.c b/src/core/refcnt.c
index 1b119507..a6427e26 100644
--- a/src/core/refcnt.c
+++ b/src/core/refcnt.c
@@ -6,7 +6,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <core/refcnt.h>
+#include "refcnt.h"
void
nni_refcnt_init(
diff --git a/src/core/sock_test.c b/src/core/sock_test.c
index f6f1bd7d..273a8c2c 100644
--- a/src/core/sock_test.c
+++ b/src/core/sock_test.c
@@ -8,8 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng/nng.h"
-#include <nuts.h>
+#include "../testing/nuts.h"
void
test_recv_timeout(void)
diff --git a/src/core/sockaddr.c b/src/core/sockaddr.c
index 9dbb1c6c..9dcfa3bc 100644
--- a/src/core/sockaddr.c
+++ b/src/core/sockaddr.c
@@ -7,8 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-#include "nng/nng.h"
+#include "defs.h"
#include <stdio.h>
#include <string.h>
diff --git a/src/core/sockaddr_test.c b/src/core/sockaddr_test.c
index 4959760b..1669d1b9 100644
--- a/src/core/sockaddr_test.c
+++ b/src/core/sockaddr_test.c
@@ -7,11 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <stdio.h>
-#include <string.h>
-
-#include "nuts.h"
-#include <nng/nng.h>
+#include "../testing/nuts.h"
#ifndef _WIN32
#include <arpa/inet.h> // for endianness functions
diff --git a/src/core/socket.c b/src/core/socket.c
index 2ef27dbc..7112014e 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -10,7 +10,6 @@
#include "defs.h"
#include "list.h"
-#include "nng/nng.h"
#include "nng_impl.h"
#include "options.h"
#include "pipe.h"
diff --git a/src/core/sockfd.c b/src/core/sockfd.c
index 651fcd63..3fa109a4 100644
--- a/src/core/sockfd.c
+++ b/src/core/sockfd.c
@@ -10,10 +10,13 @@
#include <stdint.h>
#include <string.h>
-#include <nng/nng.h>
-
-#include "core/nng_impl.h"
-#include "core/sockfd.h"
+#include "aio.h"
+#include "defs.h"
+#include "list.h"
+#include "options.h"
+#include "sockfd.h"
+#include "stream.h"
+#include "thread.h"
// We will accept up to this many FDs to be queued up for
// accept, before we start rejecting with NNG_ENOSPC. Once
diff --git a/src/core/sockfd.h b/src/core/sockfd.h
index 3b39ee60..212f5250 100644
--- a/src/core/sockfd.h
+++ b/src/core/sockfd.h
@@ -10,7 +10,7 @@
#ifndef CORE_FDC_H
#define CORE_FDC_H
-#include "nng/nng.h"
+#include "defs.h"
// the nni_sfd_conn struct is provided by platform code to wrap
// an arbitrary byte stream file descriptor (UNIX) or handle (Windows)
diff --git a/src/core/stats.c b/src/core/stats.c
index f01f642e..34ff2224 100644
--- a/src/core/stats.c
+++ b/src/core/stats.c
@@ -11,9 +11,11 @@
#include <stdio.h>
#include <string.h>
-#include "core/defs.h"
-#include "core/nng_impl.h"
-#include "nng/nng.h"
+#include "defs.h"
+#include "platform.h"
+#include "stats.h"
+#include "strs.h"
+#include "thread.h"
typedef struct nng_stat nni_stat;
diff --git a/src/core/stats_test.c b/src/core/stats_test.c
index 8912d44e..6f1e343d 100644
--- a/src/core/stats_test.c
+++ b/src/core/stats_test.c
@@ -8,9 +8,9 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nuts.h>
+#include "../testing/nuts.h"
-#define SECONDS(x) ((x) *1000)
+#define SECONDS(x) ((x) * 1000)
void
test_stats_socket(void)
diff --git a/src/core/stream.c b/src/core/stream.c
index 572f28d1..5a5159df 100644
--- a/src/core/stream.c
+++ b/src/core/stream.c
@@ -12,8 +12,8 @@
#include <string.h>
+#include "defs.h"
#include "nng_impl.h"
-
#include "sockfd.h"
#include "tcp.h"
diff --git a/src/core/strs.c b/src/core/strs.c
index 3f51e59a..ad73951b 100644
--- a/src/core/strs.c
+++ b/src/core/strs.c
@@ -14,7 +14,8 @@
#include <stdlib.h>
#include <string.h>
-#include "core/nng_impl.h"
+#include "defs.h"
+#include "strs.h"
// This file contains implementation of utility functions that are not
// part of standard C99. (C11 has added some things here, but we cannot
@@ -28,7 +29,7 @@
char *
nni_strdup(const char *src)
{
- char * dst;
+ char *dst;
size_t len = strlen(src) + 1;
if ((dst = nni_alloc(len)) != NULL) {
@@ -157,7 +158,7 @@ nni_asprintf(char **sp, const char *fmt, ...)
{
va_list ap;
size_t len;
- char * s;
+ char *s;
va_start(ap, fmt);
len = vsnprintf(NULL, 0, fmt, ap);
diff --git a/src/core/synch_test.c b/src/core/synch_test.c
index 87745cbe..bfaaaaca 100644
--- a/src/core/synch_test.c
+++ b/src/core/synch_test.c
@@ -8,9 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include <nng/nng.h>
-
-#include <nuts.h>
+#include "../testing/nuts.h"
// Notify tests for verifying condvars.
struct notifyarg {
diff --git a/src/core/taskq.c b/src/core/taskq.c
index 6b089767..d8a933ac 100644
--- a/src/core/taskq.c
+++ b/src/core/taskq.c
@@ -8,8 +8,9 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
-#include "nng/nng.h"
+#include "taskq.h"
+#include "defs.h"
+#include "thread.h"
typedef struct nni_taskq_thr nni_taskq_thr;
struct nni_taskq_thr {
diff --git a/src/core/taskq.h b/src/core/taskq.h
index cd27408c..8784af4c 100644
--- a/src/core/taskq.h
+++ b/src/core/taskq.h
@@ -15,8 +15,6 @@
#include "list.h"
#include "platform.h"
-#include "nng/nng.h"
-
typedef struct nni_taskq nni_taskq;
typedef struct nni_task nni_task;
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 5f663c19..5c274854 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -13,11 +13,9 @@
#include <stdio.h>
#include <string.h>
-#include <nng/nng.h>
-
-#include "core/url.h"
#include "nng_impl.h"
#include "tcp.h"
+#include "url.h"
typedef struct {
nng_stream_dialer ops;
diff --git a/src/core/tcp.h b/src/core/tcp.h
index 58cac45a..1b13267b 100644
--- a/src/core/tcp.h
+++ b/src/core/tcp.h
@@ -10,7 +10,7 @@
#ifndef CORE_TCP_H
#define CORE_TCP_H
-#include "nng/nng.h"
+#include "defs.h"
// These are interfaces we use for TCP internally. These are not exposed
// to the public API.
diff --git a/src/core/thread.c b/src/core/thread.c
index 15baab04..7da8911c 100644
--- a/src/core/thread.c
+++ b/src/core/thread.c
@@ -7,7 +7,7 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/nng_impl.h"
+#include "thread.h"
void
nni_mtx_init(nni_mtx *mtx)
diff --git a/src/core/url.c b/src/core/url.c
index fb13ee59..b6323ba0 100644
--- a/src/core/url.c
+++ b/src/core/url.c
@@ -8,16 +8,15 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "core/defs.h"
-#include "core/nng_impl.h"
-
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
-#include "core/platform.h"
-#include "nng/nng.h"
+#include "aio.h"
+#include "defs.h"
+#include "platform.h"
+#include "strs.h"
#include "url.h"
static uint8_t
diff --git a/src/core/url_test.c b/src/core/url_test.c
index e05badab..3bbc5f23 100644
--- a/src/core/url_test.c
+++ b/src/core/url_test.c
@@ -8,10 +8,8 @@
// found online at https://opensource.org/licenses/MIT.
//
-#include "nng/nng.h"
-#include "nng_impl.h"
-#include <nuts.h>
-#include <string.h>
+#include "../testing/nuts.h"
+#include "url.h"
void
test_url_host(void)