|
|
|
@ -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)) |
|
|
|
|