-
Notifications
You must be signed in to change notification settings - Fork 212
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
tcp_forwarder: make sendall()
blocking
#1277
Conversation
Doesn't this just pass the blocking part into the sender endpoint instead of the receiver? |
Also, this is from python's documentation:
As I understand this, the |
As per the documentation many details are system-dependent. |
There is no behavioural difference in send and sendall when it comes to blocking and waiting for kernel response. |
And no, the connection will be closed upon a read/write error which will occur if the buffer is full and no data is being read. |
Sorry for the misunderstanding. Just to clarify and understand correctly, you say that adding the sorrounding |
If you try to send while blocking option is set for a specific file descriptor - the program will not return into user space if the other end is not reading data. In other words - if you add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I see. Thanks for clarifying the matter
Consider side A to be the client (program ran on a host machine), B to be the server (ios device) and P to be python process.
When we have B streaming the data to A over P and A doesn't want to read the packets from it's socket - the kernel will keep them in a buffer. And when it fills up, next time P receives a packet from B it will block on line 122 because the buffer of socket P->A is full. And pymobiledevice3 hangs altogether and doesn't receive new connections.
While this change breaks some use cases I think it is generally better to not block io operations if the kernel buffer is full.