@@ -114,9 +114,9 @@ class Net_Gearman_Connection
114114 */
115115 protected $ serverVersion ;
116116
117- public function __construct ($ host =null , $ timeout =250 ) {
118- if ($ host ) {
119- $ this ->connect ($ host , $ timeout );
117+ public function __construct ($ server =null , $ timeout =250 ) {
118+ if ($ server ) {
119+ $ this ->connect ($ server , $ timeout );
120120 }
121121 }
122122
@@ -130,7 +130,7 @@ public function __destruct() {
130130 * Opens the socket to the Gearman Job server. It throws an exception if
131131 * a socket error occurs. Also populates Net_Gearman_Connection::$magic.
132132 *
133- * @param string $host e.g. 127.0.0.1 or 127.0.0.1:7003
133+ * @param string $server e.g. 127.0.0.1 or 127.0.0.1:7003
134134 * @param int $timeout Timeout in milliseconds
135135 *
136136 * @return resource A connection to a Gearman server
@@ -139,7 +139,7 @@ public function __destruct() {
139139 * @see Net_Gearman_Connection::$magic
140140 * @see Net_Gearman_Connection::$commands
141141 */
142- public function connect ($ host , $ timeout = 250 )
142+ public function connect ($ server , $ timeout = 250 )
143143 {
144144
145145 $ this ->close ();
@@ -150,9 +150,10 @@ public function connect($host, $timeout = 250)
150150 }
151151 }
152152
153- if (strpos ($ host , ': ' )) {
154- list ($ host , $ port ) = explode (': ' , $ host );
153+ if (strpos ($ server , ': ' )) {
154+ list ($ host , $ port ) = explode (': ' , $ server );
155155 } else {
156+ $ host = $ server ;
156157 $ port = 4730 ;
157158 }
158159
@@ -210,7 +211,7 @@ public function connect($host, $timeout = 250)
210211
211212 // socket_set_option($this->socket, SOL_TCP, SO_DEBUG, 1); // Debug
212213
213- $ this ->setServerVersion ($ host );
214+ $ this ->setServerVersion ($ server );
214215
215216 } else {
216217
@@ -572,13 +573,13 @@ public static function subString($str, $start, $length)
572573 /**
573574 * Sets the server version.
574575 *
575- * @param string $host The host
576+ * @param string $server The host:port
576577 * @param Net_Gearman_Manager $manager Optional manager object
577578 */
578- protected function setServerVersion ($ host , $ manager = null )
579+ protected function setServerVersion ($ server , $ manager = null )
579580 {
580581 if (empty ($ manager )) {
581- $ manager = new \Net_Gearman_Manager ($ host );
582+ $ manager = new \Net_Gearman_Manager ($ server );
582583 }
583584 $ this ->serverVersion = $ manager ->version ();
584585 unset($ manager );
0 commit comments