| 300 | } |
| 301 | |
| 302 | int |
| 303 | iperf_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) |
no test coverage detected
searching dependent graphs…