2005-06-18 Ray Strode <rstrode@redhat.com>

* src/nm-netlink-monitor.c
	(nm_netlink_monitor_event_handler): check for the presence
	of either error condition not both.

	(nm_netlink_monitor_error_handler): emit error signal if
	error occurs.

	(nm_netlink_monitor_event_handler),
	(nm_netlink_monitor_error_handler),
	(nm_netlink_monitor_disconnect_handler): if an
	assertion fails disconnect the event handler to prevent
	infinite loops.

	* src/nm-netlink-monitor.h: add new error condition
	NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@719 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Ray Strode
2005-06-19 04:09:20 +00:00
parent 292c381113
commit 984d79a076
3 changed files with 36 additions and 6 deletions

View File

@@ -1,3 +1,21 @@
2005-06-18 Ray Strode <rstrode@redhat.com>
* src/nm-netlink-monitor.c
(nm_netlink_monitor_event_handler): check for the presence
of either error condition not both.
(nm_netlink_monitor_error_handler): emit error signal if
error occurs.
(nm_netlink_monitor_event_handler),
(nm_netlink_monitor_error_handler),
(nm_netlink_monitor_disconnect_handler): if an
assertion fails disconnect the event handler to prevent
infinite loops.
* src/nm-netlink-monitor.h: add new error condition
NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA
2005-06-18 Ray Strode <rstrode@redhat.com>
* src/nm-netlink-monitor.c

View File

@@ -576,14 +576,14 @@ nm_netlink_monitor_event_handler (GIOChannel *channel,
guint num_bytes_to_process;
struct nlmsghdr *header;
if (io_condition == NM_NETLINK_MONITOR_ERROR_CONDITIONS)
if (io_condition & NM_NETLINK_MONITOR_ERROR_CONDITIONS)
return nm_netlink_monitor_error_handler (channel, io_condition, monitor);
else if (io_condition == NM_NETLINK_MONITOR_DISCONNECT_CONDITIONS)
else if (io_condition & NM_NETLINK_MONITOR_DISCONNECT_CONDITIONS)
return nm_netlink_monitor_disconnect_handler (channel, io_condition, monitor);
g_return_val_if_fail (!(io_condition &
~(NM_NETLINK_MONITOR_EVENT_CONDITIONS)),
TRUE);
FALSE);
error = NULL;
@@ -722,9 +722,20 @@ nm_netlink_monitor_error_handler (GIOChannel *channel,
GIOCondition io_condition,
NmNetlinkMonitor *monitor)
{
GError *socket_error;
g_return_val_if_fail (!(io_condition &
~(NM_NETLINK_MONITOR_ERROR_CONDITIONS)),
TRUE);
FALSE);
socket_error =
g_error_new (NM_NETLINK_MONITOR_ERROR,
NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA,
_("error occured while waiting for data on socket"));
g_signal_emit (G_OBJECT (monitor),
nm_netlink_monitor_signals[ERROR],
0, socket_error);
return TRUE;
}
@@ -736,6 +747,6 @@ nm_netlink_monitor_disconnect_handler (GIOChannel *channel,
g_return_val_if_fail (!(io_condition &
~(NM_NETLINK_MONITOR_DISCONNECT_CONDITIONS)),
TRUE);
FALSE);
return FALSE;
}

View File

@@ -68,6 +68,7 @@ enum _NmNetlinkMonitorError
NM_NETLINK_MONITOR_ERROR_BINDING_TO_SOCKET,
NM_NETLINK_MONITOR_ERROR_BAD_SENDER,
NM_NETLINK_MONITOR_ERROR_BAD_SOCKET_DATA,
NM_NETLINK_MONITOR_ERROR_WAITING_FOR_SOCKET_DATA,
NM_NETLINK_MONITOR_ERROR_READING_FROM_SOCKET,
NM_NETLINK_MONITOR_ERROR_SENDING_TO_SOCKET
};