[PEAR-BUG] Bug #14924 [Ver->Csd]: delayed timer with real socket

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=14924&edit=1

 ID:               14924
 Updated by:       [email protected]
 Reported By:      cortexd at wanadoo dot fr
 Summary:          delayed timer with real socket
-Status:           Verified
+Status:           Closed
 Type:             Bug
 Package:          Net_SmartIRC
 Operating System: Windows XP SP3
 Package Version:  1.0.0
 PHP Version:      5.2.6
-Assigned To:      
+Assigned To:      garrettw
 Roadmap Versions: 
 New Comment:

-Status:      Verified
+Status:      Closed
-Assigned To:
+Assigned To: garrettw
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Issue had to do with too long of a timeout on socket_select() calls. I
removed the *1000 multiplier in that parameter, which isn't a perfect
fix, but it should make the timing close enough to not be a noticeable
delay to any time handlers. That's pretty much the best fix I can offer
on this codebase.


Previous Comments:
------------------------------------------------------------------------

[2014-09-03 11:46:23] garrettw

-Status: Open
+Status: Verified


------------------------------------------------------------------------

[2008-10-30 11:29:14] cortexd

Description:
------------
with real socket, the timer handler is delayed if someone talks on the
channel between two triggers

Test script:
---------------
<?php
require_once 'Net/SmartIRC.php';

class Bot
{
    public function test(Net_SmartIRC $irc)
    {
        $irc->message(SMARTIRC_TYPE_CHANNEL, '#cortexd', 'every 10
seconds');
    }
}

$bot = new Bot();
$irc = new Net_SmartIRC();
$irc->setUseSockets(true);

$irc->registerTimehandler(10000, $bot, 'test');

$irc->connect('irc.quakenet.org', 6667);
$irc->login('SmartIRC', 'Net_SmartIRC', 8, 'smartirc');
$irc->join('#cortexd');
$irc->listen();

Expected result:
----------------
with "$irc->setUseSockets(false);" the result is :

[17:08:49] <SmartIRC> every 10 seconds
[17:08:59] <SmartIRC> every 10 seconds
[17:09:09] <SmartIRC> every 10 seconds
[17:09:19] <SmartIRC> every 10 seconds
[17:09:29] <SmartIRC> every 10 seconds
[17:09:39] <SmartIRC> every 10 seconds
[17:09:42] <Cortexd> lol
[17:09:44] <Cortexd> lol
[17:09:45] <Cortexd> lol
[17:09:49] <SmartIRC> every 10 seconds

Actual result:
--------------
with "$irc->setUseSockets(true);" the result is :

[17:11:11] <SmartIRC> every 10 seconds
[17:11:21] <SmartIRC> every 10 seconds
[17:11:31] <SmartIRC> every 10 seconds
[17:11:42] <SmartIRC> every 10 seconds
[17:11:52] <SmartIRC> every 10 seconds
[17:12:02] <SmartIRC> every 10 seconds
[17:12:13] <SmartIRC> every 10 seconds
[17:12:23] <SmartIRC> every 10 seconds
[17:12:26] <Cortexd> lol
[17:12:28] <Cortexd> lol
[17:12:29] <Cortexd> lol
[17:12:40] <SmartIRC> every 10 seconds
[17:12:50] <SmartIRC> every 10 seconds

when somebody talks, the timer is delayed !

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=14924&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.