Skip to content

Commit

Permalink
lib: Add connection_streams_changed()
Browse files Browse the repository at this point in the history
Originally by Stephan Bosch
  • Loading branch information
sirainen authored and villesavolainen committed Feb 22, 2018
1 parent 4b98666 commit 4e08651
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/connection.c
Expand Up @@ -164,6 +164,16 @@ static void connection_init_streams(struct connection *conn)
}
}

void connection_streams_changed(struct connection *conn)
{
const struct connection_settings *set = &conn->list->set;

if (set->input_max_size != 0 && conn->io != NULL) {
io_remove(&conn->io);
conn->io = io_add_istream(conn->input, *conn->list->v.input, conn);
}
}

static void connection_client_connected(struct connection *conn, bool success)
{
i_assert(conn->list->set.client);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/connection.h
Expand Up @@ -127,6 +127,8 @@ int connection_client_connect(struct connection *conn);
void connection_disconnect(struct connection *conn);
void connection_deinit(struct connection *conn);

void connection_streams_changed(struct connection *conn);

/* 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);
Expand Down

0 comments on commit 4e08651

Please sign in to comment.