db->queue = next;
}
- if (db->queue_to != 0)
+ if (db->queue_to != NULL)
timeout_remove(&db->queue_to);
driver_pgsql_close(db);
i_free(db->error);
struct pgsql_db *db = (struct pgsql_db *)_db;
struct io old_io;
+ if (db->queue_to != NULL) {
+ /* we're creating a new ioloop, make sure the timeout gets
+ added there. */
+ timeout_remove(&db->queue_to);
+ }
+
if (db->io == NULL)
db->ioloop = io_loop_create();
else {
old_io.callback, old_io.context);
}
- if (db->queue_to != NULL) {
- /* we're creating a new ioloop, make sure the timeout gets
- added there. */
- timeout_remove(&db->queue_to);
- }
-
db->query_finished = FALSE;
driver_pgsql_query(_db, query, pgsql_query_s_callback, db);
}
if (db->queue_to != NULL)
timeout_remove(&db->queue_to);
+ } else {
+ i_assert(db->io == NULL);
+ i_assert(db->queue_to == NULL);
}
io_loop_destroy(&db->ioloop);