1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 03:25:23 +00:00

add Closable to dispatcher interface

This commit is contained in:
Shelikhoo 2021-12-11 23:05:19 +00:00 committed by Xiaokang Wang (Shelikhoo)
parent bf8a0b7290
commit 6ff1cfa253
2 changed files with 6 additions and 0 deletions

View File

@ -2,10 +2,12 @@ package udp
import ( import (
"context" "context"
"github.com/v2fly/v2ray-core/v5/common"
"github.com/v2fly/v2ray-core/v5/common/buf" "github.com/v2fly/v2ray-core/v5/common/buf"
"github.com/v2fly/v2ray-core/v5/common/net" "github.com/v2fly/v2ray-core/v5/common/net"
) )
type DispatcherI interface { type DispatcherI interface {
common.Closable
Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer) Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer)
} }

View File

@ -32,6 +32,10 @@ type Dispatcher struct {
callback ResponseCallback callback ResponseCallback
} }
func (v *Dispatcher) Close() error {
return nil
}
func NewSplitDispatcher(dispatcher routing.Dispatcher, callback ResponseCallback) DispatcherI { func NewSplitDispatcher(dispatcher routing.Dispatcher, callback ResponseCallback) DispatcherI {
return &Dispatcher{ return &Dispatcher{
conns: make(map[net.Destination]*connEntry), conns: make(map[net.Destination]*connEntry),