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

int DaemonCore::Cancel_Socket ( Stream insock  ) 

Not_Yet_Documented

Parameters:
insock Not_Yet_Documented
Returns:
Not_Yet_Documented

Definition at line 1376 of file daemon_core.cpp.

References Stream::peer_description().

Referenced by Cancel_And_Close_All_Sockets(), and RemoteResource::closeClaimSock().

{
      int i,j;

      i = -1;
      for (j=0;j<nSock;j++) {
            if ( (*sockTable)[j].iosock == insock ) {
                  i = j;
                  break;
            }
      }

      if ( i == -1 ) {
            dprintf( D_ALWAYS,"Cancel_Socket: called on non-registered socket!\n");
        if( insock ) {
            dprintf( D_ALWAYS,"Offending socket number %d to %s\n",
                     ((Sock *)insock)->get_file_desc(),
                     insock->peer_description());
        }
            DumpSocketTable( D_DAEMONCORE );
            return FALSE;
      }

      // Remove entry at index i by moving the last one in the table here.

      // Clear any data_ptr which go to this entry we just removed
      if ( curr_regdataptr == &( (*sockTable)[i].data_ptr) )
            curr_regdataptr = NULL;
      if ( curr_dataptr == &( (*sockTable)[i].data_ptr) )
            curr_dataptr = NULL;

      // Log a message
      dprintf(D_DAEMONCORE,"Cancel_Socket: cancelled socket %d <%s> %p\n",
                  i,(*sockTable)[i].iosock_descrip, (*sockTable)[i].iosock );

      // Remove entry, move the last one in the list into this spot
      (*sockTable)[i].iosock = NULL;
      free_descrip( (*sockTable)[i].iosock_descrip );
      (*sockTable)[i].iosock_descrip = NULL;
      free_descrip( (*sockTable)[i].handler_descrip );
      (*sockTable)[i].handler_descrip = NULL;
      if ( i < nSock - 1 ) {
            // if not the last entry in the table, move the last one here
            (*sockTable)[i] = (*sockTable)[nSock - 1];
            (*sockTable)[nSock - 1].iosock = NULL;
            (*sockTable)[nSock - 1].iosock_descrip = NULL;
            (*sockTable)[nSock - 1].handler_descrip = NULL;
      }
      nSock--;

      DumpSocketTable(D_FULLDEBUG | D_DAEMONCORE);

      return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index