1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-11-16 00:24:54 -05:00

Fix: trojan: do not panic when UDP dispatcher fails to write response (#599)

This commit is contained in:
maskedeken
2021-01-11 17:13:59 +08:00
committed by GitHub
parent 405a051c50
commit 9f8cb8bc8b

View File

@@ -207,7 +207,9 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn internet
func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReader, clientWriter *PacketWriter, dispatcher routing.Dispatcher) error {
udpServer := udp.NewDispatcher(dispatcher, func(ctx context.Context, packet *udp_proto.Packet) {
common.Must(clientWriter.WriteMultiBufferWithMetadata(buf.MultiBuffer{packet.Payload}, packet.Source))
if err := clientWriter.WriteMultiBufferWithMetadata(buf.MultiBuffer{packet.Payload}, packet.Source); err != nil {
newError("failed to write response").Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
})
inbound := session.InboundFromContext(ctx)