@@ -258,44 +258,36 @@ function Interface:_SocketUpdate()
258258 if (status == " timeout" or status == nil ) and commandsStr ~= nil and commandsStr ~= " " then
259259 Spring .Log (LOG_SECTION , LOG .DEBUG , commandsStr )
260260
261- if config and config .debugRawMessages then
262- Spring .Utilities .TableEcho (self .raggedJsonStore , " self.raggedJsonStore" )
263- Spring .Echo (" commandsStr" , commandsStr )
264- end
265261 local commands = explode (" \n " , commandsStr )
266262
267263 if # commands > 0 then
268264 local allFail = true
269265 local newRagged = {}
270266 for i = 1 , # self .raggedJsonStore do
271267 local internalSuccess
272- local success = pcall (function () internalSuccess = self :CommandReceived (self .raggedJsonStore [i ] .. commands [1 ]) end )
268+ local success = pcall (function () internalSuccess = self :CommandReceived (self .raggedJsonStore [i ]. command .. commands [1 ]) end )
273269 if (success and internalSuccess ) then
274270 allFail = false
275- else
271+ elseif self .raggedJsonStore [i ].tries < 10 then
272+ self .raggedJsonStore [i ].tries = self .raggedJsonStore [i ].tries + 1
276273 newRagged [# newRagged + 1 ] = self .raggedJsonStore [i ]
277274 end
278275 end
279276 self .raggedJsonStore = newRagged
280- if (self .allFailRepeats or 0 ) > 20 then
281- if config and config .debugRawMessages then
282- Spring .Utilities .TableEcho (self .raggedJsonStore , " DISCARDING RAGGED JSON STORE" )
283- end
284- self .allFailRepeats = 0
285- self .raggedJsonStore = {}
277+ if # self .raggedJsonStore > 0 and config and config .debugRawMessages then
278+ Spring .Echo (" allFail" , allFail )
279+ Spring .Utilities .TableEcho (self .raggedJsonStore , " raggedJsonStore" )
280+ Spring .Utilities .TableEcho (commands , " commands" )
286281 end
287282 if allFail then
288283 local internalSuccess
289284 local success = pcall (function () internalSuccess = self :CommandReceived (commands [1 ]) end )
290285 if not (success and internalSuccess ) then
291286 Spring .Echo (" Processing failed for" , commands [1 ])
292- self .allFailRepeats = (self .allFailRepeats or 0 ) + 1
293287 if # commands == 1 then
294- self .raggedJsonStore [# self .raggedJsonStore + 1 ] = commands [1 ]
288+ self .raggedJsonStore [# self .raggedJsonStore + 1 ] = { tries = 0 , command = commands [1 ]}
295289 end
296290 end
297- else
298- self .allFailRepeats = 0
299291 end
300292 for i = 2 , # commands - 1 do
301293 local command = commands [i ]
@@ -307,7 +299,7 @@ function Interface:_SocketUpdate()
307299 local internalSuccess
308300 local success = pcall (function () internalSuccess = self :CommandReceived (commands [# commands ]) end )
309301 if not (success and internalSuccess ) then
310- self .raggedJsonStore [# self .raggedJsonStore + 1 ] = commands [# commands ]
302+ self .raggedJsonStore [# self .raggedJsonStore + 1 ] = { tries = 0 , command = commands [# commands ]}
311303 end
312304 end
313305 end
0 commit comments