1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-27 01:45:23 +00:00
This commit is contained in:
Jinqiu Yu 2018-03-15 10:32:10 +08:00
parent d1898b995f
commit 855925a805
8 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ func (l *OutboundListener) add(conn net.Conn) {
func (l *OutboundListener) Accept() (net.Conn, error) { func (l *OutboundListener) Accept() (net.Conn, error) {
select { select {
case <-l.done.C(): case <-l.done.C():
return nil, newError("listern closed") return nil, newError("listen closed")
case c := <-l.buffer: case c := <-l.buffer:
return c, nil return c, nil
} }

View File

@ -55,7 +55,7 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
ctx = proxy.ContextWithTarget(ctx, destination) ctx = proxy.ContextWithTarget(ctx, destination)
outbound := ray.NewRay(ctx) outbound := ray.NewRay(ctx)
snifferList := proxyman.ProtocoSniffersFromContext(ctx) snifferList := proxyman.ProtocolSniffersFromContext(ctx)
if destination.Address.Family().IsDomain() || len(snifferList) == 0 { if destination.Address.Family().IsDomain() || len(snifferList) == 0 {
go d.routedDispatch(ctx, outbound, destination) go d.routedDispatch(ctx, outbound, destination)
} else { } else {
@ -110,7 +110,7 @@ func (d *DefaultDispatcher) routedDispatch(ctx context.Context, outbound ray.Out
newError("taking detour [", tag, "] for [", destination, "]").WithContext(ctx).WriteToLog() newError("taking detour [", tag, "] for [", destination, "]").WithContext(ctx).WriteToLog()
dispatcher = handler dispatcher = handler
} else { } else {
newError("nonexisting tag: ", tag).AtWarning().WithContext(ctx).WriteToLog() newError("non existing tag: ", tag).AtWarning().WithContext(ctx).WriteToLog()
} }
} else { } else {
newError("default route for ", destination).WithContext(ctx).WriteToLog() newError("default route for ", destination).WithContext(ctx).WriteToLog()

View File

@ -11,7 +11,7 @@ import (
// InboundOperation is the interface for operations that applies to inbound handlers. // InboundOperation is the interface for operations that applies to inbound handlers.
type InboundOperation interface { type InboundOperation interface {
// ApplyInbound appliess this operation to the given inbound handler. // ApplyInbound applies this operation to the given inbound handler.
ApplyInbound(context.Context, core.InboundHandler) error ApplyInbound(context.Context, core.InboundHandler) error
} }

View File

@ -17,7 +17,7 @@ func ContextWithProtocolSniffers(ctx context.Context, list []KnownProtocols) con
return context.WithValue(ctx, protocolsKey, list) return context.WithValue(ctx, protocolsKey, list)
} }
func ProtocoSniffersFromContext(ctx context.Context) []KnownProtocols { func ProtocolSniffersFromContext(ctx context.Context) []KnownProtocols {
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok { if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok {
return list return list
} }

View File

@ -38,7 +38,7 @@ func (d *Done) Wait() {
<-d.c <-d.c
} }
// Close marks this Done 'done'. This method may be called mutliple times. All calls after first call will have no effect on its status. // Close marks this Done 'done'. This method may be called multiple times. All calls after first call will have no effect on its status.
func (d *Done) Close() error { func (d *Done) Close() error {
d.access.Lock() d.access.Lock()
defer d.access.Unlock() defer d.access.Unlock()

View File

@ -12,7 +12,7 @@ func executeAndFulfill(f func() error, done chan<- error) {
close(done) close(done)
} }
// ExecuteAsync executes a function asychrously and return its result. // ExecuteAsync executes a function asynchronously and return its result.
func ExecuteAsync(f func() error) <-chan error { func ExecuteAsync(f func() error) <-chan error {
done := make(chan error, 1) done := make(chan error, 1)
go executeAndFulfill(f, done) go executeAndFulfill(f, done)

View File

@ -1,6 +1,6 @@
package signal package signal
// Notifier is an utility for notifying changes. The change producer may notify changes multiple time, and the consumer may get notified asychronously. // Notifier is an utility for notifying changes. The change producer may notify changes multiple time, and the consumer may get notified asynchronously.
type Notifier struct { type Notifier struct {
c chan struct{} c chan struct{}
} }

View File

@ -130,7 +130,7 @@ func (s *Instance) Start() error {
} }
// RegisterFeature registers the given feature into V2Ray. // RegisterFeature registers the given feature into V2Ray.
// If feature is one of the following types, the corressponding feature in this Instance // If feature is one of the following types, the corresponding feature in this Instance
// will be replaced: DNSClient, PolicyManager, Router, Dispatcher, InboundHandlerManager, OutboundHandlerManager. // will be replaced: DNSClient, PolicyManager, Router, Dispatcher, InboundHandlerManager, OutboundHandlerManager.
func (s *Instance) RegisterFeature(feature interface{}, instance Feature) error { func (s *Instance) RegisterFeature(feature interface{}, instance Feature) error {
running := false running := false