SOURCES: tpop3d-poll-indexing.patch - cosmetics
arekm
arekm at pld-linux.org
Sat Jul 12 17:09:42 CEST 2008
Author: arekm Date: Sat Jul 12 15:09:42 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- cosmetics
---- Files affected:
SOURCES:
tpop3d-poll-indexing.patch (1.3 -> 1.4)
---- Diffs:
================================================================
Index: SOURCES/tpop3d-poll-indexing.patch
diff -u SOURCES/tpop3d-poll-indexing.patch:1.3 SOURCES/tpop3d-poll-indexing.patch:1.4
--- SOURCES/tpop3d-poll-indexing.patch:1.3 Sat Jul 12 15:52:08 2008
+++ SOURCES/tpop3d-poll-indexing.patch Sat Jul 12 17:09:37 2008
@@ -11,7 +11,7 @@
char *remote_ip; /* ASCII remote IP address */
struct sockaddr_in sin_local; /* name of local side */
diff --git a/ioabs_tcp.c b/ioabs_tcp.c
-index 36d87d0..69fc5ff 100644
+index 36d87d0..27c9dc1 100644
--- a/ioabs_tcp.c
+++ b/ioabs_tcp.c
@@ -78,13 +78,13 @@ static void ioabs_tcp_pre_select(connection c, int *n, struct pollfd *pfds) {
@@ -20,8 +20,8 @@
- pfds[c->s].fd = c->s;
- pfds[c->s].events |= POLLIN;
-+ (*n)++;
+ c->s_index = *n;
++ (*n)++;
+
+ pfds[c->s_index].fd = c->s;
+ pfds[c->s_index].events |= POLLIN;
@@ -53,7 +53,7 @@
n = 1;
do {
diff --git a/ioabs_tls.c b/ioabs_tls.c
-index 98ac7b7..dc47a7d 100644
+index 98ac7b7..636f5e3 100644
--- a/ioabs_tls.c
+++ b/ioabs_tls.c
@@ -245,15 +245,15 @@ static void ioabs_tls_pre_select(connection c, int *n, struct pollfd *pfds) {
@@ -62,8 +62,8 @@
- pfds[c->s].fd = c->s;
- pfds[c->s].events |= POLLIN; /* always want to read */
-+ (*n)++;
+ c->s_index = *n;
++ (*n)++;
+
+ pfds[c->s_index].fd = c->s;
+ pfds[c->s_index].events |= POLLIN; /* always want to read */
@@ -102,14 +102,14 @@
/* the arguments of the constructor vary according to the particular
diff --git a/netloop.c b/netloop.c
-index f39018b..e02f3e8 100644
+index f39018b..3b2c8e5 100644
--- a/netloop.c
+++ b/netloop.c
-@@ -121,23 +121,26 @@ static void remove_connection(connection c) {
+@@ -121,13 +121,16 @@ static void remove_connection(connection c) {
/* listeners_pre_select:
* Called before the main select(2) so listening sockets can be polled. */
static void listeners_pre_select(int *n, struct pollfd *pfds) {
-+ int i = 0;
++ int i = *n;
item *t;
vector_iterate(listeners, t) {
int s = ((listener)t->v)->s;
@@ -119,16 +119,13 @@
+ pfds[i].fd = s;
+ pfds[i].events |= POLLIN;
+ ((listener)t->v)->s_index = i;
-+ if (i > *n) *n = i;
+ i++;
}
++ *n = i;
}
/* listeners_post_select:
- * Called after the main select(2) to allow listening sockets to sort
- * themselves out. */
--static void listeners_post_select(struct pollfd *pfds) {
-+static void listeners_post_select(struct pollfd *pfds, int *n) {
+@@ -137,7 +140,7 @@ static void listeners_post_select(struct pollfd *pfds) {
item *t;
vector_iterate(listeners, t) {
listener L = (listener)t->v;
@@ -146,7 +143,7 @@
sigemptyset(&chmask);
sigaddset(&chmask, SIGCHLD);
-@@ -557,7 +562,12 @@ void net_loop(void) {
+@@ -557,15 +562,21 @@ void net_loop(void) {
max_connections = 2 * max_running_children;
connections = (connection*)xcalloc(max_connections, sizeof(connection*));
@@ -160,21 +157,23 @@
log_print(LOG_INFO, _("net_loop: tpop3d version %s successfully started"), TPOP3D_VERSION);
-@@ -565,7 +575,7 @@ void net_loop(void) {
+ /* Main select() loop */
while (!foad) {
- int n = 0, e, i;
+- int n = 0, e, i;
++ int n = 0; /* number of pfds elements in use */
++ int e, i;
- for (i = 0; i < max_connections; ++i) {
+ for (i = 0; i < (max_listeners + max_connections); ++i) {
pfds[i].fd = -1;
pfds[i].events = pfds[i].revents = 0;
}
-@@ -579,7 +589,7 @@ void net_loop(void) {
+@@ -574,7 +585,7 @@ void net_loop(void) {
+
+ connections_pre_select(&n, pfds);
+
+- e = poll(pfds, n + 1, 1000 /* must be smaller than timeout */);
++ e = poll(pfds, n, 1000 /* must be smaller than timeout */);
+ if (e == -1 && errno != EINTR) {
log_print(LOG_WARNING, "net_loop: poll: %m");
} else if (e >= 0) {
- /* Check for new incoming connections */
-- if (!post_fork) listeners_post_select(pfds);
-+ if (!post_fork) listeners_post_select(pfds, &n);
-
- /* Monitor existing connections */
- connections_post_select(pfds);
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/tpop3d-poll-indexing.patch?r1=1.3&r2=1.4&f=u
More information about the pld-cvs-commit
mailing list