| 551 | |
| 552 | |
| 553 | int |
| 554 | iperf_client_end(struct iperf_test *test) |
| 555 | { |
| 556 | if (NULL == test) |
| 557 | { |
| 558 | iperf_err(NULL, "No test\n"); |
| 559 | return -1; |
| 560 | } |
| 561 | struct iperf_stream *sp; |
| 562 | |
| 563 | /* Close all stream sockets */ |
| 564 | SLIST_FOREACH(sp, &test->streams, streams) { |
| 565 | close(sp->socket); |
| 566 | } |
| 567 | |
| 568 | /* show final summary */ |
| 569 | test->reporter_callback(test); |
| 570 | |
| 571 | /* Send response only if no error in server */ |
| 572 | if (test->state > 0) { |
| 573 | if (iperf_set_send_state(test, IPERF_DONE) != 0) |
| 574 | return -1; |
| 575 | } |
| 576 | |
| 577 | /* Close control socket */ |
| 578 | if (test->ctrl_sck >= 0) { |
| 579 | // Make sure all control messages are received by the server before the socket is closed |
| 580 | iperf_sync_close_socket(test->ctrl_sck); |
| 581 | } |
| 582 | |
| 583 | return 0; |
| 584 | } |
| 585 | |
| 586 | |
| 587 | int |
no test coverage detected
searching dependent graphs…