File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed
Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -53,18 +53,21 @@ class RPCClient {
5353 return false ;
5454 }
5555
56- if (!unpacker.unpackNil ( )){
56+ if (!unpacker.unpackable (nil )){
5757 Serial.print (" RPC error - " );
58- unpacker.deserialize (rpc_error.code , rpc_error.traceback );
58+ if (!unpacker.deserialize (rpc_error, nil)){
59+ Serial.println (" wrong error msg received" );
60+ flush_buffer ();
61+ return false ;
62+ }
5963 Serial.print (" error code: " );
6064 Serial.print (rpc_error.code );
6165 Serial.print (" error str: " );
6266 Serial.println (rpc_error.traceback );
63- unpacker.unpackNil ();
6467 msg_id += 1 ;
6568 flush_buffer ();
6669 return false ;
67- } else if (!unpacker.deserialize (result)){
70+ } else if (!unpacker.deserialize (nil, result)){
6871 Serial.println (" Unexpected result" );
6972 flush_buffer ();
7073 return false ;
Original file line number Diff line number Diff line change @@ -20,14 +20,6 @@ inline void flush_buffer(){
2020
2121inline void send_msg (ITransport & transport , const MsgPack ::bin_t < uint8_t > & buffer ) {
2222 size_t size = buffer .size ();
23-
24- Serial .println ("sending data" );
25- for (size_t i = 0 ; i < size ; i ++ ){
26- Serial .print (buffer .data ()[i ]);
27- Serial .print (" " );
28- }
29- Serial .println ("" );
30-
3123 transport .write (reinterpret_cast < const uint8_t * > (buffer .data ()), size );
3224}
3325
@@ -38,7 +30,6 @@ inline bool recv_msg(ITransport& transport, MsgPack::Unpacker& unpacker) {
3830 size_t bytes_read = transport .read (temp_buffer , CHUNK_SIZE );
3931
4032 if (bytes_read == 0 ){
41- Serial .println ("no bytes received" );
4233 return false;
4334 }
4435
You can’t perform that action at this time.
0 commit comments