|  | @@ -89,7 +89,9 @@ func New(ctx context.Context, config *Config) (*Handler, error) {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	allowedClients := vmess.NewTimedUserValidator(ctx, protocol.DefaultIDHash)
 |  |  	allowedClients := vmess.NewTimedUserValidator(ctx, protocol.DefaultIDHash)
 | 
											
												
													
														|  |  	for _, user := range config.User {
 |  |  	for _, user := range config.User {
 | 
											
												
													
														|  | -		allowedClients.Add(user)
 |  | 
 | 
											
												
													
														|  | 
 |  | +		if err := allowedClients.Add(user); err != nil {
 | 
											
												
													
														|  | 
 |  | +			return nil, newError("failed to initiate user").Base(err)
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	handler := &Handler{
 |  |  	handler := &Handler{
 | 
											
										
											
												
													
														|  | @@ -172,7 +174,8 @@ func transferResponse(timer signal.ActivityTimer, session *encoding.ServerSessio
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  // Process implements proxy.Inbound.Process().
 |  |  // Process implements proxy.Inbound.Process().
 | 
											
												
													
														|  |  func (v *Handler) Process(ctx context.Context, network net.Network, connection internet.Connection, dispatcher dispatcher.Interface) error {
 |  |  func (v *Handler) Process(ctx context.Context, network net.Network, connection internet.Connection, dispatcher dispatcher.Interface) error {
 | 
											
												
													
														|  | -	connection.SetReadDeadline(time.Now().Add(time.Second * 8))
 |  | 
 | 
											
												
													
														|  | 
 |  | +	common.Must(connection.SetReadDeadline(time.Now().Add(time.Second * 8)))
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  	reader := buf.NewBufferedReader(connection)
 |  |  	reader := buf.NewBufferedReader(connection)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	session := encoding.NewServerSession(v.clients, v.sessionHistory)
 |  |  	session := encoding.NewServerSession(v.clients, v.sessionHistory)
 | 
											
										
											
												
													
														|  | @@ -215,12 +218,13 @@ func (v *Handler) Process(ctx context.Context, network net.Network, connection i
 | 
											
												
													
														|  |  		return transferRequest(timer, session, request, reader, input)
 |  |  		return transferRequest(timer, session, request, reader, input)
 | 
											
												
													
														|  |  	})
 |  |  	})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -	writer := buf.NewBufferedWriter(connection)
 |  | 
 | 
											
												
													
														|  | -	response := &protocol.ResponseHeader{
 |  | 
 | 
											
												
													
														|  | -		Command: v.generateCommand(ctx, request),
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  	responseDone := signal.ExecuteAsync(func() error {
 |  |  	responseDone := signal.ExecuteAsync(func() error {
 | 
											
												
													
														|  | 
 |  | +		writer := buf.NewBufferedWriter(connection)
 | 
											
												
													
														|  | 
 |  | +		defer writer.Flush()
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		response := &protocol.ResponseHeader{
 | 
											
												
													
														|  | 
 |  | +			Command: v.generateCommand(ctx, request),
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  |  		return transferResponse(timer, session, request, response, output, writer)
 |  |  		return transferResponse(timer, session, request, response, output, writer)
 | 
											
												
													
														|  |  	})
 |  |  	})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -230,10 +234,6 @@ func (v *Handler) Process(ctx context.Context, network net.Network, connection i
 | 
											
												
													
														|  |  		return newError("connection ends").Base(err)
 |  |  		return newError("connection ends").Base(err)
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -	if err := writer.Flush(); err != nil {
 |  | 
 | 
											
												
													
														|  | -		return newError("error during flushing remaining data").Base(err)
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  	runtime.KeepAlive(timer)
 |  |  	runtime.KeepAlive(timer)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  	return nil
 |  |  	return nil
 |