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,11 +417,12 @@ 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,8 +444,8 @@ 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) {
@ -453,13 +454,16 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
return ERR_OK; return ERR_OK;
} }
} }
}
} else { } else {
if (conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) {
if (pbuf_memcmp(p, 0, &conn->settings, sizeof(lwiperf_settings_t)) != 0) { if (pbuf_memcmp(p, 0, &conn->settings, sizeof(lwiperf_settings_t)) != 0) {
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR); lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR);
pbuf_free(p); pbuf_free(p);
return ERR_OK; return ERR_OK;
} }
} }
}
conn->bytes_transferred += sizeof(lwiperf_settings_t); conn->bytes_transferred += sizeof(lwiperf_settings_t);
if (conn->bytes_transferred <= 24) { if (conn->bytes_transferred <= 24) {
conn->time_started = sys_now(); conn->time_started = sys_now();