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

Function handle_receiver

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

Source from the content-addressed store, hash-verified

350}
351
352static void handle_receiver(app_data_t *app, pn_event_t *event) {
353 switch (pn_event_type(event)) {
354
355 case PN_CONNECTION_INIT: {
356 pn_connection_t *c = pn_event_connection(event);
357 pn_connection_set_container(c, app->container_id);
358 // pn_connection_open(c);
359 pn_session_t *s = pn_session(c);
360 pn_session_open(s);
361
362 pn_link_t *l = pn_receiver(s, "my_receiver");
363 pn_terminus_set_address(pn_link_source(l), "example");
364 pn_link_open(l);
365 } break;
366
367 case PN_LINK_REMOTE_OPEN: {
368 pn_link_t *l = pn_event_link(event);
369 pn_terminus_t *t = pn_link_target(l);
370 pn_terminus_t *rt = pn_link_remote_target(l);
371 pn_terminus_set_address(t, pn_terminus_get_address(rt));
372 pn_link_open(l);
373 if (pn_link_is_receiver(l)) {
374 pn_link_flow(l, app->credit_window);
375 }
376 break;
377 }
378
379 case PN_DELIVERY: {
380 /* A message has been received */
381 pn_link_t *link = NULL;
382 pn_delivery_t *dlv = pn_event_delivery(event);
383 if (pn_delivery_readable(dlv) && !pn_delivery_partial(dlv)) {
384 link = pn_delivery_link(dlv);
385 decode_message(dlv);
386 /* Accept the delivery */
387 pn_delivery_update(dlv, PN_ACCEPTED);
388 /* done with the delivery, move to the next and free it */
389 pn_link_advance(link);
390 pn_delivery_settle(dlv); /* dlv is now freed */
391 }
392 pn_link_flow(link, app->credit_window - pn_link_credit(link));
393 } break;
394
395 case PN_CONNECTION_REMOTE_OPEN:
396 pn_connection_open(pn_event_connection(event)); /* Complete the open */
397 break;
398
399 case PN_SESSION_REMOTE_OPEN:
400 pn_session_open(pn_event_session(event));
401 break;
402
403 case PN_TRANSPORT_ERROR:
404 check_condition(event, pn_transport_condition(pn_event_transport(event)));
405 pn_connection_close(pn_event_connection(event));
406 break;
407
408 case PN_CONNECTION_REMOTE_CLOSE:
409 check_condition(event,

Callers 2

BM_EstablishConnectionFunction · 0.85
BM_SendReceiveMessagesFunction · 0.85

Calls 15

pn_event_typeFunction · 0.85
pn_event_connectionFunction · 0.85
pn_sessionFunction · 0.85
pn_session_openFunction · 0.85
pn_link_sourceFunction · 0.85
pn_link_openFunction · 0.85
pn_event_linkFunction · 0.85
pn_link_targetFunction · 0.85
pn_link_remote_targetFunction · 0.85
pn_link_is_receiverFunction · 0.85
pn_link_flowFunction · 0.85
pn_event_deliveryFunction · 0.85

Tested by

no test coverage detected