Commit 6ed9ff7b authored by Slava Monich's avatar Slava Monich

[mms-engine] Separate network and service inactivity timeouts. JB#42837

If "singleDataContext" option is enabled in ofono, it makes sense
to configure mms-engine to use shorter network inactivity timeout
so that data connection gets restored faster. Which shouldn't
affect the general service inactivity timeout.
parent 67749b09
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -177,8 +177,11 @@ mms_app_parse_options(
char* retry_secs_help = g_strdup_printf(
"Retry period in seconds [%d]",
opt->global.config.retry_secs);
char* network_idle_secs_help = g_strdup_printf(
"Network inactivity timeout in seconds [%d]",
opt->global.config.network_idle_secs);
char* idle_secs_help = g_strdup_printf(
"Inactivity timeout in seconds [%d]",
"Service inactivity timeout in seconds [%d]",
opt->global.config.idle_secs);
char* description = gutil_log_description(NULL, 0);
......@@ -194,6 +197,9 @@ mms_app_parse_options(
&root_dir, root_dir_help, "DIR" },
{ "retry-secs", 'r', 0, G_OPTION_ARG_INT,
&opt->global.config.retry_secs, retry_secs_help, "SEC" },
{ "network-idle-secs", 'n', 0, G_OPTION_ARG_INT,
&opt->global.config.network_idle_secs,
network_idle_secs_help, "SEC" },
{ "idle-secs", 'i', 0, G_OPTION_ARG_INT,
&opt->global.config.idle_secs, idle_secs_help, "SEC" },
{ "size-limit", 's', 0, G_OPTION_ARG_INT,
......@@ -291,6 +297,7 @@ mms_app_parse_options(
g_free(root_dir_help);
g_free(retry_secs_help);
g_free(idle_secs_help);
g_free(network_idle_secs_help);
g_free(description);
if (!ok) {
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -65,7 +65,7 @@ struct mms_engine {
gboolean stopped;
gboolean stop_requested;
gboolean keep_running;
guint start_timeout_id;
guint idle_timer_id;
gulong proxy_signal_id[MMS_ENGINE_METHOD_COUNT];
};
......@@ -88,7 +88,7 @@ mms_engine_stop_callback(
engine->stopped = TRUE;
if (engine->loop) g_main_loop_quit(engine->loop);
mms_engine_unref(engine);
return FALSE;
return G_SOURCE_REMOVE;
}
static
......@@ -101,36 +101,38 @@ mms_engine_stop_schedule(
static
gboolean
mms_engine_start_timeout_callback(
mms_engine_idle_timer_expired(
gpointer data)
{
MMSEngine* engine = data;
GASSERT(engine->start_timeout_id);
GASSERT(engine->idle_timer_id);
GINFO("Shutting down due to inactivity...");
engine->start_timeout_id = 0;
engine->idle_timer_id = 0;
mms_engine_stop_schedule(engine);
return FALSE;
return G_SOURCE_REMOVE;
}
static
void
mms_engine_start_timeout_cancel(
mms_engine_idle_timer_stop(
MMSEngine* engine)
{
if (engine->start_timeout_id) {
g_source_remove(engine->start_timeout_id);
engine->start_timeout_id = 0;
if (engine->idle_timer_id) {
g_source_remove(engine->idle_timer_id);
engine->idle_timer_id = 0;
}
}
static
void
mms_engine_start_timeout_schedule(
mms_engine_idle_timer_check(
MMSEngine* engine)
{
mms_engine_start_timeout_cancel(engine);
engine->start_timeout_id = g_timeout_add_seconds(engine->config->idle_secs,
mms_engine_start_timeout_callback, engine);
mms_engine_idle_timer_stop(engine);
if (!mms_dispatcher_is_started(engine->dispatcher) && !engine->keep_running) {
engine->idle_timer_id = g_timeout_add_seconds(engine->config->idle_secs,
mms_engine_idle_timer_expired, engine);
}
}
/* org.nemomobile.MmsEngine.sendMessage */
......@@ -186,9 +188,7 @@ mms_engine_handle_send_message(
imsi_to, to_list, cc_list, bcc_list, subject, flags, parts,
info->len, &error);
if (imsi) {
if (mms_dispatcher_start(engine->dispatcher)) {
mms_engine_start_timeout_cancel(engine);
}
mms_dispatcher_start(engine->dispatcher);
org_nemomobile_mms_engine_complete_send_message(proxy, call, imsi);
g_free(imsi);
} else {
......@@ -213,6 +213,7 @@ mms_engine_handle_send_message(
g_dbus_method_invocation_return_error(call, G_DBUS_ERROR,
G_DBUS_ERROR_FAILED, "Missing recipient");
}
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -237,9 +238,7 @@ mms_engine_handle_receive_message(
GError* error = NULL;
if (mms_dispatcher_receive_message(engine->dispatcher, id, imsi,
automatic, push, &error)) {
if (mms_dispatcher_start(engine->dispatcher)) {
mms_engine_start_timeout_cancel(engine);
}
mms_dispatcher_start(engine->dispatcher);
org_nemomobile_mms_engine_complete_receive_message(proxy, call);
} else {
g_dbus_method_invocation_return_error(call, G_DBUS_ERROR,
......@@ -252,6 +251,7 @@ mms_engine_handle_receive_message(
g_dbus_method_invocation_return_error(call, G_DBUS_ERROR,
G_DBUS_ERROR_FAILED, "Invalid parameters");
}
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -274,9 +274,7 @@ mms_engine_handle_send_read_report(
if (mms_dispatcher_send_read_report(engine->dispatcher, id, imsi,
message_id, to, (read_status == 1) ? MMS_READ_STATUS_DELETED :
MMS_READ_STATUS_READ, &error)) {
if (mms_dispatcher_start(engine->dispatcher)) {
mms_engine_start_timeout_cancel(engine);
}
mms_dispatcher_start(engine->dispatcher);
org_nemomobile_mms_engine_complete_send_read_report(proxy, call);
} else {
g_dbus_method_invocation_return_error(call, G_DBUS_ERROR,
......@@ -284,6 +282,7 @@ mms_engine_handle_send_read_report(
g_error_free(error);
}
g_free(id);
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -302,6 +301,7 @@ mms_engine_handle_cancel(
mms_dispatcher_cancel(engine->dispatcher, id);
org_nemomobile_mms_engine_complete_cancel(proxy, call);
g_free(id);
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -335,9 +335,7 @@ mms_engine_handle_push_notify(
GError* err = NULL;
GBytes* msg = g_bytes_new(bytes, len);
if (mms_dispatcher_handle_push(engine->dispatcher, imsi, msg, &err)) {
if (mms_dispatcher_start(engine->dispatcher)) {
mms_engine_start_timeout_cancel(engine);
}
mms_dispatcher_start(engine->dispatcher);
org_nemomobile_mms_engine_complete_push(proxy, call);
} else {
g_dbus_method_invocation_return_error(call, G_DBUS_ERROR,
......@@ -346,6 +344,7 @@ mms_engine_handle_push_notify(
}
g_bytes_unref(msg);
}
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -392,6 +391,7 @@ mms_engine_handle_set_log_level(
gutil_log_default.level = level;
}
org_nemomobile_mms_engine_complete_set_log_level(proxy, call);
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -407,6 +407,7 @@ mms_engine_handle_set_log_type(
GDEBUG_("%s", type);
gutil_log_set_type(type, MMS_APP_LOG_PREFIX);
org_nemomobile_mms_engine_complete_set_log_type(proxy, call);
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -433,6 +434,7 @@ mms_engine_handle_get_version(
GDEBUG_("oops");
org_nemomobile_mms_engine_complete_get_version(proxy, call, 0, 0, 0, "");
#endif
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -447,7 +449,7 @@ mms_engine_handle_migrate_settings(
{
char* tmp = NULL;
/* Querying settings will migrate per-SIM settings after upgrading
* from 1.0.21 or older version of mme-engine */
* from 1.0.21 or older version of mms-engine */
GDEBUG_("%s", imsi);
if (!imsi || !imsi[0]) {
imsi = tmp = mms_connman_default_imsi(engine->cm);
......@@ -457,6 +459,7 @@ mms_engine_handle_migrate_settings(
}
org_nemomobile_mms_engine_complete_migrate_settings(proxy, call);
g_free(tmp);
mms_engine_idle_timer_check(engine);
return TRUE;
}
......@@ -570,11 +573,10 @@ mms_engine_run(
engine->loop = loop;
engine->stopped = FALSE;
engine->stop_requested = FALSE;
if (!mms_dispatcher_start(engine->dispatcher) && !engine->keep_running) {
mms_engine_start_timeout_schedule(engine);
}
mms_dispatcher_start(engine->dispatcher);
mms_engine_idle_timer_check(engine);
g_main_loop_run(loop);
mms_engine_start_timeout_cancel(engine);
mms_engine_idle_timer_stop(engine);
engine->loop = NULL;
}
......@@ -627,8 +629,10 @@ mms_engine_delegate_dispatcher_done(
{
MMSEngine* engine = mms_engine_from_dispatcher_delegate(delegate);
GDEBUG("All done");
if (!engine->keep_running || engine->stop_requested) {
if (engine->stop_requested) {
mms_engine_stop_schedule(engine);
} else {
mms_engine_idle_timer_check(engine);
}
}
......@@ -658,7 +662,7 @@ mms_engine_dispose(
GVERBOSE_("%p", mms);
GASSERT(!mms->loop);
mms_engine_unregister(mms);
mms_engine_start_timeout_cancel(mms);
mms_engine_idle_timer_stop(mms);
if (mms->proxy) {
gutil_disconnect_handlers(mms->proxy, mms->proxy_signal_id,
G_N_ELEMENTS(mms->proxy_signal_id));
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -47,6 +47,10 @@ mms_dispatcher_set_delegate(
MMSDispatcher* dispatcher,
MMSDispatcherDelegate* delegate);
gboolean
mms_dispatcher_is_started(
MMSDispatcher* dispatcher);
gboolean
mms_dispatcher_is_active(
MMSDispatcher* dispatcher);
......
/*
* Copyright (C) 2014-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2014-2018 Jolla Ltd.
* Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -21,7 +21,8 @@
struct mms_config {
const char* root_dir; /* Root directory for storing MMS files */
int retry_secs; /* Retry timeout in seconds */
int idle_secs; /* Idle timeout */
int network_idle_secs; /* Network inactivity timeout */
int idle_secs; /* Service inactivity timeout */
gboolean keep_temp_files; /* Keep temporary files around */
gboolean attic_enabled; /* Keep unrecognized push message in attic */
};
......@@ -31,9 +32,10 @@ typedef struct mms_config_copy {
char* root_dir; /* Allocated copy of root_dir */
} MMSConfigCopy;
#define MMS_CONFIG_DEFAULT_ROOT_DIR "/tmp/mms"
#define MMS_CONFIG_DEFAULT_RETRY_SECS (15)
#define MMS_CONFIG_DEFAULT_IDLE_SECS (20)
#define MMS_CONFIG_DEFAULT_ROOT_DIR "/tmp/mms"
#define MMS_CONFIG_DEFAULT_RETRY_SECS (15)
#define MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS (10)
#define MMS_CONFIG_DEFAULT_IDLE_SECS (30)
/* Persistent mutable per-SIM settings */
struct mms_settings_sim_data {
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -200,9 +200,10 @@ mms_dispatcher_network_idle_check(
{
if (disp->connection && !disp->network_idle_id) {
/* Schedule idle inactivity timeout callback */
const MMSConfig* config = disp->settings->config;
GVERBOSE("Network connection is inactive");
disp->network_idle_id = mms_dispatcher_timeout_callback_schedule(disp,
disp->settings->config->idle_secs, mms_dispatcher_network_idle_run);
config->network_idle_secs, mms_dispatcher_network_idle_run);
}
}
......@@ -309,6 +310,17 @@ mms_dispatcher_is_active(
disp->active_task || !g_queue_is_empty(disp->tasks));
}
/**
* Checks if dispatcher has been started. If it is then delegate may expect
* its done callback invoked at some point later.
*/
gboolean
mms_dispatcher_is_started(
MMSDispatcher* disp)
{
return disp && disp->started;
}
/**
* Task queue sort callback. Defines the order in which tasks are executed.
* Returns 0 if the tasks are equal, a negative value if the first task
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -66,6 +66,7 @@ mms_lib_default_config(
{
config->root_dir = MMS_CONFIG_DEFAULT_ROOT_DIR;
config->retry_secs = MMS_CONFIG_DEFAULT_RETRY_SECS;
config->network_idle_secs = MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS;
config->idle_secs = MMS_CONFIG_DEFAULT_IDLE_SECS;
config->keep_temp_files = FALSE;
config->attic_enabled = FALSE;
......
/*
* Copyright (C) 2014-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2014-2018 Jolla Ltd.
* Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -20,17 +20,18 @@
#include <gutil_log.h>
GLOG_MODULE_DEFINE("mms-settings");
#define SETTINGS_GLOBAL_GROUP "Global"
#define SETTINGS_GLOBAL_KEY_ROOT_DIR "RootDir"
#define SETTINGS_GLOBAL_KEY_RETRY_SEC "RetryDelay"
#define SETTINGS_GLOBAL_KEY_IDLE_SEC "IdleTimeout"
#define SETTINGS_GLOBAL_GROUP "Global"
#define SETTINGS_GLOBAL_KEY_ROOT_DIR "RootDir"
#define SETTINGS_GLOBAL_KEY_RETRY_SEC "RetryDelay"
#define SETTINGS_GLOBAL_KEY_NETWORK_IDLE_SEC "NetworkIdleTimeout"
#define SETTINGS_GLOBAL_KEY_IDLE_SEC "IdleTimeout"
#define SETTINGS_DEFAULTS_GROUP "Defaults"
#define SETTINGS_DEFAULTS_KEY_USER_AGENT "UserAgent"
#define SETTINGS_DEFAULTS_KEY_UAPROF "UAProfile"
#define SETTINGS_DEFAULTS_KEY_SIZE_LIMIT "SizeLimit"
#define SETTINGS_DEFAULTS_KEY_MAX_PIXELS "MaxPixels"
#define SETTINGS_DEFAULTS_KEY_ALLOW_DR "SendDeliveryReport"
#define SETTINGS_DEFAULTS_GROUP "Defaults"
#define SETTINGS_DEFAULTS_KEY_USER_AGENT "UserAgent"
#define SETTINGS_DEFAULTS_KEY_UAPROF "UAProfile"
#define SETTINGS_DEFAULTS_KEY_SIZE_LIMIT "SizeLimit"
#define SETTINGS_DEFAULTS_KEY_MAX_PIXELS "MaxPixels"
#define SETTINGS_DEFAULTS_KEY_ALLOW_DR "SendDeliveryReport"
G_DEFINE_TYPE(MMSSettings, mms_settings, G_TYPE_OBJECT)
#define MMS_SETTINGS_GET_CLASS(obj) \
......@@ -65,6 +66,43 @@ mms_settings_sim_data_default(
data->allow_dr = MMS_SETTINGS_DEFAULT_ALLOW_DR;
}
static
gboolean
mms_settings_parse_int(
GKeyFile* file,
const char* group,
const char* key,
int* out,
int min_value)
{
GError* error = NULL;
const int i = g_key_file_get_integer(file, group, key, &error);
if (error) {
g_error_free(error);
} else if (i >= min_value) {
*out = i;
GDEBUG("%s = %d", key, i);
return TRUE;
}
return FALSE;
}
static
void
mms_settings_parse_uint(
GKeyFile* file,
const char* group,
const char* key,
unsigned int* out)
{
int value;
if (mms_settings_parse_int(file, group, key, &value, 1)) {
*out = value;
}
}
static
void
mms_settings_parse_global_config(
......@@ -72,37 +110,28 @@ mms_settings_parse_global_config(
GKeyFile* file)
{
const char* group = SETTINGS_GLOBAL_GROUP;
GError* error = NULL;
MMSConfig* config = &global->config;
char* s;
int i;
s = g_key_file_get_string(file, group,
SETTINGS_GLOBAL_KEY_ROOT_DIR, NULL);
if (s) {
g_free(global->root_dir);
global->config.root_dir = global->root_dir = s;
config->root_dir = global->root_dir = s;
GDEBUG("%s = %s", SETTINGS_GLOBAL_KEY_ROOT_DIR, s);
}
i = g_key_file_get_integer(file, group,
SETTINGS_GLOBAL_KEY_RETRY_SEC, &error);
if (error) {
g_error_free(error);
error = NULL;
} else if (i >= 0) {
global->config.retry_secs = i;
GDEBUG("%s = %d", SETTINGS_GLOBAL_KEY_RETRY_SEC, i);
}
mms_settings_parse_int(file, group,
SETTINGS_GLOBAL_KEY_RETRY_SEC,
&config->retry_secs, 0);
i = g_key_file_get_integer(file, group,
SETTINGS_GLOBAL_KEY_IDLE_SEC, &error);
if (error) {
g_error_free(error);
error = NULL;
} else if (i >= 0) {
global->config.idle_secs = i;
GDEBUG("%s = %d", SETTINGS_GLOBAL_KEY_IDLE_SEC, i);
}
mms_settings_parse_int(file, group,
SETTINGS_GLOBAL_KEY_NETWORK_IDLE_SEC,
&config->network_idle_secs, 0);
mms_settings_parse_int(file, group,
SETTINGS_GLOBAL_KEY_IDLE_SEC,
&config->idle_secs, 0);
}
static
......@@ -115,7 +144,6 @@ mms_settings_parse_sim_config(
GError* error = NULL;
gboolean b;
char* s;
int i;
s = g_key_file_get_string(file, group,
SETTINGS_DEFAULTS_KEY_USER_AGENT, NULL);
......@@ -133,25 +161,13 @@ mms_settings_parse_sim_config(
GDEBUG("%s = %s", SETTINGS_DEFAULTS_KEY_UAPROF, s);
}
i = g_key_file_get_integer(file, group,
SETTINGS_DEFAULTS_KEY_SIZE_LIMIT, &error);
if (error) {
g_error_free(error);
error = NULL;
} else if (i > 0) {
defaults->data.size_limit = i;
GDEBUG("%s = %d", SETTINGS_DEFAULTS_KEY_SIZE_LIMIT, i);
}
mms_settings_parse_uint(file, group,
SETTINGS_DEFAULTS_KEY_SIZE_LIMIT,
&defaults->data.size_limit);
i = g_key_file_get_integer(file, group,
SETTINGS_DEFAULTS_KEY_MAX_PIXELS, &error);
if (error) {
g_error_free(error);
error = NULL;
} else if (i > 0) {
defaults->data.max_pixels = i;
GDEBUG("%s = %d", SETTINGS_DEFAULTS_KEY_MAX_PIXELS, i);
}
mms_settings_parse_uint(file, group,
SETTINGS_DEFAULTS_KEY_MAX_PIXELS,
&defaults->data.max_pixels);
b = g_key_file_get_boolean(file, group,
SETTINGS_DEFAULTS_KEY_ALLOW_DR, &error);
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -261,7 +261,7 @@ int main(int argc, char* argv[])
TestDirs dirs;
test_dirs_init(&dirs, test);
config.root_dir = dirs.root;
config.idle_secs = 0;
config.network_idle_secs = 0;
config.attic_enabled = TRUE;
ret = test_run(&config, testcase);
test_dirs_cleanup(&dirs, TRUE);
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -261,7 +261,7 @@ int main(int argc, char* argv[])
TestDirs dirs;
test_dirs_init(&dirs, test);
config.root_dir = dirs.root;
config.idle_secs = 0;
config.network_idle_secs = 0;
config.attic_enabled = TRUE;
ret = test_run(&config, testcase);
test_dirs_cleanup(&dirs, TRUE);
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -273,7 +273,7 @@ int main(int argc, char* argv[])
test_dirs_init(&dirs, test);
mms_lib_default_config(&config);
config.idle_secs = 0;
config.network_idle_secs = 0;
config.root_dir = dirs.root;
if (argc < 2) {
ret = test_read_report(&config, NULL, debug);
......
/*
* Copyright (C) 2013-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -806,7 +806,7 @@ int main(int argc, char* argv[])
mms_lib_default_config(&config);
config.root_dir = dirs.root;
config.keep_temp_files = keep_temp;
config.idle_secs = 0;
config.network_idle_secs = 0;
config.attic_enabled = TRUE;
if (argc < 2) {
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -251,7 +251,7 @@ int main(int argc, char* argv[])
TestDirs dirs;
test_dirs_init(&dirs, test);
config.root_dir = dirs.root;
config.idle_secs = 0;
config.network_idle_secs = 0;
config.attic_enabled = TRUE;
ret = test_retrieve_no_proxy(&config);
test_dirs_cleanup(&dirs, TRUE);
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -401,7 +401,7 @@ int main(int argc, char* argv[])
mms_lib_default_config(&config);
config.root_dir = dirs.root;
config.keep_temp_files = keep_temp;
config.idle_secs = 0;
config.network_idle_secs = 0;
if (argc < 2) {
ret = test_order(&config, NULL, debug);
} else {
......
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2013-2018 Jolla Ltd.
* Copyright (C) 2013-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -548,7 +548,7 @@ int main(int argc, char* argv[])
mms_lib_default_config(&config);
config.keep_temp_files = keep_temp;
config.root_dir = dirs.root;
config.idle_secs = 0;
config.network_idle_secs = 0;
ret = test_run(&config, testcase, debug);
test_dirs_cleanup(&dirs, !keep_temp);
......
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2016-2018 Jolla Ltd.
* Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -31,7 +31,8 @@ typedef struct test_desc {
#define DEFAULT_CONFIG \
MMS_CONFIG_DEFAULT_ROOT_DIR, MMS_CONFIG_DEFAULT_RETRY_SECS, \
MMS_CONFIG_DEFAULT_IDLE_SECS, FALSE, FALSE
MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS, MMS_CONFIG_DEFAULT_IDLE_SECS, \
FALSE, FALSE
#define DEFAULT_SETTINGS \
MMS_SETTINGS_DEFAULT_USER_AGENT, MMS_SETTINGS_DEFAULT_UAPROF, \
MMS_SETTINGS_DEFAULT_SIZE_LIMIT, MMS_SETTINGS_DEFAULT_MAX_PIXELS, \
......@@ -49,16 +50,24 @@ static const TestDesc tests [] = {
},{
"RootDir",
{ "TestRootDir", MMS_CONFIG_DEFAULT_RETRY_SECS,
MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS,
MMS_CONFIG_DEFAULT_IDLE_SECS, FALSE, FALSE },
{ DEFAULT_SETTINGS }
},{
"RetryDelay",
{ MMS_CONFIG_DEFAULT_ROOT_DIR, 111,
MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS,
MMS_CONFIG_DEFAULT_IDLE_SECS, FALSE, FALSE },
{ DEFAULT_SETTINGS }
},{
"NetworkIdleTimeout",
{ MMS_CONFIG_DEFAULT_ROOT_DIR, MMS_CONFIG_DEFAULT_RETRY_SECS,
111, MMS_CONFIG_DEFAULT_IDLE_SECS, FALSE, FALSE },
{ DEFAULT_SETTINGS }
},{
"IdleTimeout",
{ MMS_CONFIG_DEFAULT_ROOT_DIR, MMS_CONFIG_DEFAULT_RETRY_SECS,
MMS_CONFIG_DEFAULT_NETWORK_IDLE_SECS,
222, FALSE, FALSE },
{ DEFAULT_SETTINGS }
},{
......@@ -102,6 +111,7 @@ test_config_equal(
{
return !g_strcmp0(c1->root_dir, c2->root_dir) &&
c1->retry_secs == c2->retry_secs &&
c1->network_idle_secs == c2->network_idle_secs &&
c1->idle_secs == c2->idle_secs &&
c1->keep_temp_files == c2->keep_temp_files &&
c1->attic_enabled == c2->attic_enabled;
......@@ -121,7 +131,7 @@ test_settings_equal(
}
static
gboolean
int
test_run(
const TestDesc* test)
{
......@@ -151,7 +161,7 @@ test_run(
g_free(global.root_dir);
mms_settings_sim_data_reset(&defaults);
GINFO("%s: %s", (ret == RET_OK) ? "OK" : "FAILED", test->name);
return FALSE;
return ret;
}
int main(int argc, char* argv[])
......@@ -166,12 +176,12 @@ int main(int argc, char* argv[])
};
mms_lib_init(argv[0]);