branchrust_reboot/main/multithreaded_networking_2cancel
                         
                     
             
         
     
    
        
28 Commits over 0 Days - ∞cph!
    
    
        
            
            
            
                
                Fixed DemoClient not returning NetRead to pool
 
                
                
                
                
                
             
         
        
        
            
            
            
                
                Splitting network thread into two threads (read thread and write thread)
 
                
                
                
                
                
             
         
        
            
            
            
                
                Removing locks in GetStat, GetLastPing and GetDebug since they're only called from the main thread, which is the only thread that can disconnect the peer
 
                
                
                
                
                
             
         
        
        
        
        
            
            
            
                
                Added 1 second timeout to all AutoResetEvent.WaitOne calls (large enough to notice something is wrong, but never deadlock)
Ensure everything is cleaned up / reinitialized after disconnect / reconnect
 
                
                
                
                
                
             
         
        
            
            
            
                
                NetRead and NetWrite use less space while pooled
 
                
                
                
                
                
             
         
        
            
            
            
                
                Decryption is running in its own thread (separate from network thread) -- this allows us to add multiple decryption threads in the future
EACServer uses ConcurrentDictionary to manage its client IDs
 
                
                
                
                
                
             
         
        
        
        
        
            
            
            
                
                Replacing Thread.Sleep with AutoResetEvent
Block main thread if worker thread can't keep up
Added client.maxsendqueue and server.maxsendqueue convars
Added some comments to network threading
 
                
                
                
                
                
             
         
        
            
            
            
                
                Replacing lock-synchronized queue with concurrent queue
 
                
                
                
                
                
             
         
        
            
            
            
                
                Replaced Stopwatch.Reset + Stopwatch.Start with Stopwatch.Restart
 
                
                
                
                
                
             
         
        
            
            
            
                
                Enabled by default inside editor
 
                
                
                
                
                
             
         
        
            
            
            
                
                Added client.maxreceivequeue and server.maxreceivequeue convars
Ensure maxreceivetime is still respected on the main thread even with multithreading enabled
 
                
                
                
                
                
             
         
        
            
            
            
                
                Rearranging and simplifying some things, cleaning up, removing duplicate code
 
                
                
                
                
                
             
         
        
            
            
            
                
                Sleep network thread when read queue is at capacity and write queue is empty (i.e. we're waiting for the main thread to catch up with us)
 
                
                
                
                
                
             
         
        
            
            
            
                
                Steam networking log tweak to be more in line with Raknet
 
                
                
                
                
                
             
         
        
            
            
            
                
                Fixed client main thread accessing peer directly in some console logs
 
                
                
                
                
                
             
         
        
        
            
            
            
                
                Startup parameter to enable network thread (-networkthread)
 
                
                
                
                
                
             
         
        
            
            
            
                
                Encryption support (forgotten file)
 
                
                
                
                
                
             
         
        
        
            
            
            
                
                Baseline (disabled by default)