added ip to (dis)connect debug messages

This commit is contained in:
Dominik Geyer 2008-10-17 14:27:23 +00:00
parent d0b55de9b2
commit 70d7cb773c
2 changed files with 22 additions and 3 deletions

View file

@ -92,7 +92,14 @@ int netserver_close(NETSERVER *s)
int netserver_drop(NETSERVER *s, int client_id, const char *reason)
{
/* TODO: insert lots of checks here */
dbg_msg("net_server", "client dropped. cid=%d reason=\"%s\"", client_id, reason);
NETADDR addr;
netserver_client_addr(s, client_id, &addr);
dbg_msg("net_server", "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"",
client_id,
addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3],
reason
);
conn_disconnect(&s->slots[client_id].conn, reason);
if(s->del_client)

View file

@ -623,6 +623,8 @@ static void server_send_rcon_line_authed(const char *line, void *user_data)
static void server_process_client_packet(NETCHUNK *packet)
{
int cid = packet->client_id;
NETADDR addr;
int sys;
int msg = msg_unpack_start(packet->data, packet->data_size, &sys);
@ -686,7 +688,12 @@ static void server_process_client_packet(NETCHUNK *packet)
{
if(clients[cid].state == SRVCLIENT_STATE_CONNECTING)
{
dbg_msg("server", "player is ready. cid=%x", cid);
netserver_client_addr(net, cid, &addr);
dbg_msg("server", "player is ready. cid=%x ip=%d.%d.%d.%d",
cid,
addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]
);
clients[cid].state = SRVCLIENT_STATE_READY;
mods_connected(cid);
}
@ -695,7 +702,12 @@ static void server_process_client_packet(NETCHUNK *packet)
{
if(clients[cid].state == SRVCLIENT_STATE_READY)
{
dbg_msg("server", "player as entered the game. cid=%x", cid);
netserver_client_addr(net, cid, &addr);
dbg_msg("server", "player has entered the game. cid=%x ip=%d.%d.%d.%d",
cid,
addr.ip[0], addr.ip[1], addr.ip[2], addr.ip[3]
);
clients[cid].state = SRVCLIENT_STATE_INGAME;
mods_client_enter(cid);
}