From d201e74fff4e6d82d639d858826bdb4190936c07 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Dec 2024 08:52:23 +0800 Subject: Server and self awareness --- cmd_ping.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'cmd_ping.go') diff --git a/cmd_ping.go b/cmd_ping.go index 4ad07c5..c5442b5 100644 --- a/cmd_ping.go +++ b/cmd_ping.go @@ -4,10 +4,11 @@ func init() { commandHandlers["PING"] = handleClientPing } -func handleClientPing(msg RMsg, client *Client) (error) { +func handleClientPing(msg RMsg, client *Client) bool { if len(msg.Params) < 1 { - client.Send(SMsg{Command: ERR_NEEDMOREPARAMS, Params: []string{"PING", "Not enough parameters"}}) + client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "PING", "Not enough parameters")) + return true } - client.Send(SMsg{Command: "PONG", Params: []string{msg.Params[0]}}) - return nil + client.Send(MakeMsg(self, "PONG", msg.Params[0])) + return true } -- cgit v1.2.3