summaryrefslogtreecommitdiff
path: root/src/tcp.c
diff options
context:
space:
mode:
authorAlexander Wirt <formorer@debian.org>2013-05-18 21:48:14 +0200
committerAlexander Wirt <formorer@debian.org>2013-05-18 21:48:14 +0200
commit6b61aefbf3de71852386f5f26d60c10ef62407d3 (patch)
tree3f3bc8e11f487c990c57e8a345db2040b3e9a66c /src/tcp.c
parentea27bb406e3d8fe9466ba274af38e6f540ff5bfc (diff)
downloadconntrack-tools-6b61aefbf3de71852386f5f26d60c10ef62407d3.tar.gz
conntrack-tools-6b61aefbf3de71852386f5f26d60c10ef62407d3.zip
Imported Upstream version 1.4.1
Diffstat (limited to 'src/tcp.c')
-rw-r--r--src/tcp.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/src/tcp.c b/src/tcp.c
index c551c54..af27c46 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -27,7 +27,7 @@
struct tcp_sock *tcp_server_create(struct tcp_conf *c)
{
- int yes = 1, ret;
+ int yes = 1;
struct tcp_sock *m;
socklen_t socklen = sizeof(int);
@@ -109,30 +109,7 @@ struct tcp_sock *tcp_server_create(struct tcp_conf *c)
return NULL;
}
- /* now we accept new connections ... */
- ret = accept(m->fd, NULL, NULL);
- if (ret == -1) {
- if (errno != EAGAIN) {
- /* unexpected error, give up. */
- close(m->fd);
- free(m);
- m = NULL;
- } else {
- /* still in progress ... we'll do it in tcp_recv() */
- m->state = TCP_SERVER_ACCEPTING;
- }
- } else {
- /* very unlikely at this stage. */
- if (fcntl(ret, F_SETFL, O_NONBLOCK) == -1) {
- /* unexpected error, give up. */
- close(m->fd);
- free(m);
- return NULL;
- }
- m->client_fd = ret;
- m->state = TCP_SERVER_CONNECTED;
- register_fd(m->client_fd, STATE(fds));
- }
+ m->state = TCP_SERVER_ACCEPTING;
return m;
}
@@ -287,7 +264,6 @@ int tcp_accept(struct tcp_sock *m)
m->client_fd = ret;
m->state = TCP_SERVER_CONNECTED;
- register_fd(m->client_fd, STATE(fds));
}
return m->client_fd;
}
@@ -367,7 +343,6 @@ ssize_t tcp_recv(struct tcp_sock *m, void *data, int size)
close(m->client_fd);
m->client_fd = -1;
m->state = TCP_SERVER_ACCEPTING;
- tcp_accept(m);
} else if (errno != EAGAIN) {
m->stats.error++;
}
@@ -377,7 +352,6 @@ ssize_t tcp_recv(struct tcp_sock *m, void *data, int size)
close(m->client_fd);
m->client_fd = -1;
m->state = TCP_SERVER_ACCEPTING;
- tcp_accept(m);
}
if (ret >= 0) {