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) {
|
||||
if (!_connected) return -1;
|
||||
int res = -1;
|
||||
int j = 0;
|
||||
if (available()){
|
||||
int j = 0;
|
||||
for (int i = _startPos; i < _endPos; i++) {
|
||||
if (j < size) {
|
||||
buf[j] = RxBuffer[i];
|
||||
} else {
|
||||
res = j;
|
||||
_startPos += j;
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (j > 0) {
|
||||
_startPos += j;
|
||||
res = j;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue