aboutsummaryrefslogblamecommitdiff
path: root/test_p2p_stress/main.go
blob: 105144017062d756f94ba304395064653c91d0fa (plain) (tree)
1
2
3
4
5
6
7





                                                  
                                








                                                            
                                

                                                                                    



                        


          
                                          



               
             

 







                                                                      
                   



                                                           
                                               




                                                                     
                               




                                                              
                                               




                                                               
                             







                                   
                                                  




                           









                                              







                               









                               







                                                                









                                                                 


                                                                          





                                          
                                             
              



                          

                              




                                                           
                                        





                                                                                   




                                                                                                      
                               


                                    

                                            



                                



                                                                                                     
                                                   




                                            
                
                         
 

                                                                

                               
               
 
                                    

                                     
                                               

                                      
                                                             

                            
                                                               

                                                
                                                                                                                    
                          



                                                                   
                                                            









                                                                                                



                                                          
                                          
                       













                                                                    
                                        





                                                        
                  






                                     
                            
                             
                                                                                       

                                                  
                                        
                               


                            
                                         
                                       





                                                          
                                                

                                               


                                                 





                                                                                              
                    


                            
                   
                   
                              






                                        

                                               


                          
 
                                                                                    
                                 
                                                                                     







                                   
package main

// #cgo CFLAGS: -I${SRCDIR}/../salticidae/include/
// #include <stdlib.h>
// #include <arpa/inet.h>
// #include "salticidae/network.h"
// void onTerm(int sig, void *);
// void onReceiveRand(msg_t *, msgnetwork_conn_t *, void *);
// void onReceiveAck(msg_t *, msgnetwork_conn_t *, void *);
// void onStopLoop(threadcall_handle_t *, void *);
// void connHandler(msgnetwork_conn_t *, bool, void *);
// void onTimeout(timerev_t *, void *);
// typedef struct timeout_callback_context_t {
//     int app_id;
//     uint64_t addr_id;
//     msgnetwork_conn_t *conn;
// } timeout_callback_context_t;
// static timeout_callback_context_t *timeout_callback_context_new() {
//     timeout_callback_context_t *ctx = malloc(sizeof(timeout_callback_context_t));
//     ctx->conn = NULL;
//     return ctx;
// }
//
import "C"

import (
    "github.com/Determinant/salticidae-go"
    "math/rand"
    "fmt"
    "sync"
    "unsafe"
    "strconv"
)

const (
    MSG_OPCODE_RAND salticidae.Opcode = iota
    MSG_OPCODE_ACK
)

func msgRandSerialize(size int) (salticidae