MCPcopy Create free account
hub / github.com/apache/qpid-proton / shovel

Function shovel

c/benchmarks/connection-driver.cpp:446–466  ·  view source on GitHub ↗

Copies output from first connection driver into input of the second. */

Source from the content-addressed store, hash-verified

444
445///* Copies output from first connection driver into input of the second. */
446static void shovel(pn_connection_driver_t &sender, pn_connection_driver_t &receiver) {
447 pn_bytes_t wbuf = pn_connection_driver_write_buffer(&receiver);
448 if (wbuf.size == 0) {
449 pn_connection_driver_write_done(&receiver, 0);
450 return;
451 }
452
453 pn_rwbytes_t rbuf = pn_connection_driver_read_buffer(&sender);
454 if (rbuf.start == NULL) {
455 printf("shovel: rbuf.start is null\n");
456 fflush(stdout);
457 fflush(stderr);
458 exit(1);
459 }
460
461 size_t s = rbuf.size < wbuf.size ? rbuf.size : wbuf.size;
462 memcpy(rbuf.start, wbuf.start, s);
463
464 pn_connection_driver_read_done(&sender, s);
465 pn_connection_driver_write_done(&receiver, s);
466}
467
468static void decode_message(pn_delivery_t *dlv) {
469 static char buffer[MAX_SIZE];

Callers 2

BM_EstablishConnectionFunction · 0.85
BM_SendReceiveMessagesFunction · 0.85

Calls 5

exitFunction · 0.85

Tested by

no test coverage detected