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

Clean up the "empty buffer" code in frame/frame-layer.go #10

Open
stamp opened this issue Oct 3, 2017 · 1 comment
Open

Clean up the "empty buffer" code in frame/frame-layer.go #10

stamp opened this issue Oct 3, 2017 · 1 comment

Comments

@stamp
Copy link
Contributor

stamp commented Oct 3, 2017

The problem to be aware of is that Read() is a blocking call. So it will block until we receive data.

Startup of the library should work something like this:

  1. Open the port
  2. Read all in the buffer and throw it away! (All this data is old and buffered by the kernel)
  3. When no data has been received for a customizable time continue
  4. Start reading and forward the data to the rest of the library

The important part here is that we want to throw away everything that has been buffered by the kernel before we start communicating with the zwave-controller

@juliandroid
Copy link

It seems you are hitting the same issue as I do, so you can follow the issue: golang/go#22114

In my bug report ( golang/go#22100 ) I have mentioned a workaround with syscalls ( https://play.golang.org/p/k5R8RcMPwg ), but not sure how helpful that is for you (Linux only).

asherry99 pushed a commit to asherry99/gozw that referenced this issue Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants