|
@@ -35,15 +35,20 @@ class WSDBridge
|
|
|
|
|
|
while (true)
|
|
while (true)
|
|
{
|
|
{
|
|
- if (($client = socket_accept($fd)) !== false) {
|
|
|
|
|
|
+ Log::record("Waitting another connect....");
|
|
|
|
+ if (($client = socket_accept($fd)) !== false)
|
|
|
|
+ {
|
|
Log::record("Client {$client} has connected", Log::DEBUG);
|
|
Log::record("Client {$client} has connected", Log::DEBUG);
|
|
socket_set_option($client, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 8, 'usec' => 0]);
|
|
socket_set_option($client, SOL_SOCKET, SO_RCVTIMEO, ['sec' => 8, 'usec' => 0]);
|
|
|
|
|
|
$body = $this->read_order($client);
|
|
$body = $this->read_order($client);
|
|
- if($body !== false) {
|
|
|
|
|
|
+ if($body !== false && !empty($body)) {
|
|
|
|
+ Log::record("req:{$body}",Log::DEBUG);
|
|
$response = $this->relay_request($body);
|
|
$response = $this->relay_request($body);
|
|
socket_write($client,$response);
|
|
socket_write($client,$response);
|
|
|
|
+ Log::record("resp:{$response}",Log::DEBUG);
|
|
}
|
|
}
|
|
|
|
+
|
|
socket_close($client);
|
|
socket_close($client);
|
|
}
|
|
}
|
|
}
|
|
}
|