Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dmsgpty #117

Merged
merged 2 commits into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ func (cfg *runCfg) runNode() *runCfg {

time.Sleep(startDelay)

node, err := visor.NewNode(&cfg.conf, cfg.masterLogger, cfg.restartCtx)
if err != nil {
cfg.logger.Fatal("Failed to initialize node: ", err)
}

if cfg.conf.DmsgPty != nil {
err = node.UnlinkSocketFiles(cfg.conf.AppServerSockFile, cfg.conf.DmsgPty.CLIAddr)
err = visor.UnlinkSocketFiles(cfg.conf.AppServerSockFile, cfg.conf.DmsgPty.CLIAddr)
} else {
err = node.UnlinkSocketFiles(cfg.conf.AppServerSockFile)
err = visor.UnlinkSocketFiles(cfg.conf.AppServerSockFile)
}

if err != nil {
cfg.logger.Fatal("failed to unlink socket files: ", err)
}

node, err := visor.NewNode(&cfg.conf, cfg.masterLogger, cfg.restartCtx)
if err != nil {
cfg.logger.Fatal("Failed to initialize node: ", err)
}

if cfg.conf.Uptime.Tracker != "" {
uptimeTracker, err := utclient.NewHTTP(cfg.conf.Uptime.Tracker, cfg.conf.Node.StaticPubKey, cfg.conf.Node.StaticSecKey)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (node *Node) Close() (err error) {
node.logger.Info("router stopped successfully")
}

if err := node.UnlinkSocketFiles(node.conf.AppServerSockFile); err != nil {
if err := UnlinkSocketFiles(node.conf.AppServerSockFile); err != nil {
node.logger.WithError(err).Errorf("Failed to unlink socket file %s", node.conf.AppServerSockFile)
} else {
node.logger.Infof("Socket file %s removed successfully", node.conf.AppServerSockFile)
Expand Down Expand Up @@ -505,7 +505,7 @@ func (node *Node) SetAutoStart(appName string, autoStart bool) error {
}

// UnlinkSocketFiles removes unix socketFiles from file system
func (node *Node) UnlinkSocketFiles(socketFiles ...string) error {
func UnlinkSocketFiles(socketFiles ...string) error {
for _, f := range socketFiles {
if err := syscall.Unlink(f); err != nil {
if strings.Contains(err.Error(), "no such file or directory") {
Expand Down
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# github.com/SkycoinProject/dmsg v0.0.0-20191107094546-85c27858fca6 => ../dmsg
# github.com/SkycoinProject/dmsg v0.0.0-20191107094546-85c27858fca6
github.com/SkycoinProject/dmsg
github.com/SkycoinProject/dmsg/cipher
github.com/SkycoinProject/dmsg/disc
Expand Down