You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr: if we can get parse errors to be passed back to the caller of library methods, it would be a lot easier to determine whether errors are occurring in the library as opposed to consumer code.
This library needs to be reworked so that any parse error that occurs is reported as an error to the calling method. for example, getActiveSessions should call its callback with an error if there is an error parsing any of the records passed to the parse routine.
In order to make that happen, we need to setup the state of the library after connect so that only valid data is passed into the parse routine. This should be fairly straightforward. As it is, the only invalid data that is passed to the parse routine is the welcome message. If we can find some way to consume the welcome message prior to allowing any commands to be sent to the TURN server, then the TCP client stream should only contain the data relevant to the command issued by a method call.
I took a quick stab at this and couldn't really get it working, so I bailed due to time constraints. The idea I had was to wait and fire the onConnect callback passed into the constructor until after the welcome message had been successfully cleared from the TCP client stream. I tried this by adding a readable event listener:
But for whatever reason, the data I tried to read was null, and the welcome message was still in the stream when my sample code called getActiveSessions(), which caused the parser to spit back a parse error prior to actually beginning to parse meaningful data.
The parse will also need to be coded to support the 0 sessions use case, where when you do ps and there are no sessions, it just says:
Total Sessions: 0
Right now the parser throws a parse error for this. We would need the library to not throw an error in this case.
The text was updated successfully, but these errors were encountered:
tl;dr: if we can get parse errors to be passed back to the caller of library methods, it would be a lot easier to determine whether errors are occurring in the library as opposed to consumer code.
This library needs to be reworked so that any parse error that occurs is reported as an error to the calling method. for example, getActiveSessions should call its callback with an error if there is an error parsing any of the records passed to the parse routine.
In order to make that happen, we need to setup the state of the library after connect so that only valid data is passed into the parse routine. This should be fairly straightforward. As it is, the only invalid data that is passed to the parse routine is the welcome message. If we can find some way to consume the welcome message prior to allowing any commands to be sent to the TURN server, then the TCP client stream should only contain the data relevant to the command issued by a method call.
I took a quick stab at this and couldn't really get it working, so I bailed due to time constraints. The idea I had was to wait and fire the onConnect callback passed into the constructor until after the welcome message had been successfully cleared from the TCP client stream. I tried this by adding a readable event listener:
But for whatever reason, the data I tried to read was null, and the welcome message was still in the stream when my sample code called getActiveSessions(), which caused the parser to spit back a parse error prior to actually beginning to parse meaningful data.
The parse will also need to be coded to support the 0 sessions use case, where when you do
ps
and there are no sessions, it just says:Right now the parser throws a parse error for this. We would need the library to not throw an error in this case.
The text was updated successfully, but these errors were encountered: