]> git.feebdaed.xyz Git - linuxyz.git/commitdiff
done
authorseantywork <seantywork@gmail.com>
Thu, 3 Jul 2025 10:56:57 +0000 (10:56 +0000)
committerseantywork <seantywork@gmail.com>
Thu, 3 Jul 2025 10:56:57 +0000 (10:56 +0000)
quic-bench/quic/quic.c
quic-bench/tls/tls.c

index bb91da83416caf74987585bdf77a7458cb6bd963..b8f04b81914d27c44228a04d04e8d8ed894dd746 100644 (file)
@@ -30,7 +30,7 @@ uint64_t client_total_sent = 0;
 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){
 
@@ -42,7 +42,18 @@ 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;
@@ -83,6 +94,7 @@ QUIC_STATUS server_conn_cb(HQUIC connection,void* context, QUIC_CONNECTION_EVENT
     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:
@@ -98,7 +110,6 @@ QUIC_STATUS server_conn_cb(HQUIC connection,void* context, QUIC_CONNECTION_EVENT
     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:
@@ -299,9 +310,6 @@ void* client_send(void* varg){
     }
 */
 
-    struct timeval t1, t2;
-    gettimeofday(&t1, NULL);
-
     printf("client sending...\n");
 
     for(;;){
@@ -327,14 +335,6 @@ void* client_send(void* varg){
         }
     }
     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:
 
index d64e6e67bdaf690f707ffb4aa7bb860538a94668..aefbb38bcf4db9879905f72f21eb1faca63b0655 100644 (file)
@@ -141,10 +141,12 @@ static int client(){
     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");
@@ -224,9 +226,10 @@ static int client(){
         return -5;
     }
 
+
     printf("connected, sending...\n");
 
-    gettimeofday(&t1, NULL);
+
 
     while(keepalive){
 
@@ -260,16 +263,8 @@ static int client(){
         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;
 }
@@ -278,7 +273,10 @@ static int client(){
 
 static int server(){
     
+    struct timeval t1, t2;
     uint64_t server_recvd_total = 0;
+    uint32_t seconds;      
+    int ms;
 
     SSL *ssl;
     SSL_CTX *ctx;
@@ -360,12 +358,15 @@ static int server(){
 
         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){
@@ -385,13 +386,24 @@ static int server(){
 
             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);
 
     }