Returns the stream and size of the next frame of data waiting to be read from socket, according to the protocol defined here: https://docs.docker.com/engine/api/v1.24/#attach-to-a-container
(socket)
| 74 | |
| 75 | |
| 76 | def next_frame_header(socket): |
| 77 | """ |
| 78 | Returns the stream and size of the next frame of data waiting to be read |
| 79 | from socket, according to the protocol defined here: |
| 80 | |
| 81 | https://docs.docker.com/engine/api/v1.24/#attach-to-a-container |
| 82 | """ |
| 83 | try: |
| 84 | data = read_exactly(socket, 8) |
| 85 | except SocketError: |
| 86 | return (-1, -1) |
| 87 | |
| 88 | stream, actual = struct.unpack('>BxxxL', data) |
| 89 | return (stream, actual) |
| 90 | |
| 91 | |
| 92 | def frames_iter(socket, tty): |