Part of bzrlib.smart.medium View In Hierarchy
The stream may be a pipe connected to sshd, or a tcp socket, or an in-process fifo for testing.
One instance is created for each connected client; it can serve multiple requests in the lifetime of the connection.
The server passes requests through to an underlying backing transport, which will typically be a LocalTransport looking at the server's filesystem.
|Instance Variables||_push_back_buffer||a str of bytes that have been read from the stream but not used yet, or None if there are no buffered bytes. Subclasses should make sure to exhaust this buffer before reading more bytes from the stream. See also the _push_back method.|
|Method||__init__||Construct new server.|
|Method||serve||Serve requests until the client disconnects.|
|Method||terminate_due_to_error||Called when an unhandled exception from the protocol occurs.|
|Method||_stop_gracefully||When we finish this message, stop looking for more.|
|Method||_disconnect_client||Close the current connection. We stopped due to a timeout/etc.|
|Method||_wait_for_bytes_with_timeout||Wait for more bytes to be read, but timeout if none available.|
|Method||_build_protocol||Identifies the version of the incoming request, and returns an|
|Method||_wait_on_descriptor||select() on a file descriptor, waiting for nonblocking read()|
|Method||_serve_one_request||Read one request from input, process, send back a response.|
|Method||_read_bytes||Get some bytes from the medium.|
Inherited from SmartMedium:
|Method||read_bytes||Read some bytes from this medium.|
|Method||_push_back||Return unused bytes to the medium, because they belong to the next|
|Method||_get_line||Read bytes from this request's response until a newline byte.|
|Method||_report_activity||Notify that this medium has activity.|
This allows us to detect idle connections, and stop trying to read from them, without setting the socket itself to non-blocking. This also allows us to specify when we watch for idle timeouts.
|Returns||Did we timeout? (True if we timed out, False if there is data to be read)|
If more bytes than the version prefix of the request are read, they will be fed into the protocol before it is returned.
This will raise a ConnectionTimeout exception if we do not get a readable handle before timeout_seconds. :return: None