1
1

Merge pull request #288 from yeahdongcn/master

Add tmp_path in order to make the template path workable on iOS.
Этот коммит содержится в:
Bruce A. Mah 2015-10-07 13:05:32 -07:00
родитель 156a5eb163 9a3775091b
Коммит ee306250d7
3 изменённых файлов: 26 добавлений и 1 удалений

1
src/iperf.h Обычный файл → Исполняемый файл
Просмотреть файл

@ -202,6 +202,7 @@ struct iperf_test
struct protocol *protocol;
signed char state;
char *server_hostname; /* -c option */
char *template; /* -c option */
char *bind_address; /* first -B option */
TAILQ_HEAD(xbind_addrhead, xbind_entry) xbind_addrs; /* all -X opts */
int bind_port; /* --cport option */

24
src/iperf_api.c Обычный файл → Исполняемый файл
Просмотреть файл

@ -210,6 +210,12 @@ iperf_get_test_server_hostname(struct iperf_test *ipt)
return ipt->server_hostname;
}
char*
iperf_get_test_template(struct iperf_test *ipt)
{
return ipt->template;
}
int
iperf_get_test_protocol_id(struct iperf_test *ipt)
{
@ -372,6 +378,12 @@ iperf_set_test_server_hostname(struct iperf_test *ipt, char *server_hostname)
ipt->server_hostname = strdup(server_hostname);
}
void
iperf_set_test_template(struct iperf_test *ipt, char *template)
{
ipt->template = strdup(template);
}
void
iperf_set_test_reverse(struct iperf_test *ipt, int reverse)
{
@ -1869,6 +1881,8 @@ iperf_free_test(struct iperf_test *test)
if (test->server_hostname)
free(test->server_hostname);
if (test->template)
free(test->template);
if (test->bind_address)
free(test->bind_address);
if (!TAILQ_EMPTY(&test->xbind_addrs)) {
@ -1883,6 +1897,7 @@ iperf_free_test(struct iperf_test *test)
free(xbe);
}
}
if (test->settings)
free(test->settings);
if (test->title)
free(test->title);
@ -2574,7 +2589,14 @@ iperf_new_stream(struct iperf_test *test, int s)
{
int i;
struct iperf_stream *sp;
char template[] = "/tmp/iperf3.XXXXXX";
char template[1024];
if (test->template) {
snprintf(template, strlen(test->template), "%s", test->template);
} else {
char buf[] = "/tmp/iperf3.XXXXXX";
snprintf(template, strlen(buf), "%s", buf);
}
h_errno = 0;

2
src/iperf_api.h Обычный файл → Исполняемый файл
Просмотреть файл

@ -88,6 +88,7 @@ double iperf_get_test_stats_interval( struct iperf_test* ipt );
int iperf_get_test_num_streams( struct iperf_test* ipt );
int iperf_get_test_server_port( struct iperf_test* ipt );
char* iperf_get_test_server_hostname( struct iperf_test* ipt );
char* iperf_get_test_template( struct iperf_test* ipt );
int iperf_get_test_protocol_id( struct iperf_test* ipt );
int iperf_get_test_json_output( struct iperf_test* ipt );
char* iperf_get_test_json_output_string ( struct iperf_test* ipt );
@ -113,6 +114,7 @@ void iperf_set_test_socket_bufsize( struct iperf_test* ipt, int socket_bufsize )
void iperf_set_test_num_streams( struct iperf_test* ipt, int num_streams );
void iperf_set_test_role( struct iperf_test* ipt, char role );
void iperf_set_test_server_hostname( struct iperf_test* ipt, char* server_hostname );
void iperf_set_test_template( struct iperf_test *ipt, char *template );
void iperf_set_test_reverse( struct iperf_test* ipt, int reverse );
void iperf_set_test_json_output( struct iperf_test* ipt, int json_output );
int iperf_has_zerocopy( void );