TCP/TLS tests
This commit is contained in:
parent
6d4be6640e
commit
4235013950
@ -1,6 +1,7 @@
|
||||
10/13/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
10/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.2.1.3 'Monza':
|
||||
- Code cleaning.
|
||||
- TCP/TLS tests extended.
|
||||
|
||||
10/05/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.2.1.2 'Monza':
|
||||
|
||||
@ -75,6 +75,7 @@ typedef struct {
|
||||
char rsaddr[129];
|
||||
char ifname[129];
|
||||
ioa_addr peer_addr;
|
||||
ioa_addr relay_addr;
|
||||
ioa_socket_raw fd;
|
||||
SSL *ssl;
|
||||
int broken;
|
||||
|
||||
@ -456,21 +456,23 @@ static int clnet_allocate(int verbose,
|
||||
return -1;
|
||||
} else {
|
||||
if (verbose) {
|
||||
ioa_addr remote_addr;
|
||||
memcpy(&remote_addr, relay_addr,sizeof(ioa_addr));
|
||||
addr_debug_print(verbose, &remote_addr,"Received relay addr");
|
||||
ioa_addr raddr;
|
||||
memcpy(&raddr, relay_addr,sizeof(ioa_addr));
|
||||
addr_debug_print(verbose, &raddr,"Received relay addr");
|
||||
}
|
||||
|
||||
if(!addr_any(relay_addr)) {
|
||||
if(relay_addr->ss.sa_family == AF_INET) {
|
||||
if(default_address_family != STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY_VALUE_IPV6) {
|
||||
found = 1;
|
||||
addr_cpy(&(clnet_info->relay_addr),relay_addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(relay_addr->ss.sa_family == AF_INET6) {
|
||||
if(default_address_family == STUN_ATTRIBUTE_REQUESTED_ADDRESS_FAMILY_VALUE_IPV6) {
|
||||
found = 1;
|
||||
addr_cpy(&(clnet_info->relay_addr),relay_addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1535,7 +1537,7 @@ void tcp_data_connect(app_ur_session *elem, u32bits cid)
|
||||
|
||||
++elem->pinfo.tcp_conn_number;
|
||||
int i = (int)(elem->pinfo.tcp_conn_number-1);
|
||||
elem->pinfo.tcp_conn=(app_tcp_conn_info**)realloc(elem->pinfo.tcp_conn,elem->pinfo.tcp_conn_number*sizeof(app_tcp_conn_info*));
|
||||
elem->pinfo.tcp_conn=(app_tcp_conn_info**)turn_realloc(elem->pinfo.tcp_conn,0,elem->pinfo.tcp_conn_number*sizeof(app_tcp_conn_info*));
|
||||
elem->pinfo.tcp_conn[i]=(app_tcp_conn_info*)turn_malloc(sizeof(app_tcp_conn_info));
|
||||
ns_bzero(elem->pinfo.tcp_conn[i],sizeof(app_tcp_conn_info));
|
||||
|
||||
|
||||
@ -153,8 +153,10 @@ static void uc_delete_session_elem_data(app_ur_session* cdi) {
|
||||
}
|
||||
}
|
||||
cdi->pinfo.tcp_conn_number=0;
|
||||
turn_free(cdi->pinfo.tcp_conn, 111);
|
||||
cdi->pinfo.tcp_conn=NULL;
|
||||
if(cdi->pinfo.tcp_conn) {
|
||||
turn_free(cdi->pinfo.tcp_conn, 111);
|
||||
cdi->pinfo.tcp_conn=NULL;
|
||||
}
|
||||
}
|
||||
if(cdi->pinfo.ssl && !(cdi->pinfo.broken)) {
|
||||
if(!(SSL_get_shutdown(cdi->pinfo.ssl) & SSL_SENT_SHUTDOWN)) {
|
||||
@ -1294,9 +1296,12 @@ void start_mclient(const char *remote_address, int port,
|
||||
int connect_err = 0;
|
||||
socket_connect(elems[i]->pinfo.fd, &(elems[i]->pinfo.remote_addr), &connect_err);
|
||||
}
|
||||
} else if((i%2) == 0) {
|
||||
if (turn_tcp_connect(clnet_verbose, &(elems[i]->pinfo), &(elems[i]->pinfo.peer_addr)) < 0) {
|
||||
exit(-1);
|
||||
} else {
|
||||
int j = 0;
|
||||
for(j=i+1;j<total_clients;j++) {
|
||||
if (turn_tcp_connect(clnet_verbose, &(elems[i]->pinfo), &(elems[j]->pinfo.relay_addr)) < 0) {
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1328,18 +1333,22 @@ void start_mclient(const char *remote_address, int port,
|
||||
break;
|
||||
} else {
|
||||
for(i=0;i<total_clients;++i) {
|
||||
if(elems[i]->pinfo.tcp_conn_number>0 &&
|
||||
elems[i]->pinfo.tcp_conn[0]->tcp_data_bound) {
|
||||
completed += elems[i]->pinfo.tcp_conn_number;
|
||||
int j = 0;
|
||||
for(j=0;j<(int)elems[i]->pinfo.tcp_conn_number;j++) {
|
||||
if(elems[i]->pinfo.tcp_conn[j]->tcp_data_bound) {
|
||||
completed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(completed >= total_clients)
|
||||
if(completed >= total_clients*(total_clients-1)) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%d connections are completed\n",(int)(completed));
|
||||
break;
|
||||
}
|
||||
}
|
||||
run_events(0);
|
||||
if(current_time > connect_wait_start_time + STARTING_TCP_RELAY_TIME) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "WARNING: %d connections are not completed\n",
|
||||
(int)(total_clients - completed));
|
||||
if(current_time > connect_wait_start_time + STARTING_TCP_RELAY_TIME + total_clients) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "WARNING: %d connections are completed, not enough\n",
|
||||
(int)(completed));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,8 +43,8 @@ extern "C" {
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
#define STOPPING_TIME (5)
|
||||
#define STARTING_TCP_RELAY_TIME (10)
|
||||
#define STOPPING_TIME (10)
|
||||
#define STARTING_TCP_RELAY_TIME (30)
|
||||
|
||||
extern int clmessage_length;
|
||||
extern int do_not_use_channel;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user