Allow API client to provide an fd for the client-side control socket.

This commit is contained in:
Jef Poskanzer 2012-12-13 09:37:55 -08:00
parent 5cd3317d98
commit d7613a8e9f
14 changed files with 17 additions and 12 deletions

View File

@ -79,6 +79,12 @@ void warning(char *str)
/************** Getter routines for some fields inside iperf_test *************/
int
iperf_get_control_socket( struct iperf_test* ipt )
{
return ipt->ctrl_sck;
}
int
iperf_get_test_duration( struct iperf_test* ipt )
{
@ -147,6 +153,12 @@ iperf_get_test_protocol_id( struct iperf_test* ipt )
/************** Setter routines for some fields inside iperf_test *************/
void
iperf_set_control_socket( struct iperf_test* ipt, int ctrl_sck )
{
ipt->ctrl_sck = ctrl_sck;
}
void
iperf_set_test_duration( struct iperf_test* ipt, int duration )
{

View File

@ -44,6 +44,7 @@ struct iperf_stream;
#define SERVER_ERROR (-2)
/* Getter routines for some fields inside iperf_test. */
int iperf_get_control_socket( struct iperf_test* ipt );
int iperf_get_test_duration( struct iperf_test* ipt );
char iperf_get_test_role( struct iperf_test* ipt );
int iperf_get_test_blksize( struct iperf_test* ipt );
@ -57,6 +58,7 @@ char* iperf_get_test_server_hostname( struct iperf_test* ipt );
int iperf_get_test_protocol_id( struct iperf_test* ipt );
/* Setter routines for some fields inside iperf_test. */
void iperf_set_control_socket( struct iperf_test* ipt, int ctrl_sck );
void iperf_set_test_duration( struct iperf_test* ipt, int duration );
void iperf_set_test_reporter_interval( struct iperf_test* ipt, double reporter_interval );
void iperf_set_test_stats_interval( struct iperf_test* ipt, double stats_interval );

View File

@ -136,7 +136,8 @@ iperf_connect(struct iperf_test *test)
make_cookie(test->cookie);
/* Create and connect the control channel */
test->ctrl_sck = netdial(test->settings->domain, Ptcp, test->bind_address, test->server_hostname, test->server_port);
if (test->ctrl_sck < 0)
test->ctrl_sck = netdial(test->settings->domain, Ptcp, test->bind_address, test->server_hostname, test->server_port);
if (test->ctrl_sck < 0) {
i_errno = IECONNECT;
return -1;

View File

@ -487,4 +487,3 @@ iperf_error(char *estr)
}
*/

View File

@ -272,4 +272,3 @@ iperf_tcp_connect(struct iperf_test *test)
return s;
}

View File

@ -44,4 +44,3 @@ int iperf_tcp_connect(struct iperf_test *);
#endif

View File

@ -45,4 +45,3 @@ int iperf_udp_init(struct iperf_test *);
#endif

View File

@ -346,4 +346,3 @@ const char warn_invalid_report[] =
#ifdef __cplusplus
} /* end extern "C" */
#endif

View File

@ -139,4 +139,3 @@ iperf_run(struct iperf_test * test)
return 0;
}

View File

@ -280,4 +280,3 @@ setnonblocking(int sock)
}
return 0;
}

View File

@ -49,4 +49,3 @@ unsigned long long ntohll(unsigned long long);
#define ntohll(n) NTOHLL(n)
#endif

View File

@ -144,4 +144,3 @@ build_tcpinfo_message(struct iperf_interval_results *r, char *message)
r->tcpInfo.tcpi_rcv_space, r->tcpInfo.tcpi_snd_ssthresh, r->tcpInfo.tcpi_rtt);
#endif
}

View File

@ -122,4 +122,3 @@ get_tcp_windowsize(int sock, int dir)
return bufsize;
}

View File

@ -8,4 +8,4 @@
*/
#define IPERF_VERSION "3.0-BETA5"
#define IPERF_VERSION_DATE "13 Nov 2012"
#define IPERF_VERSION_DATE "13 Dec 2012"