Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added packet timeout for cctalk parser #1887

Merged
merged 6 commits into from
Aug 14, 2019
Merged

Added packet timeout for cctalk parser #1887

merged 6 commits into from
Aug 14, 2019

Conversation

maxvgi
Copy link
Contributor

@maxvgi maxvgi commented Jun 5, 2019

Should fix #1886

Copy link
Member

@reconbot reconbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, but please add a test. You can use sinon to mock time.

}
_transform(buffer, _, cb) {
if (this.maxDelayBetweenBytesMs > 0) {
const now = +new Date()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date.now() is a little more straightforward

@@ -12,12 +12,23 @@ const parser = port.pipe(new CCtalk())
parser.on('data', console.log)
*/
class CCTalkParser extends Transform {
constructor() {
constructor(maxDelayBetweenBytesMs = 0) {
Copy link
Member

@reconbot reconbot Jun 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packetTimeout? Also per the spec, should 50 be the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 50ms is the default. But it may break someone's code. I have set 0 for backward compatibility. Is it better to set it to 50 by default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do a major version release so it won’t break anyone’s code without them purposely upgrading.

@stale
Copy link

stale bot commented Aug 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

@stale stale bot added the stale-issue label Aug 4, 2019
@stale stale bot removed the stale-issue label Aug 5, 2019
@maxvgi
Copy link
Contributor Author

maxvgi commented Aug 5, 2019

Hi, @reconbot !
I have added tests as you asked. And changed the major version of cctalk parser package.

@maxvgi
Copy link
Contributor Author

maxvgi commented Aug 12, 2019

Please, tell me if I should do something more

@reconbot reconbot merged commit 714e438 into serialport:master Aug 14, 2019
@reconbot
Copy link
Member

nothing at all, I'm just slow

@lock lock bot locked as resolved and limited conversation to collaborators Feb 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Cctalk message timeout
2 participants