Skip to content

Instantly share code, notes, and snippets.

@ssorj
Last active October 20, 2018 20:40
Show Gist options
  • Save ssorj/7905237860157a65dba28d8f02ad24ff to your computer and use it in GitHub Desktop.
Save ssorj/7905237860157a65dba28d8f02ad24ff to your computer and use it in GitHub Desktop.
quiver-test -i test_arrow_qpid_proton_c --verbose
--
Tick! PN_DELIVERY
Tick! PN_TRANSPORT
Tick! PN_PROACTOR_TIMEOUT
Stopping!
calling pn_connection_close
stop() returning
quiver-arrow: Stopping process 8695 (/home/jross/code/quiver/build/quiver/impls/quiver-arrow-qpid-proton-c)
quiver-arrow: Error: Receiver timed out
--
Tick! PN_DELIVERY
Tick! PN_TRANSPORT
Tick! PN_PROACTOR_TIMEOUT
Stopping!
calling pn_connection_close
stop() returning
Tick! PN_CONNECTION_LOCAL_CLOSE
Tick! PN_TRANSPORT
Tick! PN_TRANSPORT_HEAD_CLOSED
Tick! PN_DELIVERY
...
Tick! PN_DELIVERY
Tick! PN_CONNECTION_REMOTE_CLOSE
Tick! PN_TRANSPORT_TAIL_CLOSED
Tick! PN_TRANSPORT_CLOSED
Tick! PN_PROACTOR_INACTIVE
run() returning
--
diff --git a/impls/quiver-arrow-qpid-proton-c.c b/impls/quiver-arrow-qpid-proton-c.c
index e2f5405..12ace5e 100644
--- a/impls/quiver-arrow-qpid-proton-c.c
+++ b/impls/quiver-arrow-qpid-proton-c.c
@@ -99,13 +99,27 @@ void eprint(const char* fmt, ...) {
}
static void stop(struct arrow* a) {
+ if (a->operation == RECEIVE) {
+ eprint("Stopping!");
+ }
+
if (a->connection && pn_connection_state(a->connection) & PN_LOCAL_ACTIVE) {
+ if (a->operation == RECEIVE) {
+ eprint("calling pn_connection_close");
+ }
pn_connection_close(a->connection);
}
if (a->listener) {
+ if (a->operation == RECEIVE) {
+ eprint("calling pn_listener_close");
+ }
pn_listener_close(a->listener);
}
+
+ if (a->operation == RECEIVE) {
+ eprint("stop() returning");
+ }
}
static inline bool bytes_equal(const pn_bytes_t a, const pn_bytes_t b) {
@@ -377,6 +391,10 @@ static bool handle(struct arrow* a, pn_event_t* e) {
}
void run(struct arrow* a) {
+ if (a->operation == RECEIVE) {
+ eprint("Running!");
+ }
+
if (a->desired_duration > 0) {
pn_proactor_set_timeout(a->proactor, a->desired_duration * 1000);
}
@@ -386,13 +404,23 @@ void run(struct arrow* a) {
pn_event_t* e;
for (e = pn_event_batch_next(events); e; e = pn_event_batch_next(events)) {
+ if (a->operation == RECEIVE) {
+ eprint("Tick! %s", pn_event_type_name(pn_event_type(e)));
+ }
if (!handle(a, e)) {
+ if (a->operation == RECEIVE) {
+ eprint("run() returning");
+ }
return;
}
}
pn_proactor_done(a->proactor, events);
}
+
+ if (a->operation == RECEIVE) {
+ eprint("run() returning");
+ }
}
bool find_flag(const char* want, const char* flags) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment