From 6bbe00f0c7aae6c468b1a3e12983a74a170e92b8 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Dec 2024 10:32:29 +0800 Subject: Handle send failures --- cmd_ping.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'cmd_ping.go') diff --git a/cmd_ping.go b/cmd_ping.go index dc7131f..9da4ee9 100644 --- a/cmd_ping.go +++ b/cmd_ping.go @@ -4,11 +4,9 @@ func init() { commandHandlers["PING"] = handleClientPing } -func handleClientPing(msg RMsg, client *Client) bool { +func handleClientPing(msg RMsg, client *Client) error { if len(msg.Params) < 1 { - client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "PING", "Not enough parameters")) - return true + return client.Send(MakeMsg(self, ERR_NEEDMOREPARAMS, "PING", "Not enough parameters")) } - client.Send(MakeMsg(self, "PONG", self.Name, msg.Params[0])) - return true + return client.Send(MakeMsg(self, "PONG", self.Name, msg.Params[0])) } -- cgit v1.2.3