+ SilcClientCommandReplyContext cmd = (SilcClientCommandReplyContext)context;
+ SilcClientConnection conn = (SilcClientConnection)cmd->sock->user_data;
+ SilcCommandStatus status;
+ void *id;
+ char *tmp;
+ int i;
+ time_t diff, curtime;
+
+ tmp = silc_command_get_arg_type(cmd->payload, 1, NULL);
+ SILC_GET16_MSB(status, tmp);
+ if (status != SILC_STATUS_OK) {
+ cmd->client->ops->say(cmd->client, conn,
+ "%s", silc_client_command_status_message(status));
+ COMMAND_REPLY_ERROR;
+ goto out;
+ }
+
+ curtime = time(NULL);
+ id = silc_id_str2id(cmd->packet->src_id, cmd->packet->src_id_type);
+
+ for (i = 0; i < conn->ping_count; i++) {
+ if (!SILC_ID_SERVER_COMPARE(conn->ping[i].dest_id, id)) {
+ diff = curtime - conn->ping[i].start_time;
+ cmd->client->ops->say(cmd->client, conn,
+ "Ping reply from %s: %d second%s",
+ conn->ping[i].dest_name, diff,
+ diff == 1 ? "" : "s");
+
+ conn->ping[i].start_time = 0;
+ silc_free(conn->ping[i].dest_id);
+ conn->ping[i].dest_id = NULL;
+ silc_free(conn->ping[i].dest_name);
+ conn->ping[i].dest_name = NULL;
+
+ /* Notify application */
+ COMMAND_REPLY((ARGS));
+ goto out;
+ }
+ }
+
+ out:
+ silc_client_command_reply_free(cmd);