TCPIP SOCKET improvements#115
Conversation
|
@MatthieuDartiailh please review (I can't change reviewers). |
|
✌️ skrchnavy can now approve this pull request |
MatthieuDartiailh
left a comment
There was a problem hiding this comment.
This looks very good. I simply wish we could avoid the duplications in lines 379 and 404 but I have no good alternative to propose. I do not have an instrument handy to test so once you have thoroughly tested this on both 2 and 3, you can merge (just trigger bors, using the same command I use)
bors delegate+
|
By the way mentioning me in the PR also makes it easy to find, so you can keep doing this while waiting for hgrecco to add you. |
|
The part at line 379 is something hat shall be considered. This is good for handling chunks or binary data when buffer not big enough. |
|
this could be a fix of #101 |
|
Nice refactoring ! |
|
@MatthieuDartiailh I have added handling of timeout in connect (#88). Have to test with py2.7. |
|
There are few improvements possible in processing return codes from connect_ex but it is difficult to identify errno codes for all systems, so for now I see implementation sufficient. Select waits 100ms min and it is usually enough to connect to a resource on LAN. Merging |
115: TCPIP SOCKET improvements r=skrchnavy a=skrchnavy * Connect uses open_timeout parameter to be timeouted (#88) * Refactored read operation with improved timeout handling * Read Uses bytearray and bytes instead of string - inspired by #50 * Calculation of return data in read uses indexes * Renamed some variables for better readability.
Build succeeded |
|
Just one thing I missed and that need to be fixed: the |
|
I was thinking about it, and not only pending_buffer but also other variables. Fortunately not used in code. |
|
There is a number of class variables that are indeed perfectly fine because they are simply used to alter some behaviors easily on subclasses. However pending_buffer HAS to be an instance variable as otherwise it would be shared by alll instances of TCPIPSocket which is not desirable ! So either we initialize it in init or on first use (but i do not favor this solution). |
|
I agree, I am cleaning such variables in other features when I am able to test them. |
|
@MatthieuDartiailh please check #116 for implementation of pending buffer per session. |
|
|
||
| if len(out) >= count: | ||
| self._pending_buffer = out[count:] | ||
| return bytes(out[:count]), constants.StatusCode.success_max_count_read |
There was a problem hiding this comment.
this shall be a fix of #101 , returning only expected bytes
|
Thanks a lot for these feature improvements. With the version one can get with pip (0.2) I was experiencing infinite waiting when reading from a TCPIP socket that transmit binary data without termination character. I had identified a timeout problem in |
|
Happy to know this works for you. Hopefully we will be able to make a new release soon. |
Uh oh!
There was an error while loading. Please reload this page.