SVN commit 932472 by guisson: Merge windows fixes from stable M +1 -1 net/downloadthread.cpp M +8 -0 net/wakeuppipe.cpp M +7 -2 util/functions.cpp M +3 -1 util/win32.h --- trunk/extragear/network/ktorrent/libbtcore/net/downloadthread.cpp #932471:932472 @@ -182,7 +182,7 @@ #ifndef Q_WS_WIN return poll(&fd_vec[0],i,-1); #else - return mingw_poll(&fd_vec[0],i,-1); + return mingw_poll(&fd_vec[0],i,1000); #endif } --- trunk/extragear/network/ktorrent/libbtcore/net/wakeuppipe.cpp #932471:932472 @@ -30,33 +30,41 @@ WakeUpPipe::WakeUpPipe() : reader(-1),writer(-1) { +#ifndef Q_WS_WIN int sockets[2]; if (socketpair(AF_UNIX,SOCK_STREAM,0,sockets) == 0) { reader = sockets[1]; writer = sockets[0]; } +#endif } WakeUpPipe::~WakeUpPipe() { +#ifndef Q_WS_WIN ::close(reader); ::close(writer); +#endif } void WakeUpPipe::wakeUp() { +#ifndef Q_WS_WIN char dummy[] = "dummy"; int ret = write(writer,dummy,5); if (ret != 5) Out(SYS_GEN|LOG_DEBUG) << "WakeUpPipe: wake up failed " << ret << endl; +#endif } void WakeUpPipe::handleData() { +#ifndef Q_WS_WIN bt::Uint8 buf[20]; if (read(reader,buf,20) < 0) Out(SYS_GEN|LOG_DEBUG) << "WakeUpPipe: read failed" << endl; +#endif } } --- trunk/extragear/network/ktorrent/libbtcore/util/functions.cpp #932471:932472 @@ -239,13 +239,18 @@ QString NetworkInterfaceIPAddress(const QString & iface) { +#ifdef Q_WS_WIN + QString any = QHostAddress(QHostAddress::Any).toString(); +#else + QString any = QHostAddress(QHostAddress::AnyIPv6).toString(); +#endif QNetworkInterface ni = QNetworkInterface::interfaceFromName(iface); if (!ni.isValid()) - return QString("::"); + return any; QList addr_list = ni.addressEntries(); if (addr_list.count() == 0) - return QString("::"); + return any; else return addr_list.front().ip().toString(); } --- trunk/extragear/network/ktorrent/libbtcore/util/win32.h #932471:932472 @@ -59,8 +59,10 @@ // #define EINPROGRESS WSAEINPROGRESS // #define EISCONN WSAEISCONN -#if ( ( defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600) ) || ( defined(_MSC_VER) && (_MSC_VER < 1500 ) ) ) // If VC++ 8.0 or older OR Windows older than Vista + +#if (_WIN32_WINNT < 0x0600) // If VC++ 8.0 or older OR Windows older than Vista + /* winsock doesn't feature poll(), so there is a version implemented * in terms of select() in win32.cpp. The following definitions * are copied from linux man pages. A poll() macro is defined to