MCPcopy Create free account
hub / github.com/SIPp/sipp / traffic_thread

Function traffic_thread

src/sipp.cpp:483–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481/* Send loop & traffic generation*/
482
483static void traffic_thread(int &rtp_errors, int &echo_errors)
484{
485 /* create the file */
486 char L_file_name[MAX_PATH];
487 sprintf(L_file_name, "%s_%ld_screen.log", scenario_file, (long) getpid());
488
489 update_clock_tick();
490
491 /* Arm the global timer if needed */
492 if (global_timeout > 0) {
493 signal(SIGALRM, timeout_alarm);
494 alarm(global_timeout / 1000);
495 }
496
497 // Dump (to create file on disk) and showing screen at the beginning even if
498 // the report period is not reached
499 stattask::report();
500 screentask::report(false);
501
502 while (1) {
503 scheduling_loops++;
504 update_clock_tick();
505
506 if (signalDump) {
507 /* Screen dumping in a file */
508 if (useScreenf == 1) {
509 print_screens();
510 } else {
511 /* If the -trace_screen option has not been set, */
512 /* create the file at this occasion */
513 rotate_screenf();
514 print_screens();
515 }
516
517 if (dumpInRtt) {
518 main_scenario->stats->dumpDataRtt();
519 }
520
521 signalDump = false;
522 }
523
524 while (sockets_pending_reset.begin() != sockets_pending_reset.end()) {
525 (*(sockets_pending_reset.begin()))->reset_connection();
526 sockets_pending_reset.erase(sockets_pending_reset.begin());
527 }
528
529 if (!quitting && (main_scenario->stats->GetStat(CStat::CPT_C_IncomingCallCreated) + main_scenario->stats->GetStat(CStat::CPT_C_OutgoingCallCreated)) >= stop_after) {
530 quitting = 1;
531 }
532 if (quitting) {
533 /* Quitting and no more opened calls, close all */
534 if ((quitting >= 11) || !main_scenario->stats->GetStat(CStat::CPT_C_CurrentCall)) {
535 /* We can have calls that do not count towards our open-call count (e.g., dead calls). */
536 abort_all_tasks();
537 rtp_errors = rtpstream_shutdown(main_scenario->fetchRtpTaskThreadIDs());
538 echo_errors = main_scenario->stats->getRtpEchoErrors();
539
540 /* Reverse order shutdown, because deleting reorders the

Callers 1

mainFunction · 0.85

Calls 15

update_clock_tickFunction · 0.85
print_screensFunction · 0.85
rotate_screenfFunction · 0.85
abort_all_tasksFunction · 0.85
rtpstream_shutdownFunction · 0.85
get_running_tasksFunction · 0.85
expire_paused_tasksFunction · 0.85
paused_tasks_countFunction · 0.85
dumpDataRttMethod · 0.80
reset_connectionMethod · 0.80
GetStatMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected