@@ -515,17 +515,14 @@ static void close_connection_XSIDE_IO(tcplite_connection_t *conn, bool no_delay)
515
515
516
516
free (conn -> reply_to );
517
517
518
- qd_message_activation_t activation ;
519
- activation .type = QD_ACTIVATION_NONE ;
520
- activation .delivery = 0 ;
521
- qd_nullify_safe_ptr (& activation .safeptr );
522
-
523
518
if (!!conn -> inbound_stream ) {
524
- qd_message_set_producer_activation (conn -> inbound_stream , & activation );
519
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel producer activation" , DLV_ARGS (conn -> inbound_delivery ));
520
+ qd_message_cancel_producer_activation (conn -> inbound_stream );
525
521
}
526
522
527
523
if (!!conn -> outbound_stream ) {
528
- qd_message_set_consumer_activation (conn -> outbound_stream , & activation );
524
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel consuer activation" , DLV_ARGS (conn -> outbound_delivery ));
525
+ qd_message_cancel_consumer_activation (conn -> outbound_stream );
529
526
}
530
527
531
528
if (!!conn -> inbound_delivery ) {
@@ -890,6 +887,17 @@ static void link_setup_CSIDE_IO(tcplite_connection_t *conn, qdr_delivery_t *deli
890
887
qdr_link_set_context (conn -> inbound_link , conn );
891
888
conn -> outbound_link = qdr_link_first_attach (conn -> core_conn , QD_OUTGOING , qdr_terminus (0 ), qdr_terminus (0 ), "tcp.cside.out" , 0 , false, delivery , & conn -> outbound_link_id );
892
889
qdr_link_set_context (conn -> outbound_link , conn );
890
+
891
+ // now that the raw connection is up and able to be activated enable cutthrough activation
892
+
893
+ assert (conn -> outbound_stream );
894
+ qd_message_activation_t activation ;
895
+ activation .type = QD_ACTIVATION_TCP ;
896
+ activation .delivery = 0 ;
897
+ qd_alloc_set_safe_ptr (& activation .safeptr , conn );
898
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP enabling consumer activation" , DLV_ARGS (delivery ));
899
+ qd_message_set_consumer_activation (conn -> outbound_stream , & activation );
900
+ qd_message_start_unicast_cutthrough (conn -> outbound_stream );
893
901
}
894
902
895
903
@@ -956,6 +964,7 @@ static bool try_compose_and_send_client_stream_LSIDE_IO(tcplite_connection_t *co
956
964
activation .type = QD_ACTIVATION_TCP ;
957
965
activation .delivery = 0 ;
958
966
qd_alloc_set_safe_ptr (& activation .safeptr , conn );
967
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , "[C%" PRIu64 "][L%" PRIu64 "] TCP enabling producer activation" , conn -> conn_id , conn -> inbound_link_id );
959
968
qd_message_set_producer_activation (conn -> inbound_stream , & activation );
960
969
qd_message_start_unicast_cutthrough (conn -> inbound_stream );
961
970
@@ -1022,6 +1031,7 @@ static void compose_and_send_server_stream_CSIDE_IO(tcplite_connection_t *conn)
1022
1031
activation .type = QD_ACTIVATION_TCP ;
1023
1032
activation .delivery = 0 ;
1024
1033
qd_alloc_set_safe_ptr (& activation .safeptr , conn );
1034
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , "[C%" PRIu64 "][L%" PRIu64 "] TCP enabling producer activation" , conn -> conn_id , conn -> inbound_link_id );
1025
1035
qd_message_set_producer_activation (conn -> inbound_stream , & activation );
1026
1036
qd_message_start_unicast_cutthrough (conn -> inbound_stream );
1027
1037
@@ -1092,6 +1102,7 @@ static uint64_t handle_outbound_delivery_LSIDE_IO(tcplite_connection_t *conn, qd
1092
1102
activation .type = QD_ACTIVATION_TCP ;
1093
1103
activation .delivery = 0 ;
1094
1104
qd_alloc_set_safe_ptr (& activation .safeptr , conn );
1105
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP enabling consumer activation" , DLV_ARGS (delivery ));
1095
1106
qd_message_set_consumer_activation (conn -> outbound_stream , & activation );
1096
1107
qd_message_start_unicast_cutthrough (conn -> outbound_stream );
1097
1108
}
@@ -1196,16 +1207,6 @@ static uint64_t handle_first_outbound_delivery_CSIDE(tcplite_connector_t *cr, qd
1196
1207
conn -> raw_conn = pn_raw_connection ();
1197
1208
pn_raw_connection_set_context (conn -> raw_conn , & conn -> context );
1198
1209
1199
- //
1200
- // Message validation ensures the start of the message body is present. Activate cutthrough on the body data.
1201
- //
1202
- qd_message_activation_t activation ;
1203
- activation .type = QD_ACTIVATION_TCP ;
1204
- activation .delivery = 0 ;
1205
- qd_alloc_set_safe_ptr (& activation .safeptr , conn );
1206
- qd_message_set_consumer_activation (conn -> outbound_stream , & activation );
1207
- qd_message_start_unicast_cutthrough (conn -> outbound_stream );
1208
-
1209
1210
//
1210
1211
// The raw connection establishment must be the last thing done in this function.
1211
1212
// After this call, a separate IO thread may immediately be invoked in the context
@@ -1289,9 +1290,11 @@ static bool manage_flow_XSIDE_IO(tcplite_connection_t *conn)
1289
1290
if (pn_raw_connection_is_read_closed (conn -> raw_conn ) && !blocked ) {
1290
1291
qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , "[C%" PRIu64 "] Read-closed - close inbound delivery" , conn -> conn_id );
1291
1292
qd_message_set_receive_complete (conn -> inbound_stream );
1293
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel producer activation" , DLV_ARGS (conn -> inbound_delivery ));
1294
+ qd_message_cancel_producer_activation (conn -> inbound_stream );
1292
1295
qdr_delivery_continue (tcplite_context -> core , conn -> inbound_delivery , false);
1293
1296
qdr_delivery_set_context (conn -> inbound_delivery , 0 );
1294
- qdr_delivery_decref (tcplite_context -> core , conn -> inbound_delivery , "TCP_LSIDE_IO - read-close " );
1297
+ qdr_delivery_decref (tcplite_context -> core , conn -> inbound_delivery , "FLOW_XSIDE_IO - inbound_delivery released " );
1295
1298
conn -> inbound_delivery = 0 ;
1296
1299
conn -> inbound_stream = 0 ;
1297
1300
return true;
@@ -1360,8 +1363,12 @@ static bool manage_flow_XSIDE_IO(tcplite_connection_t *conn)
1360
1363
if (qd_message_receive_complete (conn -> outbound_stream ) && !qd_message_can_consume_buffers (conn -> outbound_stream )) {
1361
1364
qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , "[C%" PRIu64 "] Rx-complete, rings empty: Write-closing the raw connection" , conn -> conn_id );
1362
1365
pn_raw_connection_write_close (conn -> raw_conn );
1366
+ qd_message_set_send_complete (conn -> outbound_stream );
1367
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel consumer activation" , DLV_ARGS (conn -> outbound_delivery ));
1368
+ qd_message_cancel_consumer_activation (conn -> outbound_stream );
1363
1369
qdr_delivery_set_context (conn -> outbound_delivery , 0 );
1364
1370
qdr_delivery_remote_state_updated (tcplite_context -> core , conn -> outbound_delivery , PN_ACCEPTED , true, 0 , true); // accepted, settled, ref_given
1371
+ // do NOT decref outbound_delivery - ref count passed to qdr_delivery_remote_state_updated()!
1365
1372
conn -> outbound_delivery = 0 ;
1366
1373
conn -> outbound_stream = 0 ;
1367
1374
} else {
@@ -1532,15 +1539,11 @@ static bool manage_tls_flow_XSIDE_IO(tcplite_connection_t *conn)
1532
1539
//
1533
1540
bool ignore ;
1534
1541
if (qd_tls_is_input_drained (conn -> tls , & ignore ) && conn -> inbound_stream ) {
1535
- qd_message_activation_t activation ;
1536
- activation .type = QD_ACTIVATION_NONE ;
1537
- activation .delivery = 0 ;
1538
- qd_nullify_safe_ptr (& activation .safeptr );
1539
-
1540
1542
qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TLS inbound stream receive complete" , DLV_ARGS (conn -> inbound_delivery ));
1541
1543
1542
1544
qd_message_set_receive_complete (conn -> inbound_stream );
1543
- qd_message_set_producer_activation (conn -> inbound_stream , & activation );
1545
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel producer activation" , DLV_ARGS (conn -> inbound_delivery ));
1546
+ qd_message_cancel_producer_activation (conn -> inbound_stream );
1544
1547
1545
1548
qdr_delivery_set_context (conn -> inbound_delivery , 0 );
1546
1549
qdr_delivery_continue (tcplite_context -> core , conn -> inbound_delivery , false);
@@ -1553,21 +1556,17 @@ static bool manage_tls_flow_XSIDE_IO(tcplite_connection_t *conn)
1553
1556
// Check for end of outbound message data
1554
1557
//
1555
1558
if (qd_tls_is_output_flushed (conn -> tls ) && conn -> outbound_stream ) {
1556
- qd_message_activation_t activation ;
1557
- activation .type = QD_ACTIVATION_NONE ;
1558
- activation .delivery = 0 ;
1559
- qd_nullify_safe_ptr (& activation .safeptr );
1560
-
1561
1559
qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TLS outbound stream send complete" , DLV_ARGS (conn -> outbound_delivery ));
1562
1560
1563
1561
qd_message_set_send_complete (conn -> outbound_stream );
1564
- qd_message_set_consumer_activation (conn -> outbound_stream , & activation );
1562
+ qd_log (LOG_TCP_ADAPTOR , QD_LOG_DEBUG , DLV_FMT " TCP cancel consumer activation" , DLV_ARGS (conn -> outbound_delivery ));
1563
+ qd_message_cancel_consumer_activation (conn -> outbound_stream );
1565
1564
1566
1565
qdr_delivery_set_context (conn -> outbound_delivery , 0 );
1567
1566
qdr_delivery_remote_state_updated (tcplite_context -> core , conn -> outbound_delivery ,
1568
1567
tls_status < 0 ? PN_MODIFIED : PN_ACCEPTED ,
1569
- true, 0 , false ); // settled, 0, ref_given
1570
- qdr_delivery_decref ( tcplite_context -> core , conn -> outbound_delivery , "TLS_FLOW_XSIDE_IO - outbound_delivery released" );
1568
+ true, 0 , true ); // settled, 0, ref_given
1569
+ // do NOT decref outbound_delivery - ref count passed to qdr_delivery_remote_state_updated()!
1571
1570
conn -> outbound_delivery = 0 ;
1572
1571
conn -> outbound_stream = 0 ;
1573
1572
}
0 commit comments