SOURCES: tpop3d-poll-indexing.patch - one more update

arekm arekm at pld-linux.org
Sat Jul 12 15:52:14 CEST 2008


Author: arekm                        Date: Sat Jul 12 13:52:14 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- one more update

---- Files affected:
SOURCES:
   tpop3d-poll-indexing.patch (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/tpop3d-poll-indexing.patch
diff -u SOURCES/tpop3d-poll-indexing.patch:1.2 SOURCES/tpop3d-poll-indexing.patch:1.3
--- SOURCES/tpop3d-poll-indexing.patch:1.2	Sat Jul 12 11:14:19 2008
+++ SOURCES/tpop3d-poll-indexing.patch	Sat Jul 12 15:52:08 2008
@@ -1,28 +1,5 @@
-diff --git a/connection.c b/connection.c
-index f552cb9..8951ff5 100644
---- a/connection.c
-+++ b/connection.c
-@@ -105,7 +105,7 @@ static char *make_timestamp(const char *domain) {
- 
- /* connection_new:
-  * Create a connection object from a socket. */
--connection connection_new(int s, const struct sockaddr_in *sin, listener L) {
-+connection connection_new(int s, const struct sockaddr_in *sin, listener L, int *pfds_n) {
-     int n;
-     connection c = NULL;
- 
-@@ -114,6 +114,9 @@ connection connection_new(int s, const struct sockaddr_in *sin, listener L) {
-     c->s = s;
-     c->sin = *sin;
- 
-+    (*pfds_n)++;
-+    c->s_index = *pfds_n;
-+
-     n = sizeof(c->sin_local);
-     if (getsockname(s, (struct sockaddr*)&(c->sin_local), &n) < 0) {
-         log_print(LOG_WARNING, "connection_new: getsockname: %m");
 diff --git a/connection.h b/connection.h
-index 74dd413..4a5e12c 100644
+index 74dd413..f6619a0 100644
 --- a/connection.h
 +++ b/connection.h
 @@ -48,6 +48,7 @@ struct ioabs;
@@ -33,17 +10,8 @@
      struct sockaddr_in sin; /* name of peer                     */
      char *remote_ip;        /* ASCII remote IP address          */
      struct sockaddr_in sin_local; /* name of local side         */
-@@ -165,7 +166,7 @@ typedef struct _pop3command {
- } *pop3command;
- 
- /* Create/destroy connections */
--connection connection_new(int s, const struct sockaddr_in *sin, listener L);
-+connection connection_new(int s, const struct sockaddr_in *sin, listener L, int *pfds_n);
- void connection_delete(connection c);
- 
- /* Read data out of the socket into the buffer */
 diff --git a/ioabs_tcp.c b/ioabs_tcp.c
-index 36d87d0..50f0250 100644
+index 36d87d0..69fc5ff 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) {
@@ -52,6 +20,9 @@
  
 -    pfds[c->s].fd = c->s;
 -    pfds[c->s].events |= POLLIN;
++    (*n)++;
++    c->s_index = *n;
++
 +    pfds[c->s_index].fd = c->s;
 +    pfds[c->s_index].events |= POLLIN;
      if (buffer_available(c->wrb) > 0)
@@ -60,9 +31,6 @@
 -    if (c->s > *n)
 -        *n = c->s;
 +       pfds[c->s_index].events |= POLLOUT;
-+
-+    if (c->s_index > *n)
-+       *n = c->s_index;
  }
  
  /* ioabs_tcp_post_select:
@@ -85,7 +53,7 @@
          n = 1;
          do {
 diff --git a/ioabs_tls.c b/ioabs_tls.c
-index 98ac7b7..1d77764 100644
+index 98ac7b7..dc47a7d 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) {
@@ -94,18 +62,19 @@
  
 -    pfds[c->s].fd = c->s;
 -    pfds[c->s].events |= POLLIN; /* always want to read */
++    (*n)++;
++    c->s_index = *n;
++
 +    pfds[c->s_index].fd = c->s;
 +    pfds[c->s_index].events |= POLLIN; /* always want to read */
      if (!io->write_blocked_on_read &&
          (buffer_available(c->wrb) > 0 || io->accept_blocked_on_write
           || io->read_blocked_on_write || io->shutdown_blocked_on_write))
 -        pfds[c->s].events |= POLLOUT;
-+        pfds[c->s_index].events |= POLLOUT;
- 
+-
 -    if (c->s > *n)
 -        *n = c->s;
-+    if (c->s_index > *n)
-+        *n = c->s_index;
++        pfds[c->s_index].events |= POLLOUT;
  }
  
  /* ioabs_tls_post_select:
@@ -133,7 +102,7 @@
  
  /* the arguments of the constructor vary according to the particular
 diff --git a/netloop.c b/netloop.c
-index f39018b..df93b3a 100644
+index f39018b..e02f3e8 100644
 --- a/netloop.c
 +++ b/netloop.c
 @@ -121,23 +121,26 @@ static void remove_connection(connection c) {
@@ -168,15 +137,6 @@
              struct sockaddr_in sin, sinlocal;
              size_t l = sizeof(sin);
              static int tcp_send_buf = -1;
-@@ -190,7 +193,7 @@ static void listeners_post_select(struct pollfd *pfds) {
-                         log_print(LOG_WARNING, _("listeners_post_select: rejected connection from %s to local address %s:%d owing to high load"), inet_ntoa(sin.sin_addr), inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));
-                     } else {
-                         /* Create connection object. */
--                        if ((*J = connection_new(s, &sin, L)))
-+                        if ((*J = connection_new(s, &sin, L, n)))
-                             log_print(LOG_INFO, _("listeners_post_select: client %s: connected to local address %s:%d"), (*J)->idstr, inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));
-                         else
-                             /* This could be really bad, but all we can do is log the failure. */
 @@ -549,6 +552,8 @@ void net_loop(void) {
      extern int child_died_signal;
      sigset_t chmask;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/tpop3d-poll-indexing.patch?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list