Author: rhuijben
Date: Fri Nov 27 11:56:41 2015
New Revision: 1716854

URL: http://svn.apache.org/viewvc?rev=1716854&view=rev
Log:
Move the stop-writing handling (for ssl negotiate states) to the connections,
to avoid having to look at these in each protocol case.

* incoming.c
  (serf__process_client): Introduce here.

* outgoing.c
  (read_from_connection): Move from here...
  (process_connection): ... to here.

* protocols/http2_protocol.c
  (http2_outgoing_read,
   http2_incoming_read): Remove here.

Modified:
    serf/trunk/incoming.c
    serf/trunk/outgoing.c
    serf/trunk/protocols/http2_protocol.c

Modified: serf/trunk/incoming.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/incoming.c?rev=1716854&r1=1716853&r2=1716854&view=diff
==============================================================================
--- serf/trunk/incoming.c (original)
+++ serf/trunk/incoming.c Fri Nov 27 11:56:41 2015
@@ -429,6 +429,13 @@ apr_status_t serf__process_client(serf_i
     }
 
     if ((events & APR_POLLIN) != 0) {
+        /* If the stop_writing flag was set on the connection, reset it
+           now because there is some data to read. */
+        if (client->pump.stop_writing) {
+            client->pump.stop_writing = false;
+            serf_io__set_pollset_dirty(&client->io);
+        }
+
         status = client->perform_read(client);
         if (status) {
             return status;

Modified: serf/trunk/outgoing.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/outgoing.c?rev=1716854&r1=1716853&r2=1716854&view=diff
==============================================================================
--- serf/trunk/outgoing.c (original)
+++ serf/trunk/outgoing.c Fri Nov 27 11:56:41 2015
@@ -796,13 +796,6 @@ static apr_status_t read_from_connection
     apr_pool_t *tmppool;
     apr_status_t close_connection = APR_SUCCESS;
 
-    /* If the stop_writing flag was set on the connection, reset it now because
-       there is some data to read. */
-    if (conn->pump.stop_writing) {
-        conn->pump.stop_writing = false;
-        serf_io__set_pollset_dirty(&conn->io);
-    }
-
     /* assert: request != NULL */
 
     if ((status = apr_pool_create(&tmppool, conn->pool)) != APR_SUCCESS)
@@ -1092,6 +1085,13 @@ static apr_status_t process_connection(s
     if ((events & APR_POLLIN) != 0
         && !conn->wait_for_connect) {
 
+        /* If the stop_writing flag was set on the connection, reset it now
+           because there is some data to read. */
+        if (conn->pump.stop_writing) {
+            conn->pump.stop_writing = false;
+            serf_io__set_pollset_dirty(&conn->io);
+        }
+
         if ((status = conn->perform_read(conn)) != APR_SUCCESS)
             return status;
 

Modified: serf/trunk/protocols/http2_protocol.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/protocols/http2_protocol.c?rev=1716854&r1=1716853&r2=1716854&view=diff
==============================================================================
--- serf/trunk/protocols/http2_protocol.c (original)
+++ serf/trunk/protocols/http2_protocol.c Fri Nov 27 11:56:41 2015
@@ -1648,14 +1648,6 @@ http2_outgoing_read(serf_connection_t *c
     serf_http2_protocol_t *h2 = conn->protocol_baton;
     apr_status_t status;
 
-    /* If the stop_writing flag was set on the connection, reset it now because
-       there is some data to read. */
-    if (conn->pump.stop_writing)
-    {
-        conn->pump.stop_writing = false;
-        serf_io__set_pollset_dirty(&conn->io);
-    }
-
     status = http2_process(h2);
 
     if (!status)
@@ -1750,14 +1742,6 @@ http2_incoming_read(serf_incoming_t *cli
     apr_status_t status;
     serf_http2_protocol_t *h2 = client->protocol_baton;
 
-    /* If the stop_writing flag was set on the connection, reset it now because
-    there is some data to read. */
-    if (client->pump.stop_writing)
-    {
-        client->pump.stop_writing = false;
-        serf_io__set_pollset_dirty(&client->io);
-    }
-
     if (h2->prefix_left) {
         serf_bucket_t *stream;
 


Reply via email to