mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
Optimize Net module for Android (#4517)
* epoll is available on Android * <ifaddrs.h> is introduced in android-24
This commit is contained in:
parent
ece360393f
commit
3496e47475
@ -134,7 +134,7 @@ POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_WINDOWS_NT)
|
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_WINDOWS_NT) || (POCO_OS == POCO_OS_ANDROID)
|
||||||
#define POCO_HAVE_FD_EPOLL 1
|
#define POCO_HAVE_FD_EPOLL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1486,7 +1486,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
|||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if POCO_OS != POCO_OS_ANDROID // Android doesn't have <ifaddrs.h>
|
#if POCO_OS != POCO_OS_ANDROID || __ANDROID_API__ >= 24 // old Android doesn't have <ifaddrs.h>
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
@ -1521,7 +1521,7 @@ static NetworkInterface::Type fromNative(unsigned arphrd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN)
|
#if (POCO_OS != POCO_OS_ANDROID || __ANDROID_API__ >= 24) && !defined(POCO_EMSCRIPTEN)
|
||||||
|
|
||||||
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
||||||
{
|
{
|
||||||
@ -1580,7 +1580,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
|
|||||||
|
|
||||||
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
|
||||||
{
|
{
|
||||||
#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN)
|
#if (POCO_OS != POCO_OS_ANDROID || __ANDROID_API__ >= 24) && !defined(POCO_EMSCRIPTEN)
|
||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
Map result;
|
Map result;
|
||||||
unsigned ifIndex = 0;
|
unsigned ifIndex = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user