You are here

private function SocketHandler::writingIsTimedOut in Lagoon Logs 8

1 call to SocketHandler::writingIsTimedOut()
SocketHandler::writeToSocket in src/Logger/SocketHandler.php

File

src/Logger/SocketHandler.php, line 360

Class

SocketHandler
Stores to any socket - uses fsockopen() or pfsockopen().

Namespace

Drupal\lagoon_logs\Logger

Code

private function writingIsTimedOut($sent) {
  $writingTimeout = (int) floor($this->writingTimeout);
  if (0 === $writingTimeout) {
    return FALSE;
  }
  if ($sent !== $this->lastSentBytes) {
    $this->lastWritingAt = time();
    $this->lastSentBytes = $sent;
    return FALSE;
  }
  else {
    usleep(100);
  }
  if (time() - $this->lastWritingAt >= $writingTimeout) {
    $this
      ->closeSocket();
    return TRUE;
  }
  return FALSE;
}