Skip to content

Commit

Permalink
Set SO_REUSEADDR before calling bind().
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1783 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
pbrook committed Mar 11, 2006
1 parent f5ba07d commit b55669b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion slirp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ solisten(port, laddr, lport, flags)
addr.sin_port = port;

if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we failed */
Expand All @@ -587,7 +588,6 @@ solisten(port, laddr, lport, flags)
#endif
return NULL;
}
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));

getsockname(s,(struct sockaddr *)&addr,&addrlen);
Expand Down

0 comments on commit b55669b

Please sign in to comment.