ing
This commit is contained in:
		
							parent
							
								
									9d3486ca28
								
							
						
					
					
						commit
						4d5dea3f21
					
				| @ -55,21 +55,7 @@ type ServerHandlers struct { | |||||||
| 	socketHandlers map[string]SocketHandler | 	socketHandlers map[string]SocketHandler | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (sh *ServerHandlers) Listen() (net.Listener, error) { | func (sh *ServerHandlers) Init() error { | ||||||
| 	return nil, errors.New("Server: Handler method[Listen] of Server is not implement") |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (sh *ServerHandlers) CheckOrigin(ctx *fasthttp.RequestCtx) bool { |  | ||||||
| 	return true |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (sh *ServerHandlers) OnError(ctx *fasthttp.RequestCtx, status int, reason error) { |  | ||||||
| 	logging.Logger().Error(fmt.Sprintf("Server: error status: %d, reason: %v, [%v]", status, reason, ctx)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // OnStart invoked when server is stated |  | ||||||
| // If you override ths method, must call |  | ||||||
| func (sh *ServerHandlers) OnStart() error { |  | ||||||
| 	if nil != sh.socketHandlers { | 	if nil != sh.socketHandlers { | ||||||
| 		for _, socketHandler := range sh.socketHandlers { | 		for _, socketHandler := range sh.socketHandlers { | ||||||
| 			if err := socketHandler.Init(); nil != err { | 			if err := socketHandler.Init(); nil != err { | ||||||
| @ -81,6 +67,24 @@ func (sh *ServerHandlers) OnStart() error { | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (sh *ServerHandlers) Listen() (net.Listener, error) { | ||||||
|  | 	return nil, errors.New("Server: Handler method[Listen] of Server is not implement") | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // OnStart invoked when server is stated | ||||||
|  | // If you override ths method, must call | ||||||
|  | func (sh *ServerHandlers) OnStart() { | ||||||
|  | 	// no op | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) CheckOrigin(ctx *fasthttp.RequestCtx) bool { | ||||||
|  | 	return true | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (sh *ServerHandlers) OnError(ctx *fasthttp.RequestCtx, status int, reason error) { | ||||||
|  | 	logging.Logger().Error(fmt.Sprintf("Server: error status: %d, reason: %v, [%v]", status, reason, ctx)) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // OnStop invoked when server is stopped | // OnStop invoked when server is stopped | ||||||
| // If you override ths method, must call | // If you override ths method, must call | ||||||
| func (sh *ServerHandlers) OnStop() { | func (sh *ServerHandlers) OnStop() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user