-
Notifications
You must be signed in to change notification settings - Fork 6
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
Review low level socket.send() #7
Comments
when does the exception occur? is it reproduce-able? how can one provoke the exception? so far, pyownet is very well behaved in the environment I am using it. |
I've never seen a The fact is that socket sends are buffered at the OS level, so for the typical size of pyownet messages the
The present code in |
A possbile solution could be to abort a socket.send if the protocol-level time-out has expired. |
ok, I see. If you don't mind, I would have a go at the while loop with time-out in socket-send... So how would owserver deal with a an aborted socket.send? Does it itself have a time-out? |
Before looking for a solution I would like to have some evidence that we have a problem here. I've done some testing and This issue is also a hint for a complete new implementation of |
Ok, fair enough! |
The code for sending messages in
protocol._OwnetConnection._send_msg
is at present unsatisfactory.After
a
ShortWrite
exception is raised ifsent < len(header + payload)
but it is not clear to me whether thissocket.send
should instead be retried in awhile sent < len(header + payload):
loop. If a retry loop is implemented, which are the conditions to break out of the loop to avoid deadlock?A minor glitch to correct: the concat string
header + payload
is constructed two times, one for sending, and one for measuring its length. Should optimise here.The text was updated successfully, but these errors were encountered: