Skip to content

Commit

Permalink
Merge pull request #117 from Kifen/fix/dmsgpty
Browse files Browse the repository at this point in the history
Fix dmsgpty
  • Loading branch information
志宇 authored Jan 16, 2020
2 parents 5c05605 + 9884994 commit 9005759
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
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

0 comments on commit 9005759

Please sign in to comment.