r7171 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7170‎ | r7171 | r7172 >
Date:07:45, 19 January 2005
Author:timstarling
Status:old
Tags:
Comment:
experimental timeout variable
Modified paths:
  • /branches/REL1_4/phase3/includes/memcached-client.php (modified) (history)

Diff [purge]

Index: branches/REL1_4/phase3/includes/memcached-client.php
@@ -205,6 +205,22 @@
206206 */
207207 var $_active;
208208
 209+ /**
 210+ * Stream timeout in seconds. Applies for example to fread()
 211+ *
 212+ * @var integer
 213+ * @access private
 214+ */
 215+ var $_timeout_seconds;
 216+
 217+ /**
 218+ * Stream timeout in microseconds
 219+ *
 220+ * @var integer
 221+ * @access private
 222+ */
 223+ var $_timeout_microseconds;
 224+
209225 // }}}
210226 // }}}
211227 // {{{ methods
@@ -231,6 +247,9 @@
232248
233249 $this->_cache_sock = array();
234250 $this->_host_dead = array();
 251+
 252+ $this->_timeout_seconds = 1;
 253+ $this->_timeout_microseconds = 0;
235254 }
236255
237256 // }}}
@@ -606,6 +625,20 @@
607626 $this->_single_sock = $this->_servers[0];
608627 }
609628
 629+ /**
 630+ * Sets the timeout for new connections
 631+ *
 632+ * @param integer $seconds Number of seconds
 633+ * @param integer $microseconds Number of microseconds
 634+ *
 635+ * @access public
 636+ */
 637+ function set_timeout ($seconds, $microseconds)
 638+ {
 639+ $this->_timeout_seconds = $seconds;
 640+ $this->_timeout_microseconds = $microseconds;
 641+ }
 642+
610643 // }}}
611644 // }}}
612645 // {{{ private methods
@@ -654,6 +687,10 @@
655688 $this->_debugprint( "Error connecting to $host: $errstr\n" );
656689 return false;
657690 }
 691+
 692+ // Initialise timeout
 693+ stream_set_timeout($sock, $this->_timeout_seconds, $this->_timeout_microseconds);
 694+
658695 return true;
659696 }
660697

Status & tagging log