* Fixed a bug in get_interface() that would return the first interface

without acquiring a reference to it, and thus led to bug #6565.
* Added a commented out function that dumps all current reference counts.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38867 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-10-01 06:52:18 +00:00
parent d32f94f43c
commit ec4fb0f4f0
1 changed files with 20 additions and 3 deletions

View File

@ -85,6 +85,22 @@ static AddressTable sAddressTable;
static uint32 sInterfaceIndex;
#if 0
//! For debugging purposes only
void
dump_interface_refs(void)
{
MutexLocker locker(sLock);
InterfaceList::Iterator iterator = sInterfaces.GetIterator();
while (Interface* interface = iterator.Next()) {
dprintf("%p: %s, %ld\n", interface, interface->name,
interface->CountReferences());
}
}
#endif
#if ENABLE_DEBUGGER_COMMANDS
@ -1345,10 +1361,11 @@ get_interface(net_domain* domain, uint32 index)
{
MutexLocker locker(sLock);
Interface* interface;
if (index == 0)
return sInterfaces.First();
Interface* interface = find_interface(index);
interface = sInterfaces.First();
else
interface = find_interface(index);
if (interface == NULL)
return NULL;