Greetings,

We have an application which utilizes udt4 library as part of network stack to transfer files in p2p mode. When running our application on Windows, somehow SetThreadAffinityMask in common.cpp returned incorrect value, which caues our application crashed.

We finally solved the issue (perhaps it was just a workaround solution) by commenting some lines as followings. Hope this might help those who have also bumped into the same issue. Here you are.

uint64_t CTimer::getTime()
{
   //For Cygwin and other systems without microsecond level resolution, uncomment the following three lines
   //uint64_t x;
   //rdtsc(x);
   //return x / s_ullCPUFrequency;
   //Specific fix may be necessary if rdtsc is not available either.

   #ifndef WIN32
      timeval t;
      gettimeofday(&t, 0);
      return t.tv_sec * 1000000ULL + t.tv_usec;
   #else
      LARGE_INTEGER ccf;
      //HANDLE hCurThread = ::GetCurrentThread(); 
      //DWORD_PTR dwOldMask = ::SetThreadAffinityMask(hCurThread, 1);
      if (QueryPerformanceFrequency(&ccf))
      {
         LARGE_INTEGER cc;
         if (QueryPerformanceCounter(&cc))
         {
            //SetThreadAffinityMask(hCurThread, dwOldMask); 
            return (cc.QuadPart * 1000000ULL / ccf.QuadPart);
         }
      }

      //SetThreadAffinityMask(hCurThread, dwOldMask); 
      return GetTickCount() * 1000ULL;
   #endif
}