diff -r b200d6198191 -r 00536b0eb88b gmyth-dbus/src/gmyth-dbus-server.c --- a/gmyth-dbus/src/gmyth-dbus-server.c Thu Feb 07 19:36:22 2008 +0000 +++ b/gmyth-dbus/src/gmyth-dbus-server.c Mon Feb 25 18:40:34 2008 +0000 @@ -92,7 +92,11 @@ const gchar *user, const gchar *password, GError **error); - +static gboolean +gmyth_dbus_server_check_server_connection (GObject *obj, + const gchar *host, + gint port, + GError **error); static gboolean gmyth_dbus_server_get_channel_list (GObject *obj, GPtrArray **channels, GError **error); @@ -1313,6 +1317,32 @@ if (!ret) { g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION, + _("Fail to connect with backend database")); + } + + return ret; +} + +static gboolean +gmyth_dbus_server_check_server_connection (GObject *obj, + const gchar *host, + gint port, + GError **error) +{ + GMythSocket *msocket = gmyth_socket_new (); + gboolean ret; + + gmyth_debug (""); + + g_debug ("Checking server connection"); + ret = gmyth_socket_connect_with_timeout (msocket, host, port, 2); + g_debug ("Return %s", ret ? "ok" : "bad"); + gmyth_socket_close_connection (msocket); + + g_object_unref (msocket); + + if (!ret) { + g_set_error (error, GMYTH_DBUS_ERROR, GMYTH_DBUS_ERROR_CONNECTION, _("Fail to connect with backend")); }