From: <me...@us...> - 2008-02-08 00:03:03
|
Revision: 922 http://gmyth.svn.sourceforge.net/gmyth/?rev=922&view=rev Author: melunko Date: 2008-02-07 16:03:03 -0800 (Thu, 07 Feb 2008) Log Message: ----------- Added method to check mythtv backend connection Modified Paths: -------------- trunk/gmyth-dbus/configure.ac trunk/gmyth-dbus/src/gmyth-dbus-server.c trunk/gmyth-dbus/src/gmyth-dbus-server.xml Modified: trunk/gmyth-dbus/configure.ac =================================================================== --- trunk/gmyth-dbus/configure.ac 2008-02-07 19:36:22 UTC (rev 921) +++ trunk/gmyth-dbus/configure.ac 2008-02-08 00:03:03 UTC (rev 922) @@ -67,7 +67,7 @@ PKG_CHECK_MODULES(GMYTH, gmyth >= 0.7, HAVE_GMYTH=yes, HAVE_GMYTH=no) if test "x$HAVE_GMYTH" = "xno"; then - AC_MSG_ERROR(you need libgmyth-dev installed) + AC_MSG_ERROR(you need libgmyth-dev >= 0.7 installed) fi AC_SUBST(GMYTH_CFLAGS) AC_SUBST(GMYTH_LIBS) Modified: trunk/gmyth-dbus/src/gmyth-dbus-server.c =================================================================== --- trunk/gmyth-dbus/src/gmyth-dbus-server.c 2008-02-07 19:36:22 UTC (rev 921) +++ trunk/gmyth-dbus/src/gmyth-dbus-server.c 2008-02-08 00:03:03 UTC (rev 922) @@ -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")); } Modified: trunk/gmyth-dbus/src/gmyth-dbus-server.xml =================================================================== --- trunk/gmyth-dbus/src/gmyth-dbus-server.xml 2008-02-07 19:36:22 UTC (rev 921) +++ trunk/gmyth-dbus/src/gmyth-dbus-server.xml 2008-02-08 00:03:03 UTC (rev 922) @@ -18,6 +18,11 @@ <arg type="s" name="password" direction="in" /> </method> + <method name="CheckServerConnection"> + <arg type="s" name="host" direction="in" /> + <arg type="i" name="port" direction="in" /> + </method> + <method name="Connected"> <arg type="b" name="status" direction="out" /> </method> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |