summary refs log tree commit diff stats
path: root/io/channel-socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/channel-socket.c')
-rw-r--r--io/channel-socket.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 1cd58487b0..6ec87f8cdb 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -400,7 +400,17 @@ static void qio_channel_socket_init(Object *obj)
 static void qio_channel_socket_finalize(Object *obj)
 {
     QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(obj);
+
     if (ioc->fd != -1) {
+        if (QIO_CHANNEL(ioc)->features & QIO_CHANNEL_FEATURE_LISTEN) {
+            Error *err = NULL;
+
+            socket_listen_cleanup(ioc->fd, &err);
+            if (err) {
+                error_report_err(err);
+                err = NULL;
+            }
+        }
 #ifdef WIN32
         WSAEventSelect(ioc->fd, NULL, 0);
 #endif