MCPcopy Create free account
hub / github.com/esnet/iperf / iperf_run_server

Function iperf_run_server

src/iperf_server_api.c:555–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553
554
555int
556iperf_run_server(struct iperf_test *test)
557{
558 int result, s;
559 int send_streams_accepted, rec_streams_accepted;
560 int streams_to_send = 0, streams_to_rec = 0;
561#if defined(HAVE_TCP_CONGESTION)
562 int saved_errno;
563#endif /* HAVE_TCP_CONGESTION */
564 fd_set read_set, write_set;
565 struct iperf_stream *sp;
566 struct iperf_time now;
567 struct iperf_time last_receive_time;
568 struct iperf_time diff_time;
569 struct timeval* timeout;
570 struct timeval used_timeout;
571 iperf_size_t last_receive_blocks;
572 int flag;
573 int64_t t_usecs;
574 int64_t timeout_us;
575 int64_t rcv_timeout_us;
576 int32_t err;
577
578 if (test->logfile) {
579 if (iperf_open_logfile(test) < 0)
580 return -2;
581 }
582
583 if (test->affinity != -1) {
584 if (iperf_setaffinity(test, test->affinity) != 0) {
585 cleanup_server(test);
586 return -2;
587 }
588 }
589
590 if (test->json_output) {
591 if (iperf_json_start(test) < 0) {
592 cleanup_server(test);
593 return -2;
594 }
595 }
596
597 if (test->json_output) {
598 cJSON_AddItemToObject(test->json_start, "version", cJSON_CreateString(version));
599 cJSON_AddItemToObject(test->json_start, "system_info", cJSON_CreateString(get_system_info()));
600 } else if (test->verbose) {
601 iperf_printf(test, "%s\n", version);
602 iperf_printf(test, "%s", "");
603 iperf_printf(test, "%s\n", get_system_info());
604 iflush(test);
605 }
606
607 // Open socket and listen
608 if (iperf_server_listen(test) < 0) {
609 cleanup_server(test);
610 return -2;
611 }
612

Callers 2

runFunction · 0.85
mainFunction · 0.85

Calls 15

iperf_open_logfileFunction · 0.85
iperf_setaffinityFunction · 0.85
cleanup_serverFunction · 0.85
iperf_json_startFunction · 0.85
cJSON_AddItemToObjectFunction · 0.85
cJSON_CreateStringFunction · 0.85
get_system_infoFunction · 0.85
iperf_printfFunction · 0.85
iflushFunction · 0.85
iperf_server_listenFunction · 0.85
iperf_time_nowFunction · 0.85
iperf_set_test_stateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…