lwiperf: fix testing against iperf 2.0.10 (bug #52901)

This commit is contained in:
goldsimon 2018-01-17 20:54:16 +01:00
parent a7a8d9273c
commit a696b2b515

View File

@ -417,10 +417,11 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
} }
if (p == NULL) { if (p == NULL) {
/* connection closed -> test done */ /* connection closed -> test done */
if ((conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST | LWIPERF_FLAGS_ANSWER_NOW)) == if (conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) {
PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) { if ((conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_NOW)) == 0) {
/* client requested transmission after end of test */ /* client requested transmission after end of test */
lwiperf_tx_start(conn); lwiperf_tx_start(conn);
}
} }
lwiperf_tcp_close(conn, LWIPERF_TCP_DONE_SERVER); lwiperf_tcp_close(conn, LWIPERF_TCP_DONE_SERVER);
return ERR_OK; return ERR_OK;
@ -443,21 +444,24 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
return ERR_OK; return ERR_OK;
} }
conn->have_settings_buf = 1; conn->have_settings_buf = 1;
if ((conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST | LWIPERF_FLAGS_ANSWER_NOW)) == if (conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) {
PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST | LWIPERF_FLAGS_ANSWER_NOW)) { if (conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_NOW)) {
/* client requested parallel transmission test */ /* client requested parallel transmission test */
err_t err2 = lwiperf_tx_start(conn); err_t err2 = lwiperf_tx_start(conn);
if (err2 != ERR_OK) { if (err2 != ERR_OK) {
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_TXERROR); lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_TXERROR);
pbuf_free(p); pbuf_free(p);
return ERR_OK; return ERR_OK;
}
} }
} }
} else { } else {
if (pbuf_memcmp(p, 0, &conn->settings, sizeof(lwiperf_settings_t)) != 0) { if (conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) {
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR); if (pbuf_memcmp(p, 0, &conn->settings, sizeof(lwiperf_settings_t)) != 0) {
pbuf_free(p); lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR);
return ERR_OK; pbuf_free(p);
return ERR_OK;
}
} }
} }
conn->bytes_transferred += sizeof(lwiperf_settings_t); conn->bytes_transferred += sizeof(lwiperf_settings_t);