Changeset 55251 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Apr 14, 2015 2:43:40 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/HostImpl.cpp
r55223 r55251 5 5 6 6 /* 7 * Copyright (C) 2004-201 4Oracle Corporation7 * Copyright (C) 2004-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 614 614 { 615 615 #if defined(RT_OS_WINDOWS) || defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/ 616 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);617 618 616 # ifdef VBOX_WITH_HOSTNETIF_API 619 int rc = i_updateNetIfList(); 620 if (rc) 621 Log(("Failed to get host network interface list with rc=%Rrc\n", rc)); 617 HRESULT rc = i_updateNetIfList(); 618 if (FAILED(rc)) 619 { 620 Log(("Failed to update host network interface list with rc=%Rhrc\n", rc)); 621 return rc; 622 } 623 624 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 622 625 623 626 aNetworkInterfaces.resize(m->llNetIfs.size()); … … 1486 1489 return E_INVALIDARG; 1487 1490 1488 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1489 1490 aNetworkInterface = NULL; 1491 HRESULT rc = i_updateNetIfList(); 1492 if (FAILED(rc)) 1493 { 1494 Log(("Failed to update host network interface list with rc=%Rhrc\n", rc)); 1495 return rc; 1496 } 1497 1498 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1491 1499 1492 1500 ComObjPtr<HostNetworkInterface> found; 1493 int rc = i_updateNetIfList();1494 if (RT_FAILURE(rc))1495 {1496 Log(("Failed to get host network interface list with rc=%Rrc\n", rc));1497 return E_FAIL;1498 }1499 1501 for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it) 1500 1502 { … … 1522 1524 return E_INVALIDARG; 1523 1525 1524 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1525 1526 aNetworkInterface = NULL; 1526 HRESULT rc = i_updateNetIfList(); 1527 if (FAILED(rc)) 1528 { 1529 Log(("Failed to update host network interface list with rc=%Rhrc\n", rc)); 1530 return rc; 1531 } 1532 1533 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1527 1534 1528 1535 ComObjPtr<HostNetworkInterface> found; 1529 int rc = i_updateNetIfList(); 1530 if (RT_FAILURE(rc)) 1531 { 1532 Log(("Failed to get host network interface list with rc=%Rrc\n", rc)); 1533 return E_FAIL; 1534 } 1535 HostNetworkInterfaceList::iterator it; 1536 for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it) 1536 for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it) 1537 1537 { 1538 1538 Bstr g; … … 1554 1554 { 1555 1555 #ifdef VBOX_WITH_HOSTNETIF_API 1556 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1557 int rc = i_updateNetIfList(); 1558 if (RT_FAILURE(rc)) 1559 return E_FAIL; 1556 HRESULT rc = i_updateNetIfList(); 1557 if (FAILED(rc)) 1558 { 1559 Log(("Failed to update host network interface list with rc=%Rhrc\n", rc)); 1560 return rc; 1561 } 1562 1563 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1560 1564 1561 1565 HostNetworkInterfaceList resultList; 1562 1563 1566 for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it) 1564 1567 { … … 2951 2954 { 2952 2955 #ifdef VBOX_WITH_HOSTNETIF_API 2953 AssertReturn( getObjectState().getState() == ObjectState::InInit 2954 || isWriteLockOnCurrentThread(), E_FAIL); 2955 2956 HostNetworkInterfaceList list, listCopy; 2956 AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL); 2957 2958 /** @todo r=klaus it would save lots of clock cycles if for concurrent 2959 * threads executing this code we'd only do one interface enumeration 2960 * and update, and let the other threads use the result as is. However 2961 * if there's a constant hammering of this method, we don't want this 2962 * to cause update starvation. */ 2963 HostNetworkInterfaceList list; 2957 2964 int rc = NetIfList(list); 2958 2965 if (rc) … … 2961 2968 return E_FAIL; 2962 2969 } 2970 2971 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2972 2963 2973 AssertReturn(m->pParent, E_FAIL); 2964 2974 /* Make a copy as the original may be partially destroyed later. */ 2965 listCopy = list;2975 HostNetworkInterfaceList listCopy(list); 2966 2976 HostNetworkInterfaceList::iterator itOld, itNew; 2967 2977 # ifdef VBOX_WITH_RESOURCE_USAGE_API … … 3001 3011 { 3002 3012 HostNetworkInterfaceType_T t; 3003 HRESULT hr = (*itNew)->COMGETTER(InterfaceType)(&t);3004 if (FAILED(hr ))3013 HRESULT hrc = (*itNew)->COMGETTER(InterfaceType)(&t); 3014 if (FAILED(hrc)) 3005 3015 { 3006 3016 Bstr n;
Note:
See TracChangeset
for help on using the changeset viewer.