mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(netplay.c) Simplify init_tcp_connection
This commit is contained in:
parent
8ce32e01cd
commit
d4a08d7ec7
@ -90,9 +90,7 @@ static void video_frame(const void *data, unsigned width,
|
||||
|
||||
if (g_extern.filter.filter && data)
|
||||
{
|
||||
unsigned owidth = 0;
|
||||
unsigned oheight = 0;
|
||||
unsigned opitch = 0;
|
||||
unsigned owidth = 0, oheight = 0, opitch = 0;
|
||||
|
||||
rarch_softfilter_get_output_size(g_extern.filter.filter,
|
||||
&owidth, &oheight, width, height);
|
||||
@ -469,7 +467,6 @@ static int16_t input_state(unsigned port, unsigned device,
|
||||
* input_poll_overlay:
|
||||
*
|
||||
* Poll pressed buttons/keys on currently active overlay.
|
||||
*
|
||||
**/
|
||||
static inline void input_poll_overlay(void)
|
||||
{
|
||||
|
31
netplay.c
31
netplay.c
@ -285,39 +285,30 @@ static int init_tcp_connection(const struct addrinfo *res,
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (spectate)
|
||||
{
|
||||
int yes = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, CONST_CAST &yes, sizeof(int));
|
||||
|
||||
if (bind(fd, res->ai_addr, res->ai_addrlen) < 0 ||
|
||||
listen(fd, MAX_SPECTATORS) < 0)
|
||||
{
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int yes = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, CONST_CAST &yes, sizeof(int));
|
||||
|
||||
if (bind(fd, res->ai_addr, res->ai_addrlen) < 0 ||
|
||||
listen(fd, 1) < 0)
|
||||
listen(fd, spectate ? MAX_SPECTATORS : 1) < 0)
|
||||
{
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
|
||||
int new_fd = accept(fd, other_addr, &addr_size);
|
||||
if (new_fd < 0)
|
||||
if (!spectate)
|
||||
{
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
int new_fd = accept(fd, other_addr, &addr_size);
|
||||
if (new_fd < 0)
|
||||
{
|
||||
ret = false;
|
||||
goto end;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
fd = new_fd;
|
||||
close(fd);
|
||||
fd = new_fd;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
Loading…
x
Reference in New Issue
Block a user