aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorVlad <gluk256@gmail.com>2018-03-04 04:37:16 +0800
committerVlad <gluk256@gmail.com>2018-03-04 04:37:16 +0800
commit95cca85d6d13514284f2ced54196d2b3b0aaa3d9 (patch)
tree9dd7574162d3f4115f7853fe7c237241edc9fece /cmd
parent66cd41af1e3827f9f834ca6ea98d6964d2388f77 (diff)
downloaddexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar.gz
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar.bz2
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar.lz
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar.xz
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.tar.zst
dexon-95cca85d6d13514284f2ced54196d2b3b0aaa3d9.zip
whisper: minor refactoring
Diffstat (limited to 'cmd')
-rw-r--r--cmd/wnode/main.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go
index 76590e7f5..00a854fe8 100644
--- a/cmd/wnode/main.go
+++ b/cmd/wnode/main.go
@@ -439,6 +439,8 @@ func run() {
} else {
sendLoop()
}
+
+ close(done)
}
func sendLoop() {
@@ -446,11 +448,9 @@ func sendLoop() {
s := scanLine("")
if s == quitCommand {
fmt.Println("Quit command received")
- close(done)
- break
+ return
}
sendMsg([]byte(s))
-
if *asymmetricMode {
// print your own message for convenience,
// because in asymmetric mode it is impossible to decrypt it
@@ -466,13 +466,11 @@ func sendFilesLoop() {
s := scanLine("")
if s == quitCommand {
fmt.Println("Quit command received")
- close(done)
- break
+ return
}
b, err := ioutil.ReadFile(s)
if err != nil {
fmt.Printf(">>> Error: %s \n", err)
- continue
} else {
h := sendMsg(b)
if (h == common.Hash{}) {
@@ -491,7 +489,6 @@ func fileReaderLoop() {
watcher2 := shh.GetFilter(asymFilterID)
if watcher1 == nil && watcher2 == nil {
fmt.Println("Error: neither symmetric nor asymmetric filter is installed")
- close(done)
return
}
@@ -499,7 +496,6 @@ func fileReaderLoop() {
s := scanLine("")
if s == quitCommand {
fmt.Println("Quit command received")
- close(done)
return
}
raw, err := ioutil.ReadFile(s)