aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/posix/posix_tcp.c69
-rw-r--r--src/platform/posix/posix_tcpconn.c2
-rw-r--r--src/platform/windows/win_resolv.c1
-rw-r--r--src/platform/windows/win_sockaddr.c2
4 files changed, 4 insertions, 70 deletions
diff --git a/src/platform/posix/posix_tcp.c b/src/platform/posix/posix_tcp.c
deleted file mode 100644
index 53ea8026..00000000
--- a/src/platform/posix/posix_tcp.c
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// Copyright 2018 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
-// copy of which should be located in the distribution where this
-// file was obtained (LICENSE.txt). A copy of the license may also be
-// found online at https://opensource.org/licenses/MIT.
-//
-
-#include "core/nng_impl.h"
-
-#ifdef NNG_PLATFORM_POSIX
-#include "platform/posix/posix_aio.h"
-
-#include <arpa/inet.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-int
-nni_plat_tcp_ntop(const nni_sockaddr *sa, char *ipstr, char *portstr)
-{
- const void *ap;
- uint16_t port;
- int af;
- switch (sa->s_family) {
- case NNG_AF_INET:
- ap = &sa->s_in.sa_addr;
- port = sa->s_in.sa_port;
- af = AF_INET;
- break;
- case NNG_AF_INET6:
- ap = &sa->s_in6.sa_addr;
- port = sa->s_in6.sa_port;
- af = AF_INET6;
- break;
- default:
- return (NNG_EINVAL);
- }
- if (ipstr != NULL) {
- if (af == AF_INET6) {
- size_t l;
- ipstr[0] = '[';
- inet_ntop(af, ap, ipstr + 1, INET6_ADDRSTRLEN);
- l = strlen(ipstr);
- ipstr[l++] = ']';
- ipstr[l++] = '\0';
- } else {
- inet_ntop(af, ap, ipstr, INET6_ADDRSTRLEN);
- }
- }
- if (portstr != NULL) {
-#ifdef NNG_LITTLE_ENDIAN
- port = ((port >> 8) & 0xff) | ((port & 0xff) << 8);
-#endif
- snprintf(portstr, 6, "%u", port);
- }
- return (0);
-}
-
-#endif // NNG_PLATFORM_POSIX
diff --git a/src/platform/posix/posix_tcpconn.c b/src/platform/posix/posix_tcpconn.c
index 30525648..5cd1887a 100644
--- a/src/platform/posix/posix_tcpconn.c
+++ b/src/platform/posix/posix_tcpconn.c
@@ -401,7 +401,9 @@ nni_tcp_conn_fini(nni_tcp_conn *c)
{
nni_tcp_conn_close(c);
nni_posix_pfd_fini(c->pfd);
+ nni_mtx_lock(&c->mtx); // not strictly needed, but shut up TSAN
c->pfd = NULL;
+ nni_mtx_unlock(&c->mtx);
nni_mtx_fini(&c->mtx);
NNI_FREE_STRUCT(c);
diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c
index e2cd192e..916f54b1 100644
--- a/src/platform/windows/win_resolv.c
+++ b/src/platform/windows/win_resolv.c
@@ -11,6 +11,7 @@
#include "core/nng_impl.h"
#include <ctype.h>
+#include <stdio.h>
#include <string.h>
#ifdef NNG_PLATFORM_WINDOWS
diff --git a/src/platform/windows/win_sockaddr.c b/src/platform/windows/win_sockaddr.c
index 141a1ce5..fbb960b7 100644
--- a/src/platform/windows/win_sockaddr.c
+++ b/src/platform/windows/win_sockaddr.c
@@ -70,4 +70,4 @@ nni_win_sockaddr2nn(nni_sockaddr *sa, const SOCKADDR_STORAGE *ss)
return (-1);
}
-#endif // NNG_PLATFORM_WINDOWS \ No newline at end of file
+#endif // NNG_PLATFORM_WINDOWS