added ping command.

pull/37/head
Richard Liu 6 years ago
parent 7600c9e3e7
commit 25d04863b9
  1. 2
      aws-experiment-launch/experiment/commander/main.go
  2. 9
      aws-experiment-launch/experiment/soldier/main.go

@ -94,7 +94,7 @@ func dictateNode(addr string, command string) {
log.Printf("Failed to send command to %s", addr)
return
}
log.Printf("Send: %s", command)
log.Printf("Send \"%s\" to %s", command, addr)
// read response
buff := make([]byte, 1024)

@ -96,6 +96,10 @@ func handleCommand(command string, w *bufio.Writer) {
{
handleKillCommand(w)
}
case "ping":
{
handlePingCommand(w)
}
}
}
@ -142,6 +146,11 @@ func handleKillCommand(w *bufio.Writer) {
logAndReply(w, "Kill command done.")
}
func handlePingCommand(w *bufio.Writer) {
log.Println("Ping command")
logAndReply(w, "I'm alive")
}
func logAndReply(w *bufio.Writer, message string) {
log.Println(message)
w.Write([]byte(message))

Loading…
Cancel
Save