Mercurial > dropbear
comparison svr-main.c @ 63:dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
- still a checkpoint-ish commit
- sorted out listening on localhost only
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 11 Aug 2004 17:26:47 +0000 |
parents | 20563735e8b5 |
children | ac96bc733e71 |
comparison
equal
deleted
inserted
replaced
62:20563735e8b5 | 63:dcc43965928f |
---|---|
186 if (!FD_ISSET(listensocks[i], &fds)) | 186 if (!FD_ISSET(listensocks[i], &fds)) |
187 continue; | 187 continue; |
188 | 188 |
189 /* child connection XXX - ip6 stuff here */ | 189 /* child connection XXX - ip6 stuff here */ |
190 remoteaddrlen = sizeof(remoteaddr); | 190 remoteaddrlen = sizeof(remoteaddr); |
191 childsock = accept(listensocks[i], &remoteaddr, &remoteaddrlen); | 191 childsock = accept(listensocks[i], |
192 (struct sockaddr*)&remoteaddr, &remoteaddrlen); | |
192 | 193 |
193 if (childsock < 0) { | 194 if (childsock < 0) { |
194 /* accept failed */ | 195 /* accept failed */ |
195 continue; | 196 continue; |
196 } | 197 } |
293 | 294 |
294 /* Set up listening sockets for all the requested ports */ | 295 /* Set up listening sockets for all the requested ports */ |
295 static int listensockets(int *sock, int sockcount, int *maxfd) { | 296 static int listensockets(int *sock, int sockcount, int *maxfd) { |
296 | 297 |
297 unsigned int i; | 298 unsigned int i; |
298 char portstring[6]; | 299 char portstring[NI_MAXSERV]; |
299 char* errstring = NULL; | 300 char* errstring = NULL; |
300 unsigned int sockpos = 0; | 301 unsigned int sockpos = 0; |
301 int nsock; | 302 int nsock; |
302 | 303 |
303 for (i = 0; i < svr_opts.portcount; i++) { | 304 for (i = 0; i < svr_opts.portcount; i++) { |