File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ class MethodNotExistsException extends Exception {}
3131 */
3232class ConnectionClosedException extends Exception {}
3333
34+ /**
35+ * Thrown when calling method on closed connection
36+ */
37+ class ConnectionTimeoutException extends Exception {}
38+
3439/**
3540 * Main Dnode client class
3641 *
@@ -95,6 +100,10 @@ public function __construct($stream) {
95100 // write our (empty) methods description
96101 fputs ($ this ->stream , json_encode (array ("method " => "methods " )) ."\n" );
97102
103+ $ streamMeta = stream_get_meta_data ($ stream );
104+ if ($ streamMeta ['timed_out ' ] === true ) {
105+ throw new ConnectionTimeoutException ("Connection timed out " );
106+ }
98107 // read remote methods
99108 $ line = fgets ($ this ->stream );
100109 if ($ line === false ) {
You can’t perform that action at this time.
0 commit comments