make input stream non-blocking
parent
9036ae84fd
commit
5f8e37be9e
|
@ -27,6 +27,8 @@ else {
|
|||
$outputStream = STDOUT;
|
||||
}
|
||||
|
||||
stream_set_blocking($inputStream, false);
|
||||
|
||||
$server = new LanguageServer(new ProtocolStreamReader($inputStream), new ProtocolStreamWriter($outputStream));
|
||||
|
||||
Loop\run();
|
||||
|
|
|
@ -30,7 +30,7 @@ class ProtocolStreamReader implements ProtocolReader
|
|||
{
|
||||
$this->input = $input;
|
||||
Loop\addReadStream($this->input, function() {
|
||||
while(($c = fgetc($this->input)) !== false) {
|
||||
while(($c = fgetc($this->input)) !== false && $c !== '') {
|
||||
$this->buffer .= $c;
|
||||
switch ($this->parsingMode) {
|
||||
case ParsingMode::HEADERS:
|
||||
|
@ -54,9 +54,6 @@ class ProtocolStreamReader implements ProtocolReader
|
|||
$this->parsingMode = ParsingMode::HEADERS;
|
||||
$this->headers = [];
|
||||
$this->buffer = '';
|
||||
|
||||
// after reading a full message, leave to allow different tasks to run
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue