From 79e83c5a465a33207c84f65bcd7362daa3fff66f Mon Sep 17 00:00:00 2001 From: James Dunmore Date: Tue, 25 Feb 2014 16:39:13 +0000 Subject: [PATCH 1/2] Create README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..3c9deba3 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +net_gearman +=========== + +A PHP interface for Danga's Gearman + +I've traced these forks all the way back to https://github.com/lenn0x/net_gearman + +I've noticed a few bugs so I'm commiting them in via this fork. From 9ec22eee80c27214961fd55284bc7365abca1b86 Mon Sep 17 00:00:00 2001 From: James Dunmore Date: Tue, 25 Feb 2014 16:42:00 +0000 Subject: [PATCH 2/2] Fixing some bugs Connection code in client doesn't return a code, so breaks the exception handler Made the get status public and fixed the error in the connection --- Net/Gearman/Client.php | 9 +++++---- Net/Gearman/Connection.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Net/Gearman/Client.php b/Net/Gearman/Client.php index 517b83f1..97d79e1e 100644 --- a/Net/Gearman/Client.php +++ b/Net/Gearman/Client.php @@ -113,7 +113,7 @@ public function __construct($servers = null, $timeout = 1000) } /** - * Private function to handle the status communication + * function to handle the status communication * * @param string $handle The handle returned when the task was created * @param string $server The server name(:port) this task was assigned to. @@ -121,7 +121,7 @@ public function __construct($servers = null, $timeout = 1000) * @return mixed An associative array containing information about * the provided task handle. Returns false if the request failed. */ - private function getStatus($handle, $server = null) + public function getStatus($handle, $server = null) { $params = array( @@ -135,9 +135,10 @@ private function getStatus($handle, $server = null) } foreach($server_list as $s) { - Net_Gearman_Connection::send($s, 'get_status', $params); + $conn = $this->getConnection(); + Net_Gearman_Connection::send($conn, 'get_status', $params); - $read = array($s); + $read = array($conn); $write = null; $except = null; diff --git a/Net/Gearman/Connection.php b/Net/Gearman/Connection.php index 748f147c..4d3e074c 100644 --- a/Net/Gearman/Connection.php +++ b/Net/Gearman/Connection.php @@ -306,7 +306,7 @@ static public function read($socket) } throw new Net_Gearman_Exception( - $return['err_text'], $return['err_code'] + $return['err_text'] . " code: " . $return['err_code'] ); }