MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / dm_peer_loop

Function dm_peer_loop

modules/aaa_diameter/dm_peer.c:622–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620
621
622void dm_peer_loop(int _)
623{
624 struct dm_message *msg;
625
626 LM_INFO("freeDiameter dedicated process starting...\n");
627
628 if (freeDiameter_init() != 0) {
629 LM_ERR("failed to init freeDiameter library\n");
630 return;
631 }
632
633 __FD_CHECK(dm_register_osips_avps(), 0, );
634 __FD_CHECK(dm_init_sip_application(), 0, );
635 __FD_CHECK(dm_prepare_globals(), 0, );
636 __FD_CHECK(parse_extra_avps(extra_avps_file), 0, );
637
638 __FD_CHECK(dm_register_callbacks(), 0, );
639 __FD_CHECK(fd_core_start(), 0, );
640
641 if (dm_init_reply_cond(-2) != 0) {
642 LM_ERR("failed to init cond\n");
643 return;
644 }
645
646 pthread_mutex_lock(msg_send_lk);
647
648 for (;;) {
649 LM_DBG("waiting to send new messages...\n");
650 pthread_cond_wait(msg_send_cond, msg_send_lk);
651
652 if (list_empty(msg_send_queue)) {
653 LM_BUG("pthread cond signal on empty queue");
654 continue;
655 }
656
657 LM_DBG("have new message to send -- processing...\n");
658 msg = list_entry(msg_send_queue->next, struct dm_message, list);
659 list_del(&msg->list);
660
661 if (dm_peer_send_msg(msg) != 0)
662 LM_ERR("failed to send message\n");
663 else
664 LM_DBG("successfully sent\n");
665
666 _dm_destroy_message(msg->am);
667 }
668
669 pthread_mutex_unlock(msg_send_lk);
670
671 __FD_CHECK(fd_core_wait_shutdown_complete(), 0, );
672}

Callers

nothing calls this directly

Calls 12

freeDiameter_initFunction · 0.85
dm_register_osips_avpsFunction · 0.85
dm_init_sip_applicationFunction · 0.85
dm_prepare_globalsFunction · 0.85
parse_extra_avpsFunction · 0.85
dm_register_callbacksFunction · 0.85
dm_init_reply_condFunction · 0.85
list_emptyFunction · 0.85
list_delFunction · 0.85
dm_peer_send_msgFunction · 0.85
_dm_destroy_messageFunction · 0.85
list_entryClass · 0.50

Tested by

no test coverage detected