Move other_addr from netplay to connection.

This commit is contained in:
Gregor Richards 2016-12-09 22:29:02 -05:00
parent d1d29143b2
commit ea722b49c8
3 changed files with 8 additions and 6 deletions

View File

@ -202,12 +202,13 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
while (tmp_info)
{
struct sockaddr_storage sad;
int fd = init_tcp_connection(
tmp_info,
direct_host || server,
netplay->spectate.enabled,
(struct sockaddr*)&netplay->other_addr,
sizeof(netplay->other_addr));
(struct sockaddr*)&sad,
sizeof(sad));
if (fd >= 0)
{
@ -216,6 +217,7 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
{
netplay->connections[0].active = true;
netplay->connections[0].fd = fd;
netplay->connections[0].addr = sad;
}
else
{

View File

@ -262,7 +262,7 @@ static void netplay_handshake_ready(netplay_t *netplay, struct netplay_connectio
if (netplay->is_server)
{
netplay_log_connection(&netplay->other_addr, 0, connection->nick);
netplay_log_connection(&connection->addr, 0, connection->nick);
/* Send them the savestate */
if (!(netplay->quirks & (NETPLAY_QUIRK_NO_SAVESTATES|NETPLAY_QUIRK_NO_TRANSMISSION)))

View File

@ -232,6 +232,9 @@ struct netplay_connection
/* fd associated with this connection */
int fd;
/* Address of peer */
struct sockaddr_storage addr;
/* Nickname of peer */
char nick[32];
@ -250,9 +253,6 @@ struct netplay
/* Our nickname */
char nick[32];
/* Address of peer */
struct sockaddr_storage other_addr;
/* TCP connection for listening (server only) */
int listen_fd;