class IrcManager extends ImManager {
protected $conn = null;
+ protected $lastPing = null;
+
protected $regchecks = array();
protected $regchecksLookup = array();
}
}
+ /**
+ * Idle processing for io manager's execution loop.
+ * Send keepalive pings to server.
+ *
+ * @return void
+ */
+ public function idle($timeout = 0) {
+ if (empty($this->lastPing) || time() - $this->lastPing > 120) {
+ $this->send_ping();
+ }
+ }
+
/**
* Process IRC events that have come in over the wire.
*
return true;
}
+
+ /**
+ * Sends a ping
+ *
+ * @return void
+ */
+ protected function send_ping() {
+ $this->lastPing = time();
+ $this->conn->send('PING', $this->lastPing);
+ }
}