aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-04 12:47:26 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-04 12:47:26 -0800
commit7eb7471b35dd0e5b9e2da0668376af5b218264e6 (patch)
tree87a7ddcfd94200c458d3ba29e420c4c61371c9e3 /src
parenta1d543fc45dbd066020c8c15ea37421bdd49bc10 (diff)
downloadnng-7eb7471b35dd0e5b9e2da0668376af5b218264e6.tar.gz
nng-7eb7471b35dd0e5b9e2da0668376af5b218264e6.tar.bz2
nng-7eb7471b35dd0e5b9e2da0668376af5b218264e6.zip
TCP listen and accept test.
There is an occasional use-after-free bug we need to fix still.
Diffstat (limited to 'src')
-rw-r--r--src/platform/posix/posix_net.c2
-rw-r--r--src/transport/tcp/tcp.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/platform/posix/posix_net.c b/src/platform/posix/posix_net.c
index 2fdab245..c7c5ce82 100644
--- a/src/platform/posix/posix_net.c
+++ b/src/platform/posix/posix_net.c
@@ -137,7 +137,6 @@ nni_plat_tcp_send(nni_plat_tcpsock *s, nni_iov *iovs, int cnt)
if (rv > resid) {
nni_panic("writev says it wrote too much!");
}
-
resid -= rv;
while (rv) {
if (iov[i].iov_len <= rv) {
@@ -366,6 +365,7 @@ nni_plat_tcp_accept(nni_plat_tcpsock *s, nni_plat_tcpsock *server)
}
nni_plat_tcp_setopts(fd);
+
s->fd = fd;
return (0);
}
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index 8cd91044..00d9a2f3 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -401,7 +401,7 @@ nni_tcp_ep_accept(void *arg, void **pipep)
int rv;
- if ((pipe = NNI_ALLOC_STRUCT(pipe)) != NULL) {
+ if ((pipe = NNI_ALLOC_STRUCT(pipe)) == NULL) {
return (NNG_ENOMEM);
}
pipe->proto = ep->proto;