diff --git a/httprl.module b/httprl.module
index d6483ba..47ae099 100755
--- a/httprl.module
+++ b/httprl.module
@@ -1,5 +1,14 @@
 <?php
 
+// HTTP_REQUEST_TIMEOUT is defined in 7.x; but not in 6.x
+if (!defined('HTTP_REQUEST_TIMEOUT')) {
+  /**
+  * Error code indicating that the request made by drupal_http_request() exceeded
+  * the specified timeout.
+  */
+  define('HTTP_REQUEST_TIMEOUT', -1);
+}
+
 /**
  * @file
  * HTTP Parallel Request Library module.
@@ -330,7 +339,7 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = ''
         $timeout = $responses[$id]->options['timeout'] - timer_read(__FUNCTION__) / 1000;
         if ($timeout <= 0) {
           // Stream timed out.
-          $responses[$id]->error = 'request timed out';
+          $responses[$id]->error = 'request timed out, read';
           $responses[$id]->code = HTTP_REQUEST_TIMEOUT;
           $responses[$id]->status = 'Done.';
           $responses[$id]->options['timeout'] = $timeout;
@@ -407,7 +416,7 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = ''
             $timeout = $responses[$id]->options['timeout'] - timer_read(__FUNCTION__) / 1000;
             if ($timeout <= 0) {
               // Stream timed out.
-              $responses[$id]->error = 'request timed out';
+              $responses[$id]->error = 'request timed out, write';
               $responses[$id]->code = HTTP_REQUEST_TIMEOUT;
               $responses[$id]->status = 'Done.';
               $responses[$id]->options['timeout'] = $timeout;
@@ -461,6 +470,21 @@ function httprl_send_request($fp = NULL, $url = '', $request = '', $options = ''
       }
     }
     else {
+      // Check for timeouts
+      foreach ($responses as $id => &$result) {
+        // Calculate how much time is left of the original timeout value.
+        $timeout = $result->options['timeout'] - timer_read(__FUNCTION__) / 1000;
+        if ($timeout <= 0) {
+          // Stream timed out.
+          $result->error = 'request timed out, no streams available';
+          $result->code = HTTP_REQUEST_TIMEOUT;
+          $result->status = 'Done.';
+          $result->options['timeout'] = $timeout;
+          fclose($streams[$id]);
+          unset($streams[$id]);
+          continue;
+        }
+      }
       break;
     }
     // Sleep for 25ms if there are open streams and no data was transfered.
