1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

remove ErrMissingApplication

This commit is contained in:
Darien Raymond 2016-11-21 21:13:01 +01:00
parent 55be94f8e3
commit c041740940
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
8 changed files with 11 additions and 17 deletions

View File

@ -1,6 +1,7 @@
package impl
import (
"errors"
"v2ray.com/core/app"
"v2ray.com/core/app/proxyman"
"v2ray.com/core/app/router"
@ -27,8 +28,7 @@ func NewDefaultDispatcher(space app.Space) *DefaultDispatcher {
// Private: Used by app.Space only.
func (this *DefaultDispatcher) Initialize(space app.Space) error {
if !space.HasApp(proxyman.APP_ID_OUTBOUND_MANAGER) {
log.Error("DefaultDispatcher: OutboundHandlerManager is not found in the space.")
return app.ErrMissingApplication
return errors.New("DefaultDispatcher: OutboundHandlerManager is not found in the space.")
}
this.ohm = space.GetApp(proxyman.APP_ID_OUTBOUND_MANAGER).(proxyman.OutboundHandlerManager)

View File

@ -1,6 +1,7 @@
package dns
import (
"errors"
"net"
"sync"
"time"
@ -38,8 +39,7 @@ func NewCacheServer(space app.Space, config *Config) *CacheServer {
}
space.InitializeApplication(func() error {
if !space.HasApp(dispatcher.APP_ID) {
log.Error("DNS: Dispatcher is not found in the space.")
return app.ErrMissingApplication
return errors.New("DNS: Dispatcher is not found in the space.")
}
dispatcher := space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)

View File

@ -45,8 +45,7 @@ func NewRouter(config *Config, space app.Space) *Router {
}
if !space.HasApp(dns.APP_ID) {
log.Error("Router: DNS is not found in the space.")
return app.ErrMissingApplication
return errors.New("Router: DNS is not found in the space.")
}
r.dnsServer = space.GetApp(dns.APP_ID).(dns.Server)
return nil

View File

@ -6,10 +6,6 @@ import (
"v2ray.com/core/common"
)
var (
ErrMissingApplication = errors.New("App: Failed to found one or more applications.")
)
type ID int
// Context of a function call from proxy to app.

View File

@ -3,6 +3,7 @@ package dokodemo
import (
"sync"
"errors"
"v2ray.com/core/app"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core/common/alloc"
@ -39,8 +40,7 @@ func NewDokodemoDoor(config *Config, space app.Space, meta *proxy.InboundHandler
}
space.InitializeApplication(func() error {
if !space.HasApp(dispatcher.APP_ID) {
log.Error("Dokodemo: Dispatcher is not found in the space.")
return app.ErrMissingApplication
return errors.New("Dokodemo: Dispatcher is not found in the space.")
}
d.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
return nil

View File

@ -3,6 +3,7 @@ package freedom
import (
"io"
"errors"
"v2ray.com/core/app"
"v2ray.com/core/app/dns"
"v2ray.com/core/common/alloc"
@ -35,8 +36,7 @@ func NewFreedomConnection(config *Config, space app.Space, meta *proxy.OutboundH
space.InitializeApplication(func() error {
if config.DomainStrategy == Config_USE_IP {
if !space.HasApp(dns.APP_ID) {
log.Error("Freedom: DNS server is not found in the space.")
return app.ErrMissingApplication
return errors.New("Freedom: DNS server is not found in the space.")
}
f.dns = space.GetApp(dns.APP_ID).(dns.Server)
}

View File

@ -50,7 +50,7 @@ func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandler
space.InitializeApplication(func() error {
if !space.HasApp(dispatcher.APP_ID) {
return app.ErrMissingApplication
return errors.New("Shadowsocks|Server: Dispatcher is not found in space.")
}
s.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
return nil

View File

@ -46,8 +46,7 @@ func NewServer(config *ServerConfig, space app.Space, meta *proxy.InboundHandler
}
space.InitializeApplication(func() error {
if !space.HasApp(dispatcher.APP_ID) {
log.Error("Socks|Server: Dispatcher is not found in the space.")
return app.ErrMissingApplication
return errors.New("Socks|Server: Dispatcher is not found in the space.")
}
s.packetDispatcher = space.GetApp(dispatcher.APP_ID).(dispatcher.PacketDispatcher)
return nil