Skip to content

Commit

Permalink
modified proc_msg function to resolve malformed json packets.
Browse files Browse the repository at this point in the history
Added the test to cover the scenario "..}\n.{.." and by the way, the scenario "...{..." and  "...}..."
  • Loading branch information
teinturman authored Nov 10, 2020
1 parent 27b11d0 commit c00ab62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gym_donkeycar/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def proc_msg(self, sock):

n0=localbuffer.find("{")
n1=localbuffer.rfind("}")
if n1>=0 and n0>=0: # there is at least one message :
if n1>=0 and n0>=0 and n0<n1 : # there is at least one message :
msgs=localbuffer[n0:n1+1].split("\n")
localbuffer=localbuffer[n1:]

Expand Down

0 comments on commit c00ab62

Please sign in to comment.