Trojan: Do not panic when UDP dispatcher failed to write response (#153)

This commit is contained in:
maskedeken 2021-01-11 17:30:57 +08:00 committed by GitHub
parent e254424c43
commit 96adf3fbca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,7 +256,10 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade
if udpPayload.UDP == nil { if udpPayload.UDP == nil {
udpPayload.UDP = &packet.Source udpPayload.UDP = &packet.Source
} }
common.Must(clientWriter.WriteMultiBuffer(buf.MultiBuffer{udpPayload}))
if err := clientWriter.WriteMultiBuffer(buf.MultiBuffer{udpPayload}); err != nil {
newError("failed to write response").Base(err).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
}) })
inbound := session.InboundFromContext(ctx) inbound := session.InboundFromContext(ctx)