fix docs, add missing "}", fix formatting 3/head
authorSascha-Oliver Prolic <saschaprolic@googlemail.com>
Wed, 11 Apr 2018 15:29:52 +0000 (23:29 +0800)
committerGitHub <noreply@github.com>
Wed, 11 Apr 2018 15:29:52 +0000 (23:29 +0800)
pq/Connection/: Asynchronous Usage.md

index b19779b8aa8032736ea0451b3afd4584cb08ba98..1043a492d98c5d1a4684fdb5c205fad694ef2c4e 100644 (file)
@@ -39,32 +39,33 @@ Keep in mind that you have to test for write-readiness once *before* starting th
        
        if (stream_select($r, $w, $e, null)) {
        
-         // loop until the connection is established
-         while (true) {
+           // loop until the connection is established
+           while (true) {
          
-               switch ($c->poll()) {
+               switch ($c->poll()) {
                
-               case pq\Connection::POLLING_READING:
-                 // we should wait for the stream to be read-ready
-                 $r = array($c->socket);
-                 stream_select($r, $w, $e, NULL);
-                 break;
-
-               case pq\Connection::POLLING_WRITING:
-                 // we should wait for the stream to be write-ready
-                 $w = array($c->socket);
-                 $r = $e = null;
-                 stream_select($r, $w, $e, null);
-                 break;
-
-               case pq\Connection::POLLING_FAILED:
-                 printf("Connection failed: %s\n", $c->errorMessage);
-                 break 2;
-
-               case pq\Connection::POLLING_OK:
-                 printf("Connection completed\n");
-                 break 2;
-               }
+                   case pq\Connection::POLLING_READING:
+                       // we should wait for the stream to be read-ready
+                       $r = array($c->socket);
+                       stream_select($r, $w, $e, NULL);
+                       break;
+
+                   case pq\Connection::POLLING_WRITING:
+                       // we should wait for the stream to be write-ready
+                       $w = array($c->socket);
+                       $r = $e = null;
+                       stream_select($r, $w, $e, null);
+                       break;
+
+                   case pq\Connection::POLLING_FAILED:
+                       printf("Connection failed: %s\n", $c->errorMessage);
+                       break 2;
+
+                   case pq\Connection::POLLING_OK:
+                       printf("Connection completed\n");
+                       break 2;
+               }
+           }   
        }
        
        ?>