handleShutdownRequest sends a "shutdown" message.
(receipt msgReceipt)
| 618 | |
| 619 | // handleShutdownRequest sends a "shutdown" message. |
| 620 | func handleShutdownRequest(receipt msgReceipt) { |
| 621 | content := receipt.Msg.Content.(map[string]interface{}) |
| 622 | restart := content["restart"].(bool) |
| 623 | |
| 624 | reply := shutdownReply{ |
| 625 | Restart: restart, |
| 626 | } |
| 627 | |
| 628 | if err := receipt.Reply("shutdown_reply", reply); err != nil { |
| 629 | log.Fatal(err) |
| 630 | } |
| 631 | |
| 632 | log.Println("Shutting down in response to shutdown_request") |
| 633 | os.Exit(0) |
| 634 | } |
| 635 | |
| 636 | // startHeartbeat starts a go-routine for handling heartbeat ping messages sent over the given `hbSocket`. The `wg`'s |
| 637 | // `Done` method is invoked after the thread is completely shutdown. To request a shutdown the returned `shutdown` channel |