summaryrefslogtreecommitdiff
path: root/minecctl/rcon-commands.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-07-01 21:47:14 +0200
committerDavid Härdeman <david@hardeman.nu>2020-07-01 21:47:14 +0200
commit43830ce2bff25a9acca4268ffaa3a681ac3afec2 (patch)
treea6bfd06bbac5be2bff59a41a47a5ccdf169f3ad2 /minecctl/rcon-commands.c
parent7e728d971b95f115c7e9c2def21815034d9bde54 (diff)
Teach connect_any to report the address it connected to in order to improve dbg messages
Diffstat (limited to 'minecctl/rcon-commands.c')
-rw-r--r--minecctl/rcon-commands.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/minecctl/rcon-commands.c b/minecctl/rcon-commands.c
index be18bba..5e4ea08 100644
--- a/minecctl/rcon-commands.c
+++ b/minecctl/rcon-commands.c
@@ -99,6 +99,7 @@ static int rcon_login(struct cfg *cfg, struct server *server)
char buf[4096];
int32_t rtype;
const char *reply;
+ struct saddr *saddr;
int fd = -1;
assert_die(cfg && server, "invalid arguments");
@@ -108,11 +109,12 @@ static int rcon_login(struct cfg *cfg, struct server *server)
goto error;
}
- fd = connect_any(&server->scfg.rcons, true);
+ fd = connect_any(&server->scfg.rcons, &saddr, &error);
if (fd < 0) {
- error("%s: unable to connect", server->name);
+ error("%s: unable to connect - %s", server->name, error);
goto error;
- }
+ } else
+ verbose("%s: connected to %s", server->name, saddr->addrstr);
if (!server->scfg.rcon_password)
server->scfg.rcon_password = ask_password();
@@ -122,8 +124,8 @@ static int rcon_login(struct cfg *cfg, struct server *server)
goto error;
}
- send_msg(fd, buf, sizeof(buf), RCON_PACKET_LOGIN, server->scfg.rcon_password,
- &rtype, &reply);
+ send_msg(fd, buf, sizeof(buf), RCON_PACKET_LOGIN,
+ server->scfg.rcon_password, &rtype, &reply);
explicit_bzero(buf, sizeof(buf));
free_password(&server->scfg.rcon_password);