Skip to content

Commit e23c3f1

Browse files
committed
Merge pull request #5 from cweric/patch-1
fixed constant
2 parents 49b36fd + 91e54e2 commit e23c3f1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

sock/SocketServer.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function setConnectionHandler( $handler ) {
5050
public function listen() {
5151
if( socket_listen($this->sockServer, 5) === false) {
5252
throw new SocketException(
53-
SocketException::CANT_BIND_SOCKET,
53+
SocketException::CANT_LISTEN,
5454
socket_strerror(socket_last_error( $this->sockServer ) ) );
5555
}
5656

@@ -67,23 +67,23 @@ protected function beforeServerLoop() {
6767

6868
protected function serverLoop() {
6969
while( $this->_listenLoop ) {
70-
if( ( $client = @socket_accept( $this->sockServer ) ) === false ) {
71-
throw new SocketException(
72-
SocketException::CANT_ACCEPT,
73-
socket_strerror(socket_last_error( $this->sockServer ) ) );
74-
continue;
75-
}
76-
77-
$socketClient = new SocketClient( $client );
78-
79-
if( is_array( $this->connectionHandler ) ) {
80-
$object = $this->connectionHandler[0];
81-
$method = $this->connectionHandler[1];
82-
$object->$method( $socketClient );
83-
}
84-
else {
85-
$function = $this->connectionHandler;
86-
$function( $socketClient );
70+
if( ( $client = @socket_accept( $this->sockServer ) ) === false ) {
71+
throw new SocketException(
72+
SocketException::CANT_ACCEPT,
73+
socket_strerror(socket_last_error( $this->sockServer ) ) );
74+
continue;
75+
}
76+
77+
$socketClient = new SocketClient( $client );
78+
79+
if( is_array( $this->connectionHandler ) ) {
80+
$object = $this->connectionHandler[0];
81+
$method = $this->connectionHandler[1];
82+
$object->$method( $socketClient );
83+
}
84+
else {
85+
$function = $this->connectionHandler;
86+
$function( $socketClient );
8787
}
8888
}
8989
}

0 commit comments

Comments
 (0)