File tree Expand file tree Collapse file tree 3 files changed +6
-15
lines changed
Expand file tree Collapse file tree 3 files changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class RPCClient {
3939 // blocking call
4040 while (!decoder->get_response (msg_id, result, error)){
4141 decoder->decode ();
42- delay (1 );
42+ // delay(1);
4343 }
4444
4545 lastError.code = error.code ;
Original file line number Diff line number Diff line change @@ -178,25 +178,16 @@ class RpcDecoder {
178178 // Fill the raw buffer to its capacity
179179 void advance () {
180180
181- uint8_t temp_buf[CHUNK_SIZE];
182-
183- if (_transport.available () && !buffer_full ()){
184- int bytes_read = _transport.read (temp_buf, CHUNK_SIZE);
185-
186- for (int i = 0 ; i < bytes_read; ++i) {
187- _raw_buffer[_bytes_stored] = temp_buf[i];
188- _bytes_stored++;
189- while (buffer_full ()){
190- delay (1 );
191- }
192- }
181+ if (_transport.available () && !buffer_full ()) {
182+ size_t bytes_read = _transport.read (_raw_buffer + _bytes_stored, BufferSize - _bytes_stored);
183+ _bytes_stored += bytes_read;
193184 }
194185
195186 }
196187
197188 void parse_packet (){
198189
199- if (packet_incoming () || buffer_empty () ){return ;}
190+ if (packet_incoming () || _bytes_stored < 2 ){return ;}
200191
201192 MsgPack::Unpacker unpacker;
202193 unpacker.clear ();
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class RPCServer {
3434 void run () {
3535 decoder->decode ();
3636 decoder->process_requests (dispatcher);
37- delay (1 );
37+ // delay(1);
3838 }
3939
4040};
You can’t perform that action at this time.
0 commit comments