1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-09 01:10:44 +00:00

rename dispatcher to handler

This commit is contained in:
Darien Raymond 2019-01-12 09:44:59 +01:00
parent ee13f7a562
commit defc93c49d
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -250,12 +250,12 @@ func sniffer(ctx context.Context, cReader *cachedReader) (SniffResult, error) {
}
func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.Link, destination net.Destination) {
dispatcher := d.ohm.GetDefaultHandler()
var handler outbound.Handler
if d.router != nil {
if tag, err := d.router.PickRoute(ctx); err == nil {
if handler := d.ohm.GetHandler(tag); handler != nil {
if h := d.ohm.GetHandler(tag); h != nil {
newError("taking detour [", tag, "] for [", destination, "]").WriteToLog(session.ExportIDToError(ctx))
dispatcher = handler
handler = h
} else {
newError("non existing tag: ", tag).AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
@ -264,12 +264,16 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, link *transport.
}
}
if dispatcher == nil {
if handler == nil {
handler = d.ohm.GetDefaultHandler()
}
if handler == nil {
newError("default outbound handler not exist").WriteToLog(session.ExportIDToError(ctx))
common.Close(link.Writer)
common.Interrupt(link.Reader)
return
}
dispatcher.Dispatch(ctx, link)
handler.Dispatch(ctx, link)
}