@@ -601,15 +601,14 @@ public function baseRead($socket, $check_eof = true)
601
601
$ this ->_recvBuffer .= $ buffer ;
602
602
}
603
603
604
- $ recv_len = \strlen ($ this ->_recvBuffer );
605
604
// If the application layer protocol has been set up.
606
605
if ($ this ->protocol !== null ) {
607
606
$ parser = $ this ->protocol ;
608
607
while ($ this ->_recvBuffer !== '' && !$ this ->_isPaused ) {
609
608
// The current packet length is known.
610
609
if ($ this ->_currentPackageLength ) {
611
610
// Data is not enough for a package.
612
- if ($ this ->_currentPackageLength > $ recv_len ) {
611
+ if ($ this ->_currentPackageLength > \strlen ( $ this -> _recvBuffer ) ) {
613
612
break ;
614
613
}
615
614
} else {
@@ -624,7 +623,7 @@ public function baseRead($socket, $check_eof = true)
624
623
break ;
625
624
} elseif ($ this ->_currentPackageLength > 0 && $ this ->_currentPackageLength <= $ this ->maxPackageSize ) {
626
625
// Data is not enough for a package.
627
- if ($ this ->_currentPackageLength > $ recv_len ) {
626
+ if ($ this ->_currentPackageLength > \strlen ( $ this -> _recvBuffer ) ) {
628
627
break ;
629
628
}
630
629
} // Wrong package.
@@ -638,15 +637,14 @@ public function baseRead($socket, $check_eof = true)
638
637
// The data is enough for a packet.
639
638
++self ::$ statistics ['total_request ' ];
640
639
// The current packet length is equal to the length of the buffer.
641
- if ($ recv_len === $ this ->_currentPackageLength ) {
640
+ if (\strlen ( $ this -> _recvBuffer ) === $ this ->_currentPackageLength ) {
642
641
$ one_request_buffer = $ this ->_recvBuffer ;
643
642
$ this ->_recvBuffer = '' ;
644
643
} else {
645
644
// Get a full package from the buffer.
646
645
$ one_request_buffer = \substr ($ this ->_recvBuffer , 0 , $ this ->_currentPackageLength );
647
646
// Remove the current package from the receive buffer.
648
647
$ this ->_recvBuffer = \substr ($ this ->_recvBuffer , $ this ->_currentPackageLength );
649
- $ recv_len = \strlen ($ this ->_recvBuffer );
650
648
}
651
649
// Reset the current packet length to 0.
652
650
$ this ->_currentPackageLength = 0 ;
0 commit comments