Skip to content

Commit 85d72c5

Browse files
mmalferovvrana
authored andcommitted
accept.xml Fix typo, unbreak tag, CS
1 parent 402a727 commit 85d72c5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

reference/event/eventhttp/accept.xml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828
To bind a socket,
2929
<literal>listen</literal>,
3030
and
31-
<literal>
32-
accept</literal>
33-
connections on the socket in s single call use
31+
<literal>accept</literal>
32+
connections on the socket in a single call use
3433
<methodname>EventHttp::bind</methodname>.
3534
<methodname>EventHttp::accept</methodname>
3635
is needed only if one already has a socket ready to accept connections.
@@ -67,23 +66,26 @@
6766
<programlisting role="php">
6867
<![CDATA[
6968
<?php
69+
7070
$base = new EventBase();
7171
$http = new EventHttp($base);
7272
73-
$addresses = array (
74-
8091 => "127.0.0.1",
75-
8092 => "127.0.0.2",
76-
);
73+
$addresses = [
74+
8091 => "127.0.0.1",
75+
8092 => "127.0.0.2",
76+
];
7777
$i = 0;
7878
7979
$socket = array();
8080
8181
foreach ($addresses as $port => $ip) {
8282
echo $ip, " ", $port, PHP_EOL;
8383
$socket[$i] = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
84+
8485
if (!socket_bind($socket[$i], $ip, $port)) {
8586
exit("socket_bind failed\n");
8687
}
88+
8789
socket_listen($socket[$i], 0);
8890
socket_set_nonblock($socket[$i]);
8991
@@ -95,14 +97,14 @@ foreach ($addresses as $port => $ip) {
9597
++$i;
9698
}
9799
98-
$http->setCallback("/some-page", function() {
99-
echo "(some-page)\n";
100+
$http->setCallback("/some-page", function () {
101+
echo "(some-page)\n";
100102
echo "URI: ", $req->getUri(), PHP_EOL;
101103
$req->sendReply(200, "OK");
102104
echo "OK\n";
103105
});
104106
105-
$http->setDefaultCallback(function($req) {
107+
$http->setDefaultCallback(function ($req) {
106108
echo "URI: ", $req->getUri(), PHP_EOL;
107109
$req->sendReply(200, "OK");
108110
echo "OK\n";

0 commit comments

Comments
 (0)