Remove "wants_reads" field from struct io_fd.
authorMichael Poole <mdpoole@troilus.org>
Fri, 6 Oct 2006 23:16:58 +0000 (23:16 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 6 Oct 2006 23:16:58 +0000 (23:16 +0000)
Everybody wants read information, so give it to them!

src/ioset-epoll.c (ioset_epoll_events): Make EPOLLIN unconditional.

src/ioset-impl.h (fd_wants_reads): Delete.

src/ioset-select.c (ioset_select_loop): Unconditionally set read bit for fd.

src/ioset.c (ioset_add): Add fd to engine after marking it non-blocking.
  (ioset_buffered_reads): Remove check for fd->wants_reads.

src/ioset.h (struct io_fd): Delete "wants_reads" field.

src/mod-qserver.c (qserver_readable): Add missing newline.
  (qserver_accept): Delete assignment to fd->wants_reads.

src/mod-sockcheck.c (sockcheck_connected): Delete assignment to
    fd->wants_reads.

src/proto-common.c (create_socket_client): Delete assignment to
    fd->wants_reads.
git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-56

ChangeLog
src/ioset-epoll.c
src/ioset-impl.h
src/ioset-select.c
src/ioset.c
src/ioset.h
src/mod-qserver.c
src/mod-sockcheck.c
src/proto-common.c

index c271b7fc0656a916c91ff28dbd9429929e514385..102e7941537c10d15583d7cf82e6a14c6c818e69 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,41 @@
 # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
 #
 
+2006-10-06 23:16:58 GMT        Michael Poole <mdpoole@troilus.org>     patch-56
+
+    Summary:
+      Remove "wants_reads" field from struct io_fd.
+    Revision:
+      srvx--devo--1.3--patch-56
+
+    Everybody wants read information, so give it to them!
+    
+    src/ioset-epoll.c (ioset_epoll_events): Make EPOLLIN unconditional.
+    
+    src/ioset-impl.h (fd_wants_reads): Delete.
+    
+    src/ioset-select.c (ioset_select_loop): Unconditionally set read bit for fd.
+    
+    src/ioset.c (ioset_add): Add fd to engine after marking it non-blocking.
+      (ioset_buffered_reads): Remove check for fd->wants_reads.
+    
+    src/ioset.h (struct io_fd): Delete "wants_reads" field.
+    
+    src/mod-qserver.c (qserver_readable): Add missing newline.
+      (qserver_accept): Delete assignment to fd->wants_reads.
+    
+    src/mod-sockcheck.c (sockcheck_connected): Delete assignment to
+        fd->wants_reads.
+    
+    src/proto-common.c (create_socket_client): Delete assignment to
+        fd->wants_reads.
+
+    modified files:
+     ChangeLog src/ioset-epoll.c src/ioset-impl.h
+     src/ioset-select.c src/ioset.c src/ioset.h src/mod-qserver.c
+     src/mod-sockcheck.c src/proto-common.c
+
+
 2006-10-06 23:12:20 GMT        Michael Poole <mdpoole@troilus.org>     patch-55
 
     Summary:
index 4e0589c364a705c288381d7add8aacd49ff173b6..a6b002eb4dec0e0c26e003c86fea5dd6b7b0c7a7 100644 (file)
@@ -46,7 +46,7 @@ static int
 ioset_epoll_events(struct io_fd *fd)
 {
     return EPOLLHUP
-        | (fd_wants_reads(fd) ? EPOLLIN : 0)
+        | EPOLLIN
         | (fd_wants_writes(fd) ? EPOLLOUT : 0)
         ;
 }
index d6b30455ff6dec381ce86a52d5be60501bc24437..a3c12ceebe99d01d84bc1183bf97f201d52a114d 100644 (file)
@@ -25,7 +25,6 @@
 
 struct timeval;
 
-#define fd_wants_reads(FD) ((FD)->wants_reads || (FD)->state == IO_LISTENING)
 #define fd_wants_writes(FD) (((FD)->send.get != (FD)->send.put) || (FD)->state == IO_CONNECTING)
 
 struct io_engine {
index d25738d906b8f14a2df4e0ed259afa34358a6faa..64afa0fd37dc89a7afb3094d2a3539da4a3925d3 100644 (file)
@@ -118,8 +118,7 @@ ioset_select_loop(struct timeval *timeout)
         if (!(fd = fds[nn]))
             continue;
         max_fd = nn;
-        if (fd_wants_reads(fd))
-            FD_SET(nn, &read_fds);
+        FD_SET(nn, &read_fds);
         if (fd_wants_writes(fd))
             FD_SET(nn, &write_fds);
     }
index 72204135e8388589bfc7094ca2ec2f9bf47e8eb0..6013232653b3839f3909361c97787651e2c32dbf 100644 (file)
@@ -142,9 +142,9 @@ ioset_add(int fd) {
     res->fd = fd;
     ioq_init(&res->send, 1024);
     ioq_init(&res->recv, 1024);
-    engine->add(res);
     flags = fcntl(fd, F_GETFL);
     fcntl(fd, F_SETFL, flags|O_NONBLOCK);
+    engine->add(res);
     return res;
 }
 
@@ -406,7 +406,7 @@ ioset_buffered_read(struct io_fd *fd) {
         if (fd->recv.put == fd->recv.size)
             fd->recv.put = 0;
         fdnum = fd->fd;
-        while (fd->wants_reads && (fd->line_len > 0)) {
+        while (fd->line_len > 0) {
             struct io_fd *old_active;
             int died = 0;
 
index 48e692453cc3a333d5bf653f016fbd977b374a24..36bb4ae177bcb58d9eefae34225a6b58e14e9cca 100644 (file)
@@ -35,7 +35,6 @@ struct io_fd {
     int fd;
     void *data;
     enum { IO_CLOSED, IO_LISTENING, IO_CONNECTING, IO_CONNECTED } state;
-    unsigned int wants_reads : 1;
     unsigned int line_reads : 1;
     int line_len;
     struct ioq send;
index 3eef51b383d364faade7aa17ab4ef51b57f0a753..ea67282ddcc57fc7107466daeeb96003c426a649 100644 (file)
@@ -89,7 +89,7 @@ qserver_readable(struct io_fd *fd)
         tmpline[--len] = '\0';
     argc = split_line(tmpline, false, ArrayLength(argv), argv);
     if (argc < 3) {
-        ioset_printf(fd, "MISSING_ARGS");
+        ioset_printf(fd, "MISSING_ARGS\n");
         return;
     }
     if (!strcmp(argv[1], "PASS")
@@ -134,7 +134,6 @@ qserver_accept(UNUSED_ARG(struct io_fd *listener), struct io_fd *fd)
 
     client = calloc(1, sizeof(*client));
     fd->data = client;
-    fd->wants_reads = 1;
     fd->line_reads = 1;
     fd->readable_cb = qserver_readable;
     fd->destroy_cb = qserver_destroy_fd;
index 8091c8a10222be03514a97df8f58f53107f3e302..a21aad9122e102276164f120f62723f7bb7ba3d0 100644 (file)
@@ -644,7 +644,6 @@ sockcheck_connected(struct io_fd *fd, int rc)
         return;
     case 0: break;
     }
-    fd->wants_reads = 1;
     if (SOCKCHECK_DEBUG) {
         log_module(PC_LOG, LOG_INFO, "Connected: to %s port %d.", client->addr->hostname, client->state->port);
     }
index 64a43d927739d4910941a7dd82c222f520e35f35..abb3a91cd74491dc560b70362e753f860d3efab4 100644 (file)
@@ -144,7 +144,6 @@ create_socket_client(struct uplinkNode *target)
     socket_io_fd->readable_cb = uplink_readable;
     socket_io_fd->destroy_cb = socket_destroyed;
     socket_io_fd->line_reads = 1;
-    socket_io_fd->wants_reads = 1;
     log_module(MAIN_LOG, LOG_INFO, "Connection to server established.");
     cManager.uplink = target;
     target->state = AUTHENTICATING;