mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
allow fast close on UDP session. fix #682
This commit is contained in:
parent
fde421ac58
commit
cec45a416c
@ -90,19 +90,17 @@ func (s *Server) processTCP(ctx context.Context, conn internet.Connection, dispa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if request.Command == protocol.RequestCommandUDP {
|
if request.Command == protocol.RequestCommandUDP {
|
||||||
return s.handleUDP()
|
return s.handleUDP(conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Server) handleUDP() error {
|
func (*Server) handleUDP(c net.Conn) error {
|
||||||
// The TCP connection closes after v method returns. We need to wait until
|
// The TCP connection closes after this method returns. We need to wait until
|
||||||
// the client closes it.
|
// the client closes it.
|
||||||
// TODO: get notified from UDP part
|
_, err := io.Copy(buf.DiscardBytes, c)
|
||||||
time.Sleep(5 * time.Minute)
|
return err
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writer, dest net.Destination, dispatcher dispatcher.Interface) error {
|
func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writer, dest net.Destination, dispatcher dispatcher.Interface) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user