Using mg_connection::callback_param for mg_iterate_over_connection()