uint64_t server_total_recvd = 0;
uint64_t server_this_recvd = 0;
int server_done = 0;
-
+struct timeval t1, t2;
void server_recv(QUIC_BUFFER* qbuff, uint32_t buff_count, uint64_t buff_tot_len){
for(int i = 0 ; i < buff_count; i++){
server_this_recvd += qbuff[i].Length;
}
+ if(server_this_recvd >= INPUT_BUFF_MAX){
+ gettimeofday(&t2, NULL);
+ uint32_t seconds = t2.tv_sec - t1.tv_sec;
+ int ms = (t2.tv_usec - t1.tv_usec) / 1000;
+ if(ms < 0){
+ ms = ms * -1;
+ }
+ printf("sec: %u ms: %d\n", seconds, ms);
+ printf("server recvd total: %lu\n", server_this_recvd);
+ server_this_recvd = 0;
+ }
//printf("server total buff count: %llu\n", server_total_recvd);
//printf("server this buff count: %llu\n", server_this_recvd);
return;
case QUIC_CONNECTION_EVENT_CONNECTED:
printf("client connected\n");
+ gettimeofday(&t1, NULL);
quic_api->ConnectionSendResumptionTicket(connection, QUIC_SEND_RESUMPTION_FLAG_NONE, 0, NULL);
break;
case QUIC_CONNECTION_EVENT_SHUTDOWN_INITIATED_BY_TRANSPORT:
case QUIC_CONNECTION_EVENT_SHUTDOWN_COMPLETE:
printf("connection done\n");
quic_api->ConnectionClose(connection);
- printf("server recvd total: %lu\n", server_this_recvd);
server_done = 1;
break;
case QUIC_CONNECTION_EVENT_PEER_STREAM_STARTED:
}
*/
- struct timeval t1, t2;
- gettimeofday(&t1, NULL);
-
printf("client sending...\n");
for(;;){
}
}
printf("client sent total: %lu\n", client_total_sent);
- gettimeofday(&t2, NULL);
-
- uint32_t seconds = t2.tv_sec - t1.tv_sec;
- int ms = (t2.tv_usec - t1.tv_usec) / 1000;
- if(ms < 0){
- ms = ms * -1;
- }
- printf("sec: %u ms: %d\n", seconds, ms);
error:
float percent = 0;
struct timeval t1, t2;
+
uint64_t total_sent = 0;
uint8_t data[INPUT_BUFF_CHUNK] = {0};
+
method = SSLv23_method();
if(method == NULL){
printf("ssl null method\n");
return -5;
}
+
printf("connected, sending...\n");
- gettimeofday(&t1, NULL);
+
while(keepalive){
return -4;
}
- gettimeofday(&t2, NULL);
- uint32_t seconds = t2.tv_sec - t1.tv_sec;
- int ms = (t2.tv_usec - t1.tv_usec) / 1000;
- if(ms < 0){
- ms = ms * -1;
- }
-
printf("client sent total: " "%" PRIu64 "\n", total_sent);
- printf("sec: %u ms: %d\n", seconds, ms);
return 0;
}
static int server(){
+ struct timeval t1, t2;
uint64_t server_recvd_total = 0;
+ uint32_t seconds;
+ int ms;
SSL *ssl;
SSL_CTX *ctx;
SSL_set_fd(ssl, connfd);
+
if(SSL_accept(ssl) != 1){
fprintf(stderr, "server ssl accept failed\n");
continue;
};
printf("client connected\n");
+ gettimeofday(&t1, NULL);
+
printf("receiving...\n");
while(keepalive){
server_recvd_total += (uint64_t)valread;
+ if(server_recvd_total >= INPUT_BUFF_MAX){
+ gettimeofday(&t2, NULL);
+
+ seconds = t2.tv_sec - t1.tv_sec;
+ ms = (t2.tv_usec - t1.tv_usec) / 1000;
+ if(ms < 0){
+ ms = ms * -1;
+ }
+ printf("sec: %u ms: %d\n", seconds, ms);
+ printf("server recvd total: " "%" PRIu64 "\n", server_recvd_total);
+ server_recvd_total = 0;
+ }
+
if(keepalive == 0){
continue;
}
}
- printf("server recvd total: " "%" PRIu64 "\n", server_recvd_total);
-
close(connfd);
}