summaryrefslogtreecommitdiff
path: root/sysdep/unix/io.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-04-26 13:26:11 +0000
committerMartin Mares <mj@ucw.cz>2000-04-26 13:26:11 +0000
commite1ddd9937759bc22b7241e48400d17840a101d9d (patch)
tree1d44afc5454a04e954613e7853edf38eade5c607 /sysdep/unix/io.c
parentdfa9a53a66e5747ddbeedfa0a47fa2ca9fc93b99 (diff)
Changed handling of incoming connections, so that we can send data
from the send hook without worrying about existence of socket buffers. Also, don't forget to copy peer addresses.
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r--sysdep/unix/io.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index e50689f6..35af2df8 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -493,15 +493,21 @@ sk_passive_connected(sock *s, struct sockaddr *sa, int al, int type)
char *err;
t->type = type;
t->fd = fd;
+ t->ttl = s->ttl;
+ t->tos = s->tos;
+ t->rbsize = s->rbsize;
+ t->tbsize = s->tbsize;
+ if (type == SK_TCP)
+ get_sockaddr((sockaddr *) sa, &t->daddr, &t->dport);
add_tail(&sock_list, &t->n);
- s->rx_hook(t, 0);
if (err = sk_setup(t))
{
log(L_ERR "Incoming connection: %s: %m", err);
- s->err_hook(s, errno);
- return 0;
+ rfree(t);
+ return 1;
}
sk_alloc_bufs(t);
+ s->rx_hook(t, 0);
return 1;
}
else if (errno != EINTR && errno != EAGAIN)
@@ -682,7 +688,6 @@ sk_open_unix(sock *s, char *name)
ERR("bind");
if (listen(fd, 8))
ERR("listen");
- sk_alloc_bufs(s);
add_tail(&sock_list, &s->n);
return 0;