You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2023/03/30 16:58:31 UTC

[qpid-proton] branch main updated: PROTON-2700: Raw connections: Remove deprecated ambiguous use of READ/WRITTEN events

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/main by this push:
     new 7c591e876 PROTON-2700: Raw connections: Remove deprecated ambiguous use of READ/WRITTEN events
7c591e876 is described below

commit 7c591e876e23b50cd08b094daa6ab8c2fa31f44e
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Mon Jan 30 20:30:56 2023 -0500

    PROTON-2700: Raw connections: Remove deprecated ambiguous use of READ/WRITTEN events
    
    We added the DRAIN_BUFFERS event several releases ago to signal the
    application it should take back any buffers still owned by the raw
    connection when the conneciton is shutting down. It is now time to
    remove those ambiguous uses of the READ/WRITTEN events.
---
 c/src/proactor/raw_connection.c | 14 --------------
 c/tests/raw_connection_test.cpp | 22 +---------------------
 2 files changed, 1 insertion(+), 35 deletions(-)

diff --git a/c/src/proactor/raw_connection.c b/c/src/proactor/raw_connection.c
index fd633a284..3d8b976c6 100644
--- a/c/src/proactor/raw_connection.c
+++ b/c/src/proactor/raw_connection.c
@@ -701,21 +701,7 @@ pn_event_t *pni_raw_event_next(pn_raw_connection_t *conn) {
         }
         conn->disconnect_state = disc_drain_msg;
         break;
-      // TODO: We'll leave the read/written events in here for the moment for backward compatibility
-      // remove them soon (after dispatch uses DRAIN_BUFFER)
       case disc_drain_msg:
-        if (conn->rbuffer_first_read) {
-          pni_raw_put_event(conn, PN_RAW_CONNECTION_READ);
-        }
-        conn->disconnect_state = disc_read_msg;
-        break;
-      case disc_read_msg:
-        if (conn->wbuffer_first_written) {
-          pni_raw_put_event(conn, PN_RAW_CONNECTION_WRITTEN);
-        }
-        conn->disconnect_state = disc_written_msg;
-        break;
-      case disc_written_msg:
         pni_raw_put_event(conn, PN_RAW_CONNECTION_DISCONNECTED);
         conn->disconnectpending = false;
         conn->disconnect_state = disc_fini;
diff --git a/c/tests/raw_connection_test.cpp b/c/tests/raw_connection_test.cpp
index 0f31c4910..7378d7541 100644
--- a/c/tests/raw_connection_test.cpp
+++ b/c/tests/raw_connection_test.cpp
@@ -569,11 +569,9 @@ TEST_CASE("raw connection") {
       REQUIRE_FALSE(pni_raw_can_read(p));
       REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_CLOSED_WRITE);
       REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_DRAIN_BUFFERS);
-      REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_READ);
       rgiven = pn_raw_connection_take_read_buffers(p, &read[0], rtaken);
       REQUIRE(pni_raw_validate(p));
       CHECK(rgiven==rtaken);
-      REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_WRITTEN);
       wgiven = pn_raw_connection_take_written_buffers(p, &written[0], wtaken);
       REQUIRE(pni_raw_validate(p));
       CHECK(wgiven==wtaken);
@@ -633,27 +631,9 @@ TEST_CASE("raw connection") {
         REQUIRE(pni_raw_validate(p));
         CHECK(pn_raw_connection_is_write_closed(p));
         REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_CLOSED_WRITE);
-        // TODO: Remove  the inapplicable tests when the drain buffers completely replaces read/written
-        SECTION("Ensure get read/written events before disconnect if not drained") {
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_DRAIN_BUFFERS);
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_READ);
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_WRITTEN);
-        }
-        SECTION("Ensure no read/written events before disconnect if drained") {
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_DRAIN_BUFFERS);
-          while(pn_raw_connection_take_read_buffers(p, &read[0], read.size())>0);
-          while(pn_raw_connection_take_written_buffers(p, &written[0], written.size())>0);
-        }
-        SECTION("Ensure no written events before disconnect if write drained") {
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_DRAIN_BUFFERS);
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_READ);
-          while(pn_raw_connection_take_read_buffers(p, &read[0], read.size())>0);
-          while(pn_raw_connection_take_written_buffers(p, &written[0], written.size())>0);
-        }
-        SECTION("Ensure no read events before disconnect if read drained") {
+        SECTION("Ensure drain buffers event before disconnect if not drained") {
           REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_DRAIN_BUFFERS);
           while(pn_raw_connection_take_read_buffers(p, &read[0], read.size())>0);
-          REQUIRE(pn_event_type(pni_raw_event_next(p)) == PN_RAW_CONNECTION_WRITTEN);
           while(pn_raw_connection_take_written_buffers(p, &written[0], written.size())>0);
         }
         SECTION("Ensure no events before disconnect if already drained") {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org