Reviving netplay_log_connection, i.e. connection messages on the host

This commit is contained in:
Gregor Richards 2016-10-05 07:52:14 -04:00
parent cda0324627
commit 49b4143687
2 changed files with 25 additions and 6 deletions

View File

@ -898,6 +898,7 @@ void netplay_log_connection(const struct sockaddr_storage *their_addr,
const char *str = NULL;
char buf_v4[INET_ADDRSTRLEN] = {0};
char buf_v6[INET6_ADDRSTRLEN] = {0};
char msg[512] = {0};
u.storage = their_addr;
@ -937,14 +938,34 @@ void netplay_log_connection(const struct sockaddr_storage *their_addr,
if (str)
{
char msg[512] = {0};
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\" (#%u)",
nick, str, slot);
snprintf(msg, sizeof(msg), "Got connection from: \"%s (%s)\"",
nick, str);
runloop_msg_queue_push(msg, 1, 180, false);
RARCH_LOG("%s\n", msg);
}
else
{
snprintf(msg, sizeof(msg), "Got connection from: \"%s\"",
nick);
runloop_msg_queue_push(msg, 1, 180, false);
RARCH_LOG("%s\n", msg);
}
RARCH_LOG("Connection slot %u\n", slot);
}
#else
void netplay_log_connection(const struct sockaddr_storage *their_addr,
unsigned slot, const char *nick)
{
char msg[512] = {0};
snprintf(msg, sizeof(msg), "Got connection from: \"%s\"",
nick);
runloop_msg_queue_push(msg, 1, 180, false);
RARCH_LOG("%s\n", msg);
RARCH_LOG("Connection slot %u\n", slot);
}
#endif

View File

@ -339,9 +339,7 @@ bool netplay_get_info(netplay_t *netplay)
}
}
#ifndef HAVE_SOCKET_LEGACY
netplay_log_connection(&netplay->other_addr, 0, netplay->other_nick);
#endif
return true;
}