summaryrefslogtreecommitdiff
path: root/docker/utils/socket.py
Commit message (Collapse)AuthorAgeFilesLines
* do not assume that read will consume the number of bytes requestedMichael Merickel2016-11-281-3/+7
| | | | | | | | | | | | | The issue is that ``os.read`` does not always read the expected number of bytes, and thus we are moving to the next frame too early causing drift in the byte stream. When the reading drifts, it starts reading garbage as the next frame size. The some examples of frame sizes were 4032897957 bytes, etc. Values this large were causing the exceptions from ``os.read``. fixes #1211 Signed-off-by: Michael Merickel <michael@merickel.org>
* Several fixes to npipe supportnpipe-advancedJoffrey F2016-10-121-1/+8
| | | | | | | | | - Fix _get_raw_response_socket to always return the NpipeSocket object - Override NpipeHTTPConnectionPool._get_conn to avoid crash in urllib3 - Fix NpipeSocket.recv_into for Python 2 - Do not call select() on NpipeSocket objects Signed-off-by: Joffrey F <joffrey@docker.com>
* Rename read methods for clarityAanand Prasad2016-07-131-5/+6
| | | | | | | read_socket() is now just read(), because its behaviour is consistent with `os.read` et al. Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Rename read_iter() to frames_iter()Aanand Prasad2016-07-131-1/+1
| | | | | | | This makes it more clearly high-level and distinct from the raw data-reading functions Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Rename next_packet_size to next_frame_sizeAanand Prasad2016-07-131-3/+3
| | | | Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Reorder socket.py methodsAanand Prasad2016-07-131-13/+13
| | | | Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Document all socket utility methodsAanand Prasad2016-07-131-2/+14
| | | | Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* RefactorsAanand Prasad2016-07-131-14/+13
| | | | | | | | - `read_data()` raises an exception instead of asserting `False` - `next_packet_size()` uses `read_data()` - Renamed `packet_size` arg to `n` for consistency Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Move read_loop() into docker.utils.socket.read_iter()Aanand Prasad2016-07-131-0/+7
| | | | Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* Move socket-reading test helpers into docker.utils.socketAanand Prasad2016-07-131-0/+49
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>