[libvirt] [PATCH] Don't use SO_REUSEADDR on Win32 platforms

Eric Blake eblake at redhat.com
Fri Apr 25 16:56:03 UTC 2014


On 04/25/2014 10:47 AM, Daniel P. Berrange wrote:
> SO_REUSEADDR on Windows is actually akin to SO_REUSEPORT
> on Linux/BSD. ie it allows 2 apps to listen to the same
> port at once. Thus we must not set it on Win32 platforms
> 
> See http://msdn.microsoft.com/en-us/library/windows/desktop/ms740621.aspx
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/rpc/virnetsocket.c      | 16 ++++++++++++++++
>  src/util/virportallocator.c |  9 +++++++++
>  2 files changed, 25 insertions(+)

I'd rather see a v2 that does more along the lines of what qemu did:
they added a wrapper function socket_set_fast_reuse() that hides the
platform #ifdefs into the wrapper instead of every caller.  From
libvirt's perspective, I thinking something like:

int virSocketSetFastReuse(int fd)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140425/b7e15535/attachment-0001.sig>


More information about the libvir-list mailing list