summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2020-10-17 17:31:27 +0300
committerWolfy-J <[email protected]>2020-10-17 17:31:27 +0300
commit6f7e126d6ea25c83b4df50048d1073c6e76ff338 (patch)
treeaaf3f124d16039ff518bd081605afcaf14742034
parent9e572cecbade5673dc93e1240e9573f093f64bd6 (diff)
- fixes pipe relay initializationv2.0.0-alpha12
-rw-r--r--plugins/factory/app.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/factory/app.go b/plugins/factory/app.go
index a38307e7..3de572b0 100644
--- a/plugins/factory/app.go
+++ b/plugins/factory/app.go
@@ -20,11 +20,10 @@ type AppConfig struct {
Group string
Env Env
- Relay string
// Listen defines connection method and factory to be used to connect to workers:
// "pipes", "tcp://:6001", "unix://rr.sock"
// This config section must not change on re-configuration.
- Listen string
+ Relay string
// RelayTimeout defines for how long socket factory will be waiting for worker connection. This config section
// must not change on re-configuration.
@@ -82,25 +81,28 @@ func (app *App) NewCmd(env Env) (func() *exec.Cmd, error) {
// todo ENV unused
func (app *App) NewFactory(env Env) (roadrunner.Factory, error) {
- lsn, err := util.CreateListener(app.cfg.Listen)
- if err != nil {
- return nil, err
+ if app.cfg.Relay == "" || app.cfg.Relay == "pipes" {
+ return roadrunner.NewPipeFactory(), nil
}
- dsn := strings.Split(app.cfg.Listen, "://")
- if app.cfg.Listen != "" && len(dsn) != 2 {
+ dsn := strings.Split(app.cfg.Relay, "://")
+ if len(dsn) != 2 {
return nil, errors.New("invalid DSN (tcp://:6001, unix://file.sock)")
}
+ lsn, err := util.CreateListener(app.cfg.Relay)
+ if err != nil {
+ return nil, err
+ }
+
switch dsn[0] {
// sockets group
case "unix":
return roadrunner.NewSocketServer(lsn, app.cfg.RelayTimeout), nil
case "tcp":
return roadrunner.NewSocketServer(lsn, app.cfg.RelayTimeout), nil
- // pipes
default:
- return roadrunner.NewPipeFactory(), nil
+ return nil, errors.New("invalid DSN (tcp://:6001, unix://file.sock)")
}
}