hicli/json: handle ping commands
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This commit is contained in:
Tulir Asokan 2024-10-12 12:14:19 +03:00
commit 9e796dd66c

View file

@ -70,6 +70,12 @@ func (h *HiClient) dispatchCurrentState() {
}
func (h *HiClient) SubmitJSONCommand(ctx context.Context, req *JSONCommand) *JSONCommand {
if req.Command == "ping" {
return &JSONCommand{
Command: "pong",
RequestID: req.RequestID,
}
}
log := h.Log.With().Int64("request_id", req.RequestID).Str("command", req.Command).Logger()
ctx, cancel := context.WithCancelCause(ctx)
defer func() {