]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/commitdiff
Return from $rpc->eventloop() after 2 seconds instead of 10. main origin/HEAD origin/main
authorBram Matthys <redacted>
Mon, 8 May 2023 06:27:26 +0000 (08:27 +0200)
committerBram Matthys <redacted>
Mon, 8 May 2023 06:28:24 +0000 (08:28 +0200)
This so keepalive-like packets can be sent to the browser by the webpanel
every 2 seconds instead of 10 seconds (for better explanation see webpanel)

lib/Connection.php

index bcd38d168be1b6dbeab2efff9c4c5c992a810cd4..11d4a620c4f7fd75063b825102b2f5032cfae060 100644 (file)
@@ -115,6 +115,7 @@ class Connection
      */
     public function eventloop(): object|array|bool|null
     {
+        $this->connection->setTimeout(2); /* lower timeout for socket loop */
         $starttime = microtime(true);
         try {
             $reply = $this->connection->receive();
@@ -137,6 +138,8 @@ class Connection
             return NULL;
         }
 
+        $this->connection->setTimeout(10); /* set timeout back again */
+
         $reply = json_decode($reply);
 
         if (property_exists($reply, 'result')) {