Author: rhuijben
Date: Sun Nov 29 00:05:37 2015
New Revision: 1717014

URL: http://svn.apache.org/viewvc?rev=1717014&view=rev
Log:
* outgoing.c
  (reset_connection,
   serf_connection_close): Only call pre_teardown if the protocol baton is set.

Modified:
    serf/trunk/outgoing.c
    serf/trunk/test/test_internal.c

Modified: serf/trunk/outgoing.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/outgoing.c?rev=1717014&r1=1717013&r2=1717014&view=diff
==============================================================================
--- serf/trunk/outgoing.c (original)
+++ serf/trunk/outgoing.c Sun Nov 29 00:05:37 2015
@@ -492,7 +492,7 @@ static apr_status_t reset_connection(ser
 
     serf__connection_pre_cleanup(conn);
 
-    if (conn->perform_pre_teardown)
+    if (conn->protocol_baton && conn->perform_pre_teardown)
         conn->perform_pre_teardown(conn);
 
     /* First, cancel all written requests for which we haven't received a
@@ -1364,7 +1364,7 @@ apr_status_t serf_connection_close(
                requests as fully written, allowing more efficient cleanup */
             serf__connection_pre_cleanup(conn);
 
-            if (conn->perform_pre_teardown)
+            if (conn->protocol_baton && conn->perform_pre_teardown)
                 conn->perform_pre_teardown(conn);
 
             /* The application asked to close the connection, no need to notify

Modified: serf/trunk/test/test_internal.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/test/test_internal.c?rev=1717014&r1=1717013&r2=1717014&view=diff
==============================================================================
--- serf/trunk/test/test_internal.c (original)
+++ serf/trunk/test/test_internal.c Sun Nov 29 00:05:37 2015
@@ -54,7 +54,7 @@ static void test_config_store_per_contex
     /* We don't have a serf connection yet, so only the per context config
        should be available to read and write */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_ctx_config(ctx, &cfg, 
tb->pool));
+                      serf__config_store_create_ctx_config(ctx, &cfg));
     CuAssertPtrEquals(tc, NULL, cfg->per_conn);
     CuAssertPtrEquals(tc, NULL, cfg->per_host);
     CuAssertPtrNotNull(tc, cfg->per_context);
@@ -119,15 +119,13 @@ static void test_config_store_per_connec
     /* Test 1: This should return a config object with per_context, per_host 
and
        per_connection hash_table's initialized. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn1, &cfg1,
-                                                            tb->pool));
+                      serf__config_store_create_conn_config(conn1, &cfg1));
     CuAssertPtrNotNull(tc, cfg1->per_context);
     CuAssertPtrNotNull(tc, cfg1->per_host);
     CuAssertPtrNotNull(tc, cfg1->per_conn);
     /* Get a config object for the other connection also. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn2, &cfg2,
-                                                            tb->pool));
+                      serf__config_store_create_conn_config(conn2, &cfg2));
 
     /* Test 2: Get a non-existing per connection key, value should be NULL */
     CuAssertIntEquals(tc, APR_SUCCESS,
@@ -182,15 +180,13 @@ static void test_config_store_per_connec
     /* Test 1: This should return a config object with per_context, per_host 
and
      per_connection hash_table's initialized. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn1, &cfg1,
-                                                            tb->pool));
+                      serf__config_store_create_conn_config(conn1, &cfg1));
     CuAssertPtrNotNull(tc, cfg1->per_context);
     CuAssertPtrNotNull(tc, cfg1->per_host);
     CuAssertPtrNotNull(tc, cfg1->per_conn);
     /* Get a config object for the other connection also. */
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn2, &cfg2,
-                                                            tb->pool));
+                      serf__config_store_create_conn_config(conn2, &cfg2));
 
     /* Test 2: Get a non-existing per connection key, value should be NULL */
     CuAssertIntEquals(tc, APR_SUCCESS,
@@ -236,8 +232,7 @@ static void test_config_store_error_hand
     serf_context_t *ctx = serf_context_create(tb->pool);
 
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_ctx_config(ctx, &cfg,
-                                                           tb->pool));
+                      serf__config_store_create_ctx_config(ctx, &cfg));
 
     /* Config only has per-context keys, check for no crashes when getting
        per-connection and per-host keys. */
@@ -282,8 +277,7 @@ static void test_config_store_remove_obj
                             conn_closed, NULL, tb->pool);
 
     CuAssertIntEquals(tc, APR_SUCCESS,
-                      serf__config_store_create_conn_config(conn, &cfg,
-                                                            tb->pool));
+                      serf__config_store_create_conn_config(conn, &cfg));
 
     /* Add and remove a key per-context */
     CuAssertIntEquals(tc, APR_SUCCESS,


Reply via email to