|
Lines 1434-1439
_dbus_connection_handle_watch (DBusWatch
Link Here
|
| 1434 |
|
1434 |
|
| 1435 |
_DBUS_DEFINE_GLOBAL_LOCK (shared_connections); |
1435 |
_DBUS_DEFINE_GLOBAL_LOCK (shared_connections); |
| 1436 |
static DBusHashTable *shared_connections = NULL; |
1436 |
static DBusHashTable *shared_connections = NULL; |
|
|
1437 |
static DBusList *shared_connections_no_guid = NULL; |
| 1438 |
|
| 1439 |
static void |
| 1440 |
close_connection_on_shutdown (DBusConnection *connection) |
| 1441 |
{ |
| 1442 |
DBusMessage *message; |
| 1443 |
|
| 1444 |
dbus_connection_ref (connection); |
| 1445 |
_dbus_connection_close_possibly_shared (connection); |
| 1446 |
|
| 1447 |
/* Churn through to the Disconnected message */ |
| 1448 |
while ((message = dbus_connection_pop_message (connection))) |
| 1449 |
{ |
| 1450 |
dbus_message_unref (message); |
| 1451 |
} |
| 1452 |
dbus_connection_unref (connection); |
| 1453 |
} |
| 1437 |
|
1454 |
|
| 1438 |
static void |
1455 |
static void |
| 1439 |
shared_connections_shutdown (void *data) |
1456 |
shared_connections_shutdown (void *data) |
|
Lines 1446-1452
shared_connections_shutdown (void *data)
Link Here
|
| 1446 |
while ((n_entries = _dbus_hash_table_get_n_entries (shared_connections)) > 0) |
1463 |
while ((n_entries = _dbus_hash_table_get_n_entries (shared_connections)) > 0) |
| 1447 |
{ |
1464 |
{ |
| 1448 |
DBusConnection *connection; |
1465 |
DBusConnection *connection; |
| 1449 |
DBusMessage *message; |
|
|
| 1450 |
DBusHashIter iter; |
1466 |
DBusHashIter iter; |
| 1451 |
|
1467 |
|
| 1452 |
_dbus_hash_iter_init (shared_connections, &iter); |
1468 |
_dbus_hash_iter_init (shared_connections, &iter); |
|
Lines 1455-1471
shared_connections_shutdown (void *data)
Link Here
|
| 1455 |
connection = _dbus_hash_iter_get_value (&iter); |
1471 |
connection = _dbus_hash_iter_get_value (&iter); |
| 1456 |
|
1472 |
|
| 1457 |
_DBUS_UNLOCK (shared_connections); |
1473 |
_DBUS_UNLOCK (shared_connections); |
| 1458 |
|
1474 |
close_connection_on_shutdown (connection); |
| 1459 |
dbus_connection_ref (connection); |
|
|
| 1460 |
_dbus_connection_close_possibly_shared (connection); |
| 1461 |
|
| 1462 |
/* Churn through to the Disconnected message */ |
| 1463 |
while ((message = dbus_connection_pop_message (connection))) |
| 1464 |
{ |
| 1465 |
dbus_message_unref (message); |
| 1466 |
} |
| 1467 |
dbus_connection_unref (connection); |
| 1468 |
|
| 1469 |
_DBUS_LOCK (shared_connections); |
1475 |
_DBUS_LOCK (shared_connections); |
| 1470 |
|
1476 |
|
| 1471 |
/* The connection should now be dead and not in our hash ... */ |
1477 |
/* The connection should now be dead and not in our hash ... */ |
|
Lines 1476-1481
shared_connections_shutdown (void *data)
Link Here
|
| 1476 |
|
1482 |
|
| 1477 |
_dbus_hash_table_unref (shared_connections); |
1483 |
_dbus_hash_table_unref (shared_connections); |
| 1478 |
shared_connections = NULL; |
1484 |
shared_connections = NULL; |
|
|
1485 |
|
| 1486 |
if (shared_connections_no_guid != NULL) |
| 1487 |
{ |
| 1488 |
DBusConnection *connection; |
| 1489 |
connection = _dbus_list_pop_first (&shared_connections_no_guid); |
| 1490 |
while (connection != NULL) |
| 1491 |
{ |
| 1492 |
_DBUS_UNLOCK (shared_connections); |
| 1493 |
close_connection_on_shutdown (connection); |
| 1494 |
_DBUS_LOCK (shared_connections); |
| 1495 |
connection = _dbus_list_pop_first (&shared_connections_no_guid); |
| 1496 |
} |
| 1497 |
} |
| 1498 |
|
| 1499 |
shared_connections_no_guid = NULL; |
| 1479 |
|
1500 |
|
| 1480 |
_DBUS_UNLOCK (shared_connections); |
1501 |
_DBUS_UNLOCK (shared_connections); |
| 1481 |
} |
1502 |
} |
|
Lines 1585-1591
connection_record_shared_unlocked (DBusC
Link Here
|
| 1585 |
_dbus_connection_ref_unlocked (connection); |
1606 |
_dbus_connection_ref_unlocked (connection); |
| 1586 |
|
1607 |
|
| 1587 |
if (guid == NULL) |
1608 |
if (guid == NULL) |
| 1588 |
return TRUE; /* don't store in the hash */ |
1609 |
{ |
|
|
1610 |
_DBUS_LOCK (shared_connections); |
| 1611 |
|
| 1612 |
if (!_dbus_list_prepend (&shared_connections_no_guid, connection)) |
| 1613 |
{ |
| 1614 |
_DBUS_UNLOCK (shared_connections); |
| 1615 |
return FALSE; |
| 1616 |
} |
| 1617 |
|
| 1618 |
_DBUS_UNLOCK (shared_connections); |
| 1619 |
return TRUE; /* don't store in the hash */ |
| 1620 |
} |
| 1589 |
|
1621 |
|
| 1590 |
/* A separate copy of the key is required in the hash table, because |
1622 |
/* A separate copy of the key is required in the hash table, because |
| 1591 |
* we don't have a lock on the connection when we are doing a hash |
1623 |
* we don't have a lock on the connection when we are doing a hash |