Logo Search packages:      
Sourcecode: condor version File versions  Download package

int DaemonCore::ServiceCommandSocket (  ) 

Not_Yet_Documented

Returns:
Not_Yet_Documented

Definition at line 3129 of file daemon_core.cpp.

{
      Selector selector;
      int commands_served = 0;

      if ( inServiceCommandSocket_flag ) {
                  // this function is not reentrant
                  // and anyway, let's avoid potentially infinite recursion
            return 0;
      }

      // Just return if there is no command socket
      if ( initial_command_sock == -1 )
            return 0;
      if ( !( (*sockTable)[initial_command_sock].iosock) )
            return 0;

      // Setting timeout to 0 means do not block, i.e. just poll the socket
      selector.set_timeout( 0 );
      selector.add_fd( (*sockTable)[initial_command_sock].iosock->get_file_desc(),
                               Selector::IO_READ );

      inServiceCommandSocket_flag = TRUE;
      do {

            errno = 0;
            selector.execute();
#ifndef WIN32
            // Unix
            if ( selector.failed() ) {
                        // not just interrupted by a signal...
                        EXCEPT("select, error # = %d", errno);
            }
#else
            // Win32
            if ( selector.select_retval() == SOCKET_ERROR ) {
                  EXCEPT("select, error # = %d",WSAGetLastError());
            }
#endif

            if ( selector.has_ready() ) {
                  HandleReq( initial_command_sock );
                  commands_served++;
                        // Make sure we didn't leak our priv state
                  CheckPrivState();
            }

      } while ( selector.has_ready() );   // loop until no more commands waiting on socket

      inServiceCommandSocket_flag = FALSE;
      return commands_served;
}


Generated by  Doxygen 1.6.0   Back to index