[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] io: set LISTEN flag explicitly for listen sockets



commit bf5352082727df7207c54cf3fc5fb608dc2b1fda
Author:     Daniel P. Berrange <berrange@xxxxxxxxxx>
AuthorDate: Wed Oct 26 18:20:20 2016 +0200
Commit:     Daniel P. Berrange <berrange@xxxxxxxxxx>
CommitDate: Thu Oct 27 09:13:00 2016 +0200

    io: set LISTEN flag explicitly for listen sockets
    
    The SO_ACCEPTCONN ioctl is not portable across OS, with
    some BSD versions and OS-X not supporting it. There is
    no viable alternative to this, so instead just set the
    feature explicitly when creating a listener socket.
    
    The current users of qio_channel_socket_new_fd() won't
    ever be given a listening socket, so there's no problem
    with no auto-detecting it in this scenario
    
    Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 io/channel-socket.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/io/channel-socket.c b/io/channel-socket.c
index 75cbca3..d7e03f6 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -72,9 +72,6 @@ qio_channel_socket_set_fd(QIOChannelSocket *sioc,
                           int fd,
                           Error **errp)
 {
-    int val;
-    socklen_t len = sizeof(val);
-
     if (sioc->fd != -1) {
         error_setg(errp, "Socket is already open");
         return -1;
@@ -110,10 +107,6 @@ qio_channel_socket_set_fd(QIOChannelSocket *sioc,
         qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS);
     }
 #endif /* WIN32 */
-    if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &val, &len) == 0 && val) {
-        QIOChannel *ioc = QIO_CHANNEL(sioc);
-        qio_channel_set_feature(ioc, QIO_CHANNEL_FEATURE_LISTEN);
-    }
 
     return 0;
 
@@ -220,6 +213,7 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
         close(fd);
         return -1;
     }
+    qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_LISTEN);
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.