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

Function iperf_handle_message_client

src/iperf_client_api.c:302–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302int
303iperf_handle_message_client(struct iperf_test *test)
304{
305 int rval;
306 int32_t err;
307
308 if (NULL == test)
309 {
310 iperf_err(NULL, "No test\n");
311 i_errno = IEINITTEST;
312 return -1;
313 }
314
315 if (test->debug_level >= DEBUG_LEVEL_INFO) {
316 iperf_printf(test, "Reading new State from the Server - current state is %d-%s\n", test->state, state_to_text(test->state));
317 }
318
319 /*!!! Why is this read() and not Nread()? */
320 if ((rval = read(test->ctrl_sck, (char*) &test->state, sizeof(signed char))) <= 0) {
321 if (rval == 0) {
322 i_errno = IECTRLCLOSE;
323 return -1;
324 } else {
325 i_errno = IERECVMESSAGE;
326 return -1;
327 }
328 }
329
330 if (test->debug_level >= DEBUG_LEVEL_INFO) {
331 iperf_printf(test, "State change: client received and changed State to %d-%s\n", test->state, state_to_text(test->state));
332 }
333
334 switch (test->state) {
335 case PARAM_EXCHANGE:
336 if (iperf_exchange_parameters(test) < 0)
337 return -1;
338 if (test->on_connect)
339 test->on_connect(test);
340 break;
341 case CREATE_STREAMS:
342 if (test->mode == BIDIRECTIONAL)
343 {
344 if (iperf_create_streams(test, 1) < 0)
345 return -1;
346 if (iperf_create_streams(test, 0) < 0)
347 return -1;
348 }
349 else if (iperf_create_streams(test, test->mode) < 0)
350 return -1;
351 break;
352 case TEST_START:
353 if (iperf_init_test(test) < 0)
354 return -1;
355 if (create_client_timers(test) < 0)
356 return -1;
357 if (create_client_omit_timer(test) < 0)
358 return -1;
359 if (test->mode)

Callers 1

iperf_run_clientFunction · 0.85

Calls 14

iperf_errFunction · 0.85
iperf_printfFunction · 0.85
state_to_textFunction · 0.85
iperf_create_streamsFunction · 0.85
iperf_init_testFunction · 0.85
create_client_timersFunction · 0.85
create_client_omit_timerFunction · 0.85
iperf_create_send_timersFunction · 0.85
iperf_exchange_resultsFunction · 0.85
iperf_client_endFunction · 0.85
cpu_utilFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…