mirror of
				https://github.com/v2fly/v2ray-core.git
				synced 2025-11-03 22:07:11 -05:00 
			
		
		
		
	properly set timeout in dokodemo door
This commit is contained in:
		@@ -82,6 +82,7 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
 | 
			
		||||
 | 
			
		||||
	requestDone := signal.ExecuteAsync(func() error {
 | 
			
		||||
		defer inboundRay.InboundInput().Close()
 | 
			
		||||
		defer timer.SetTimeout(d.policy().Timeouts.DownlinkOnly)
 | 
			
		||||
 | 
			
		||||
		chunkReader := buf.NewReader(conn)
 | 
			
		||||
 | 
			
		||||
@@ -89,12 +90,12 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
 | 
			
		||||
			return newError("failed to transport request").Base(err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		timer.SetTimeout(d.policy().Timeouts.DownlinkOnly)
 | 
			
		||||
 | 
			
		||||
		return nil
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	responseDone := signal.ExecuteAsync(func() error {
 | 
			
		||||
		defer timer.SetTimeout(d.policy().Timeouts.UplinkOnly)
 | 
			
		||||
 | 
			
		||||
		var writer buf.Writer
 | 
			
		||||
		if network == net.Network_TCP {
 | 
			
		||||
			writer = buf.NewWriter(conn)
 | 
			
		||||
@@ -116,8 +117,6 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
 | 
			
		||||
			return newError("failed to transport response").Base(err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		timer.SetTimeout(d.policy().Timeouts.UplinkOnly)
 | 
			
		||||
 | 
			
		||||
		return nil
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user