Update PPPOSClient.cpp
This commit is contained in:
parent
d9dc2ef35d
commit
51578c6ac2
1 changed files with 7 additions and 4 deletions
|
@ -233,18 +233,21 @@ uint8_t PPPOSClient::connected() {
|
||||||
int PPPOSClient::read(uint8_t *buf, size_t size) {
|
int PPPOSClient::read(uint8_t *buf, size_t size) {
|
||||||
if (!_connected) return -1;
|
if (!_connected) return -1;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
if (available()){
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
if (available()){
|
||||||
for (int i = _startPos; i < _endPos; i++) {
|
for (int i = _startPos; i < _endPos; i++) {
|
||||||
if (j < size) {
|
if (j < size) {
|
||||||
buf[j] = RxBuffer[i];
|
buf[j] = RxBuffer[i];
|
||||||
} else {
|
} else {
|
||||||
res = j;
|
break;
|
||||||
_startPos += j;
|
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (j > 0) {
|
||||||
|
_startPos += j;
|
||||||
|
res = j;
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue