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

RXTX: data might not *yet* be available #959

Closed
wants to merge 3 commits into from

Conversation

jeje
Copy link

@jeje jeje commented Jan 18, 2013

This is a fix for issue #958

@normanmaurer
Copy link
Member

doRead(..) should never been called before it is connected.. Can you give some more details ?

@jeje
Copy link
Author

jeje commented Jan 18, 2013

I don't think it's called before it's connected. But the issue is that return buf.writeBytes(in, buf.writableBytes()); blocks and never returns, even when some data is available later on...

BTW, I don't understand the above code. Shouldn't it be return buf.writeBytes(in, in.available()); instead?
Otherwise we're asking to copy a length of data (buf.writableBytes()) which might be bigger than in.available() and potentially wait for a really long time 'til there is enough data sent from the serial port.

Can you confirm that doRead() is not called unless available() returns a non-zero value?

@normanmaurer
Copy link
Member

@jeje I just fixed the read code which was not correct. So thanks for point it out :) Could you retry with latest master ?

@jeje
Copy link
Author

jeje commented Jan 21, 2013

This works just fine! Thanks for this commit.

I saw that you took the opportunity to refactor the OioSocketChannel class which had the exact same issue ;-)

This pull-request and issue #958 can be closed.

@normanmaurer
Copy link
Member

Fixed by #962

@jeje jeje deleted the rxtx-read-issue branch January 21, 2013 16:16
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

Successfully merging this pull request may close these issues.

None yet

2 participants