Skip to content

Commit ce7c470

Browse files
committed
Bumped v0.5.5
Signed-off-by: Vishal Rana <[email protected]>
1 parent a707832 commit ce7c470

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
IMAGE = labstack/tunnel
2-
VERSION = 0.5.4
2+
VERSION = 0.5.5
33

44
publish:
55
git tag v$(VERSION)

cmd/daemon.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,13 @@ import (
66
"github.com/radovskyb/watcher"
77
"github.com/spf13/cobra"
88
"github.com/spf13/viper"
9-
"io"
109
"io/ioutil"
1110
"os"
1211
"os/exec"
1312
"strconv"
1413
"time"
1514
)
1615

17-
func checkKey() {
18-
}
19-
2016
func startDaemon() {
2117
if viper.GetString("api_key") == "" {
2218
exit("To use tunnel you need an api key (https://tunnel.labstack.com) in $HOME/.tunnel/config.yaml")
@@ -85,9 +81,15 @@ var daemonCmd = &cobra.Command{
8581
req := new(daemon.StopDaemonRequest)
8682
rep := new(daemon.StopDaemonReply)
8783
err = c.Call("Server.StopDaemon", req, rep)
88-
if err != nil && err != io.ErrUnexpectedEOF {
84+
if err != nil {
8985
exit(err)
9086
}
87+
defer os.Remove(viper.GetString("daemon_addr"))
88+
defer os.Remove(viper.GetString("daemon_pid"))
89+
d, _ := ioutil.ReadFile(viper.GetString("daemon_pid"))
90+
pid, _ := strconv.Atoi(string(d))
91+
p, _ := os.FindProcess(pid)
92+
p.Kill()
9193
}
9294
},
9395
}

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import (
44
"errors"
55
"fmt"
66
"github.com/labstack/tunnel-client/daemon"
7+
"github.com/spf13/cobra"
78
"net"
89
"os"
910
"path/filepath"
1011
"strings"
1112

12-
"github.com/spf13/cobra"
13-
1413
"github.com/mitchellh/go-homedir"
1514
"github.com/spf13/viper"
1615
)

daemon/server.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"net/rpc"
1414
"os"
1515
"os/signal"
16-
"strconv"
1716
"syscall"
1817
)
1918

@@ -145,25 +144,7 @@ func Start() {
145144

146145
func (s *Server) StopDaemon(req *StopDaemonRequest, rep *StopDaemonReply) (err error) {
147146
log.Warn("stopping daemon")
148-
if err = s.stopConnections(); err != nil {
149-
return
150-
}
151-
d, _ := ioutil.ReadFile(viper.GetString("daemon_pid"))
152-
pid, err := strconv.Atoi(string(d))
153-
if err != nil {
154-
return
155-
}
156-
p, err := os.FindProcess(pid)
157-
if err != nil {
158-
return
159-
}
160-
if err = p.Kill(); err != nil {
161-
return
162-
}
163-
if err = os.Remove(viper.GetString("daemon_pid")); err != nil {
164-
return
165-
}
166-
return os.Remove(viper.GetString("daemon_addr"))
147+
return s.stopConnections()
167148
}
168149

169150
func (s *Server) findConnection(c *Connection) (err error) {

0 commit comments

Comments
 (0)