Skip to content

Commit

Permalink
lib-smtp: test-smtp-server-errors: Implicitly stop server when all ex…
Browse files Browse the repository at this point in the history
…pected client connections are closed.
  • Loading branch information
stephanbosch authored and villesavolainen committed Apr 27, 2018
1 parent cc1252b commit 044a32c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib-smtp/test-smtp-server-errors.c
Expand Up @@ -55,6 +55,7 @@ static struct smtp_server *smtp_server = NULL;
static struct io *io_listen;
static int fd_listen = -1;
static struct smtp_server_callbacks server_callbacks;
static unsigned int server_pending;

/* client */
static pid_t *client_pids = NULL;
Expand Down Expand Up @@ -1409,6 +1410,8 @@ static void server_connection_destroy(void *context)
if (debug)
i_debug("Connection destroyed");

if (--server_pending == 0)
io_loop_stop(ioloop);
i_free(sconn);
}

Expand Down Expand Up @@ -1574,6 +1577,7 @@ static void test_run_client_server(

i_zero(&server_callbacks);

server_pending = client_tests_count;
ioloop = io_loop_create();
server_test(server_set);
io_loop_destroy(&ioloop);
Expand Down

0 comments on commit 044a32c

Please sign in to comment.