Mercurial > dropbear
comparison svr-main.c @ 454:7e43f5e473b9
- Add -K keepalive flag for dropbear and dbclient
- Try to reduce the frequency of select() timeouts
- Add a max receive window size of 1MB
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 08 Aug 2007 15:12:06 +0000 |
parents | 278805938dcf |
children | df7f7da7f6e4 |
comparison
equal
deleted
inserted
replaced
453:29953de278ae | 454:7e43f5e473b9 |
---|---|
109 #endif /* INETD_MODE */ | 109 #endif /* INETD_MODE */ |
110 | 110 |
111 #ifdef NON_INETD_MODE | 111 #ifdef NON_INETD_MODE |
112 void main_noinetd() { | 112 void main_noinetd() { |
113 fd_set fds; | 113 fd_set fds; |
114 struct timeval seltimeout; | |
115 unsigned int i, j; | 114 unsigned int i, j; |
116 int val; | 115 int val; |
117 int maxsock = -1; | 116 int maxsock = -1; |
118 int listensocks[MAX_LISTEN_ADDR]; | 117 int listensocks[MAX_LISTEN_ADDR]; |
119 size_t listensockcount = 0; | 118 size_t listensockcount = 0; |
173 /* incoming connection select loop */ | 172 /* incoming connection select loop */ |
174 for(;;) { | 173 for(;;) { |
175 | 174 |
176 FD_ZERO(&fds); | 175 FD_ZERO(&fds); |
177 | 176 |
178 seltimeout.tv_sec = 60; | |
179 seltimeout.tv_usec = 0; | |
180 | |
181 /* listening sockets */ | 177 /* listening sockets */ |
182 for (i = 0; i < listensockcount; i++) { | 178 for (i = 0; i < listensockcount; i++) { |
183 FD_SET(listensocks[i], &fds); | 179 FD_SET(listensocks[i], &fds); |
184 } | 180 } |
185 | 181 |
189 FD_SET(childpipes[i], &fds); | 185 FD_SET(childpipes[i], &fds); |
190 maxsock = MAX(maxsock, childpipes[i]); | 186 maxsock = MAX(maxsock, childpipes[i]); |
191 } | 187 } |
192 } | 188 } |
193 | 189 |
194 val = select(maxsock+1, &fds, NULL, NULL, &seltimeout); | 190 val = select(maxsock+1, &fds, NULL, NULL, NULL); |
195 | 191 |
196 if (exitflag) { | 192 if (exitflag) { |
197 unlink(svr_opts.pidfile); | 193 unlink(svr_opts.pidfile); |
198 dropbear_exit("Terminated by signal"); | 194 dropbear_exit("Terminated by signal"); |
199 } | 195 } |
200 | 196 |
201 if (val == 0) { | 197 if (val == 0) { |
202 /* timeout reached */ | 198 /* timeout reached - shouldn't happen. eh */ |
203 continue; | 199 continue; |
204 } | 200 } |
205 | 201 |
206 if (val < 0) { | 202 if (val < 0) { |
207 if (errno == EINTR) { | 203 if (errno == EINTR) { |