Skip to content

Commit

Permalink
gdbstub: call socket_set_fast_reuse instead of setting SO_REUSEADDR
Browse files Browse the repository at this point in the history
SO_REUSEADDR should be avoided on Windows but is desired on other operating
systems. So instead of setting it we call socket_set_fast_reuse that will result
in the appropriate behaviour on all operating systems.

Signed-off-by: Sebastian Ottlik <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
Sebastian Ottlik authored and stweil committed Oct 2, 2013
1 parent 606600a commit 6669ca1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ static void gdb_accept(void)
static int gdbserver_open(int port)
{
struct sockaddr_in sockaddr;
int fd, val, ret;
int fd, ret;

fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
Expand All @@ -1564,9 +1564,7 @@ static int gdbserver_open(int port)
fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif

/* allow fast reuse */
val = 1;
qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
socket_set_fast_reuse(fd);

sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(port);
Expand Down

0 comments on commit 6669ca1

Please sign in to comment.