conn->list = NULL;
}
-int connection_input_read(struct connection *conn)
+int connection_input_read_stream(struct connection *conn,
+ struct istream *input)
{
conn->last_input = ioloop_time;
conn->last_input_tv = ioloop_timeval;
if (conn->to != NULL)
timeout_reset(conn->to);
- switch (i_stream_read(conn->input)) {
+ switch (i_stream_read(input)) {
case -2:
/* buffer full */
switch (conn->list->set.input_full_behavior) {
i_unreached();
case -1:
/* disconnected */
+ if (input != conn->input) {
+ i_stream_set_error(conn->input, input->stream_errno,
+ "%s", i_stream_get_error(input));
+ }
connection_closed(conn, CONNECTION_DISCONNECT_CONN_CLOSED);
return -1;
case 0:
}
}
+int connection_input_read(struct connection *conn)
+{
+ return connection_input_read_stream(conn, conn->input);
+}
+
const char *connection_disconnect_reason(struct connection *conn)
{
switch (conn->disconnect_reason) {
/* Returns -1 = disconnected, 0 = nothing new, 1 = something new.
If input_full_behavior is ALLOW, may return also -2 = buffer full. */
int connection_input_read(struct connection *conn);
+/* Same as connection_input_read(), but read from a different input stream.
+ On failures, copy the error to the main istream. This is mainly intended
+ to be used with multiplex istream. */
+int connection_input_read_stream(struct connection *conn,
+ struct istream *input);
/* Verify that VERSION input matches what we expect. */
int connection_verify_version(struct connection *conn,
const char *service_name,