mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 19:38:02 +02:00
2007-09-24 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-utils.h libnm-util/nm-utils.c - (nm_dbus_send_with_callback_replied, nm_dbus_send_with_callback): remove, unused git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2862 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
9be69751f4
commit
336def9492
3 changed files with 7 additions and 138 deletions
|
|
@ -1,3 +1,10 @@
|
|||
2007-09-24 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-util/nm-utils.h
|
||||
libnm-util/nm-utils.c
|
||||
- (nm_dbus_send_with_callback_replied, nm_dbus_send_with_callback):
|
||||
remove, unused
|
||||
|
||||
2007-09-23 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* vpn-daemons/vpnc/properties/nm-vpnc.c
|
||||
|
|
|
|||
|
|
@ -351,133 +351,6 @@ out:
|
|||
return new_ssid;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Pending Call Debug stuff
|
||||
*
|
||||
*/
|
||||
typedef struct PCallInfo
|
||||
{
|
||||
DBusPendingCall * pcall;
|
||||
char * caller;
|
||||
guint32 id;
|
||||
GTimeVal start;
|
||||
} PCallInfo;
|
||||
|
||||
static GStaticMutex pcall_mutex = G_STATIC_MUTEX_INIT;
|
||||
static GHashTable * pcall_table = NULL;
|
||||
static guint32 pcall_gid = 0;
|
||||
static guint32 pcall_pending = 0;
|
||||
|
||||
|
||||
DBusPendingCall *
|
||||
nm_dbus_send_with_callback (DBusConnection *connection,
|
||||
DBusMessage *msg,
|
||||
DBusPendingCallNotifyFunction func,
|
||||
gpointer data,
|
||||
DBusFreeFunction free_func,
|
||||
const char *caller)
|
||||
{
|
||||
PCallInfo * info = NULL;
|
||||
DBusPendingCall * pcall = NULL;
|
||||
|
||||
g_return_val_if_fail (connection != NULL, NULL);
|
||||
g_return_val_if_fail (msg != NULL, NULL);
|
||||
g_return_val_if_fail (func != NULL, NULL);
|
||||
g_return_val_if_fail (caller != NULL, NULL);
|
||||
|
||||
if (!(info = g_malloc0 (sizeof (PCallInfo))))
|
||||
{
|
||||
g_warning ("Error: '%s' couldn't allocate memory for tracking PCall.", caller);
|
||||
if (free_func)
|
||||
(*free_func)(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dbus_connection_send_with_reply (connection, msg, &pcall, -1);
|
||||
if (!pcall)
|
||||
{
|
||||
g_warning ("Error: '%s' couldn't send dbus message.", caller);
|
||||
if (free_func)
|
||||
(*free_func)(data);
|
||||
g_free (info);
|
||||
return NULL;
|
||||
}
|
||||
dbus_pending_call_set_notify (pcall, func, data, free_func);
|
||||
|
||||
info->caller = g_strdup (caller);
|
||||
info->pcall = pcall;
|
||||
g_get_current_time (&info->start);
|
||||
dbus_pending_call_ref (pcall);
|
||||
|
||||
g_static_mutex_lock (&pcall_mutex);
|
||||
info->id = pcall_gid++;
|
||||
pcall_pending++;
|
||||
|
||||
if (!pcall_table)
|
||||
pcall_table = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
g_hash_table_insert (pcall_table, pcall, info);
|
||||
|
||||
#ifdef DBUS_PENDING_CALL_DEBUG
|
||||
nm_info ("PCall Debug: new id %d (%p), from '%s' (%s), "
|
||||
"%d pending.", info->id, pcall, info->caller,
|
||||
dbus_message_get_member (msg), pcall_pending);
|
||||
#endif
|
||||
|
||||
g_static_mutex_unlock (&pcall_mutex);
|
||||
|
||||
return pcall;
|
||||
}
|
||||
|
||||
void
|
||||
nm_dbus_send_with_callback_replied (DBusPendingCall *pcall,
|
||||
const char *caller)
|
||||
{
|
||||
PCallInfo * info;
|
||||
#ifdef DBUS_PENDING_CALL_DEBUG
|
||||
GTimeVal now;
|
||||
long elapsed_ms = 0;
|
||||
#endif
|
||||
|
||||
g_return_if_fail (pcall != NULL);
|
||||
g_return_if_fail (caller != NULL);
|
||||
|
||||
g_static_mutex_lock (&pcall_mutex);
|
||||
if (!(info = g_hash_table_lookup (pcall_table, pcall)))
|
||||
{
|
||||
nm_warning ("Error: couldn't find pending call %p in tracking"
|
||||
" table.", pcall);
|
||||
goto out;
|
||||
}
|
||||
|
||||
pcall_pending--;
|
||||
#ifdef DBUS_PENDING_CALL_DEBUG
|
||||
g_get_current_time (&now);
|
||||
if (info->start.tv_usec > now.tv_usec)
|
||||
{
|
||||
now.tv_sec--;
|
||||
now.tv_usec = G_USEC_PER_SEC - (info->start.tv_usec - now.tv_usec);
|
||||
}
|
||||
else
|
||||
now.tv_usec -= info->start.tv_usec;
|
||||
now.tv_sec -= info->start.tv_sec;
|
||||
elapsed_ms = now.tv_sec * G_USEC_PER_SEC + now.tv_usec;
|
||||
elapsed_ms /= 1000;
|
||||
|
||||
nm_info ("PCall Debug: unregistered ID %d (%p), %s -> %s,"
|
||||
" %lums elapsed. Total pending: %d", info->id, info->pcall, info->caller,
|
||||
caller, elapsed_ms, pcall_pending);
|
||||
#endif
|
||||
|
||||
g_hash_table_remove (pcall_table, pcall);
|
||||
g_free (info->caller);
|
||||
dbus_pending_call_unref (info->pcall);
|
||||
g_free (info);
|
||||
|
||||
out:
|
||||
g_static_mutex_unlock (&pcall_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
value_destroy (gpointer data)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,17 +131,6 @@ gchar *nm_dbus_unescape_object_path (const gchar *object_path);
|
|||
|
||||
char *nm_utils_ssid_to_utf8 (const char *ssid, guint32 len);
|
||||
|
||||
/* #define DBUS_PENDING_CALL_DEBUG */
|
||||
|
||||
DBusPendingCall * nm_dbus_send_with_callback (DBusConnection *connection,
|
||||
DBusMessage *msg,
|
||||
DBusPendingCallNotifyFunction func,
|
||||
gpointer data,
|
||||
DBusFreeFunction free_func,
|
||||
const char *caller);
|
||||
void nm_dbus_send_with_callback_replied (DBusPendingCall *pcall,
|
||||
const char *caller);
|
||||
|
||||
GHashTable *nm_utils_gvalue_hash_dup (GHashTable *hash);
|
||||
char *nm_utils_garray_to_string (GArray *array);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue