diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-08-05 21:36:31 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2006-08-05 21:36:31 +0000 | 
| commit | 3c6404cd942f3b69968a390fae2a57dd2980e21a (patch) | |
| tree | aebb91523397fc914c0479971d1ad6744138f535 /hcid/dbus.c | |
| parent | 70bbff923c930053ab15601023bdc12ba0258077 (diff) | |
fixed message reply timeout
Diffstat (limited to 'hcid/dbus.c')
| -rw-r--r-- | hcid/dbus.c | 24 | 
1 files changed, 15 insertions, 9 deletions
| diff --git a/hcid/dbus.c b/hcid/dbus.c index 206d3343..3a6c8e53 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -1427,11 +1427,25 @@ static int timeout_handler_dispatch(gpointer data)  {  	timeout_handler_t *handler = data; +	/* if not enabled should not be polled by the main loop */ +	if (dbus_timeout_get_enabled(handler->timeout) != TRUE) +		return -1; +  	dbus_timeout_handle(handler->timeout);  	return -1;  } +static void timeout_handler_free(void *data) +{ +	timeout_handler_t *handler = data; +	if (!handler) +		return; + +	g_timeout_remove(handler->id); +	free(handler); +} +  static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)  {  	timeout_handler_t *handler; @@ -1446,22 +1460,14 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data)  	handler->id = g_timeout_add(dbus_timeout_get_interval(timeout),  					timeout_handler_dispatch, handler); -	dbus_timeout_set_data(timeout, handler, NULL); +	dbus_timeout_set_data(timeout, handler, timeout_handler_free);  	return TRUE;  }  static void remove_timeout(DBusTimeout *timeout, void *data)  { -	timeout_handler_t *handler; - -	handler = dbus_timeout_get_data(timeout); -	if(handler == NULL) -		return; - -	g_timeout_remove(handler->id); -	free(handler);  }  static void timeout_toggled(DBusTimeout *timeout, void *data) | 
