parameters: (self)
docstring: Initializes the host forwarder daemon.
  
      Note that the global lock must be acquired before calling this method. This
      method kills any existing host_forwarder process that could be stale.
docstring_summary: Initializes the host forwarder daemon.
docstring_tokens: Initializes the host forwarder daemon .
function: def _InitHostLocked(self):
      """Initializes the host forwarder daemon.
  
      Note that the global lock must be acquired before calling this method. This
      method kills any existing host_forwarder process that could be stale.
      """
      # See if the host_forwarder daemon was already initialized by a concurrent
      # process or thread (in case multi-process sharding is not used).
      pid_for_lock = Forwarder._GetPidForLock()
      fd = os.open(Forwarder._LOCK_PATH, os.O_RDWR | os.O_CREAT)
      with os.fdopen(fd, 'r+') as pid_file:
        pid_with_start_time = pid_file.readline()
        if pid_with_start_time:
          (pid, process_start_time) = pid_with_start_time.split(':')
          if pid == str(pid_for_lock):
            if process_start_time == str(_GetProcessStartTime(pid_for_lock)):
              return
        self._KillHostLocked()
        pid_file.seek(0)
        pid_file.write(
            '%s:%s' % (pid_for_lock, str(_GetProcessStartTime(pid_for_lock))))
        pid_file.truncate()
function_tokens: def _InitHostLocked ( self ) : # See if the host_forwarder daemon was already initialized by a concurrent # process or thread (in case multi-process sharding is not used). pid_for_lock = Forwarder . _GetPidForLock ( ) fd = os . open ( Forwarder . _LOCK_PATH , os . O_RDWR | os . O_CREAT ) with os . fdopen ( fd , 'r+' ) as pid_file : pid_with_start_time = pid_file . readline ( ) if pid_with_start_time : ( pid , process_start_time ) = pid_with_start_time . split ( ':' ) if pid == str ( pid_for_lock ) : if process_start_time == str ( _GetProcessStartTime ( pid_for_lock ) ) : return self . _KillHostLocked ( ) pid_file . seek ( 0 ) pid_file . write ( '%s:%s' % ( pid_for_lock , str ( _GetProcessStartTime ( pid_for_lock ) ) ) ) pid_file . truncate ( )