about summary refs log tree commit diff
path: root/shared/nm-utils/nm-udev-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'shared/nm-utils/nm-udev-utils.c')
-rw-r--r--shared/nm-utils/nm-udev-utils.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/shared/nm-utils/nm-udev-utils.c b/shared/nm-utils/nm-udev-utils.c
index 709f7590..5d0919b3 100644
--- a/shared/nm-utils/nm-udev-utils.c
+++ b/shared/nm-utils/nm-udev-utils.c
@@ -241,26 +241,23 @@ nm_udev_client_new (const char *const*subsystems,
 		if (self->subsystems) {
 			/* install subsystem filters to only wake up for certain events */
 			for (n = 0; self->subsystems[n]; n++) {
-				if (self->monitor) {
-					gs_free char *to_free = NULL;
-					const char *subsystem;
-					const char *devtype;
-
-					_subsystem_split (self->subsystems[n], &subsystem, &devtype, &to_free);
-					udev_monitor_filter_add_match_subsystem_devtype (self->monitor, subsystem, devtype);
-				}
+				gs_free char *to_free = NULL;
+				const char *subsystem;
+				const char *devtype;
+
+				_subsystem_split (self->subsystems[n], &subsystem, &devtype, &to_free);
+				udev_monitor_filter_add_match_subsystem_devtype (self->monitor, subsystem, devtype);
 			}
 
 			/* listen to events, and buffer them */
-			if (self->monitor) {
-				udev_monitor_enable_receiving (self->monitor);
-				channel = g_io_channel_unix_new (udev_monitor_get_fd (self->monitor));
-				self->watch_source = g_io_create_watch (channel, G_IO_IN);
-				g_io_channel_unref (channel);
-				g_source_set_callback (self->watch_source, (GSourceFunc)(void (*) (void)) monitor_event, self, NULL);
-				g_source_attach (self->watch_source, g_main_context_get_thread_default ());
-				g_source_unref (self->watch_source);
-			}
+			udev_monitor_set_receive_buffer_size (self->monitor, 4*1024*1024);
+			udev_monitor_enable_receiving (self->monitor);
+			channel = g_io_channel_unix_new (udev_monitor_get_fd (self->monitor));
+			self->watch_source = g_io_create_watch (channel, G_IO_IN);
+			g_io_channel_unref (channel);
+			g_source_set_callback (self->watch_source, (GSourceFunc)(void (*) (void)) monitor_event, self, NULL);
+			g_source_attach (self->watch_source, g_main_context_get_thread_default ());
+			g_source_unref (self->watch_source);
 		}
 	}