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

index a1916e3f3dceec5c6deeb9c8f4804705612ae33d..bb91da83416caf74987585bdf77a7458cb6bd963 100644 (file)
@@ -41,7 +41,6 @@ void server_recv(QUIC_BUFFER* qbuff, uint32_t buff_count, uint64_t buff_tot_len)
     server_total_recvd += buff_tot_len;
     for(int i = 0 ; i < buff_count; i++){
         server_this_recvd += qbuff[i].Length;        
-
     }
 
     //printf("server total buff count: %llu\n", server_total_recvd);
@@ -99,6 +98,7 @@ 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:
@@ -252,7 +252,7 @@ void* client_send(void* varg){
     QUIC_STATUS status;
     HQUIC stream = NULL;
     uint8_t* send_buffer_raw = NULL;
-    uint8_t* sb_fill = NULL;
+    //uint8_t* sb_fill = NULL;
     QUIC_BUFFER* send_buffer;
 
     if (QUIC_FAILED(status = quic_api->StreamOpen(connection, QUIC_STREAM_OPEN_FLAG_NONE, client_stream_cb, NULL, &stream))) {
@@ -315,7 +315,6 @@ void* client_send(void* varg){
             goto error;
         }
         client_total_sent += quic_send_buffer_len;
-        //printf("client sent: %lu\n", client_total_sent);
         if(client_total_sent >= INPUT_BUFF_MAX){
             send_buffer->Length = 0;
             if (QUIC_FAILED(status = quic_api->StreamSend(stream, send_buffer, 1, QUIC_SEND_FLAG_FIN, send_buffer))) {
@@ -327,12 +326,15 @@ void* client_send(void* varg){
             break;
         }
     }
+    printf("client sent total: %lu\n", client_total_sent);
     gettimeofday(&t2, NULL);
 
     uint32_t seconds = t2.tv_sec - t1.tv_sec;      
-    uint32_t ms = (t2.tv_usec - t1.tv_usec) / 1000;
-    
-    printf("sec: %lu ms: %lu\n", seconds, ms);
+    int ms = (t2.tv_usec - t1.tv_usec) / 1000;
+    if(ms < 0){
+        ms = ms * -1;
+    }
+    printf("sec: %u ms: %d\n", seconds, ms);
         
 error:
 
@@ -435,7 +437,7 @@ void run_client() {
     }
 
     QUIC_STATUS status;
-    const char* resumption_ticket_string = NULL;
+    //const char* resumption_ticket_string = NULL;
 
     HQUIC connection = NULL;
 
index dfe137a4aac16c0606e542a0fc36c19c17cbcdc0..d64e6e67bdaf690f707ffb4aa7bb860538a94668 100644 (file)
@@ -248,14 +248,14 @@ static int client(){
 
         //printf("progress: %.2f\n", percent);
 
-        if(total_sent > INPUT_BUFF_MAX){
+        if(total_sent >= INPUT_BUFF_MAX){
             keepalive = 0;
             continue;
         }
 
     }
 
-    if(total_sent <= INPUT_BUFF_MAX){
+    if(total_sent < INPUT_BUFF_MAX){
         printf("connection closed before sending completed\n");
         return -4;
     }
@@ -263,10 +263,13 @@ static int client(){
     gettimeofday(&t2, NULL);
 
     uint32_t seconds = t2.tv_sec - t1.tv_sec;      
-    uint32_t ms = (t2.tv_usec - t1.tv_usec) / 1000;
+    int ms = (t2.tv_usec - t1.tv_usec) / 1000;
+    if(ms < 0){
+        ms = ms * -1;
+    }
     
-    printf("sec: %lu ms: %lu\n", seconds, ms);
-    printf("total sent: " "%" PRIu64 "\n", total_sent);
+    printf("client sent total: " "%" PRIu64 "\n", total_sent);
+    printf("sec: %u ms: %d\n", seconds, ms);
 
     return 0;
 }
@@ -275,6 +278,8 @@ static int client(){
 
 static int server(){
     
+    uint64_t server_recvd_total = 0;
+
     SSL *ssl;
     SSL_CTX *ctx;
     SSL_METHOD *method;
@@ -378,11 +383,15 @@ static int server(){
 
             }
 
+            server_recvd_total += (uint64_t)valread;
+
             if(keepalive == 0){
                 continue;
             }
         }
 
+        printf("server recvd total: " "%" PRIu64 "\n", server_recvd_total);
+
         close(connfd);
 
     }