|
|
@ -439,6 +439,8 @@ func run() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
sendLoop() |
|
|
|
sendLoop() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close(done) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func sendLoop() { |
|
|
|
func sendLoop() { |
|
|
@ -446,11 +448,9 @@ func sendLoop() { |
|
|
|
s := scanLine("") |
|
|
|
s := scanLine("") |
|
|
|
if s == quitCommand { |
|
|
|
if s == quitCommand { |
|
|
|
fmt.Println("Quit command received") |
|
|
|
fmt.Println("Quit command received") |
|
|
|
close(done) |
|
|
|
return |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
sendMsg([]byte(s)) |
|
|
|
sendMsg([]byte(s)) |
|
|
|
|
|
|
|
|
|
|
|
if *asymmetricMode { |
|
|
|
if *asymmetricMode { |
|
|
|
// print your own message for convenience,
|
|
|
|
// print your own message for convenience,
|
|
|
|
// because in asymmetric mode it is impossible to decrypt it
|
|
|
|
// because in asymmetric mode it is impossible to decrypt it
|
|
|
@ -466,13 +466,11 @@ func sendFilesLoop() { |
|
|
|
s := scanLine("") |
|
|
|
s := scanLine("") |
|
|
|
if s == quitCommand { |
|
|
|
if s == quitCommand { |
|
|
|
fmt.Println("Quit command received") |
|
|
|
fmt.Println("Quit command received") |
|
|
|
close(done) |
|
|
|
return |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
b, err := ioutil.ReadFile(s) |
|
|
|
b, err := ioutil.ReadFile(s) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
fmt.Printf(">>> Error: %s \n", err) |
|
|
|
fmt.Printf(">>> Error: %s \n", err) |
|
|
|
continue |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
h := sendMsg(b) |
|
|
|
h := sendMsg(b) |
|
|
|
if (h == common.Hash{}) { |
|
|
|
if (h == common.Hash{}) { |
|
|
@ -491,7 +489,6 @@ func fileReaderLoop() { |
|
|
|
watcher2 := shh.GetFilter(asymFilterID) |
|
|
|
watcher2 := shh.GetFilter(asymFilterID) |
|
|
|
if watcher1 == nil && watcher2 == nil { |
|
|
|
if watcher1 == nil && watcher2 == nil { |
|
|
|
fmt.Println("Error: neither symmetric nor asymmetric filter is installed") |
|
|
|
fmt.Println("Error: neither symmetric nor asymmetric filter is installed") |
|
|
|
close(done) |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -499,7 +496,6 @@ func fileReaderLoop() { |
|
|
|
s := scanLine("") |
|
|
|
s := scanLine("") |
|
|
|
if s == quitCommand { |
|
|
|
if s == quitCommand { |
|
|
|
fmt.Println("Quit command received") |
|
|
|
fmt.Println("Quit command received") |
|
|
|
close(done) |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
raw, err := ioutil.ReadFile(s) |
|
|
|
raw, err := ioutil.ReadFile(s) |
|
|
|