| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -8,7 +8,6 @@ import (
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"git.noahlan.cn/noahlan/nnet/scheduler"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"git.noahlan.cn/noahlan/ntools-go/core/nlog"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"git.noahlan.cn/noahlan/ntools-go/core/pool"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"io"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"net"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					"sync/atomic"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				)
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -71,7 +70,7 @@ func newConnection(server *engine, conn net.Conn) *connection {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					_, r.isWS = conn.(*WSConn)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					// binding session
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					r.session = newSession(r)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					r.session = newSession(r, server.sessIdMgr.SessionID())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return r
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -204,12 +203,18 @@ func (r *connection) read() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						n, err := r.conn.Read(buf)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//nlog.Debugf("receive data %v", buf[:n])
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if err != nil && err != io.EOF {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if err != nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							nlog.Errorf("%s [readLoop] Read message error: %s, session will be closed immediately",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								r.ngin.logPrefix(), err.Error())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if n == 0 {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							nlog.Errorf("%s [readLoop] Read empty message, session will be closed immediately",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								r.ngin.logPrefix())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if r.packer == nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							nlog.Errorf("%s [readLoop] unexpected error: packer is nil", r.ngin.logPrefix())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |