Is it a bug?

Started by 165432896, June 15, 2012, 06:03:52 AM

Previous topic - Next topic

165432896

hi,victor
    netxms 1.1.6   in /src/server/core/Client.cpp::ClientListener()

while(!IsShutdownInProgress())
   {
      iSize = sizeof(struct sockaddr_in);
      if ((sockClient = accept(sock, (struct sockaddr *)&servAddr, &iSize)) == -1)
      {
         int error;

#ifdef _WIN32
         error = WSAGetLastError();
         if (error != WSAEINTR)
#else
         error = errno;
         if (error != EINTR)
#endif
            nxlog_write(MSG_ACCEPT_ERROR, EVENTLOG_ERROR_TYPE, "e", error);
         errorCount++;
         if (errorCount > 1000)
         {
            nxlog_write(MSG_TOO_MANY_ACCEPT_ERRORS, EVENTLOG_WARNING_TYPE, NULL);
            errorCount = 0;
         }
         ThreadSleepMs(500);
      }

      errorCount = 0;     // Reset consecutive errors counter

      // Create new session structure and threads
      pSession = new ClientSession(sockClient, (struct sockaddr *)&servAddr);
      if (!RegisterSession(pSession))
      {
         delete pSession;
      }
      else
      {
         pSession->run();
      }


when accept error, The sockClient is -1, Then ThreadSleepMs(500);  but it will continue to create ClientSession with the wrong sockClient .
Don't it we should insert " continue; " after ThreadSleepMs(500); to skip this round cycle.

Victor Kirhenshtein

Hi!

Yes, you are absolutely right. I fixed that in a trunk.

Best regards,
Victor