Skip to contentSkip to conversation

shows error in logs if the special directories are not defined and close the server if failure to start obex server

PATCH In review Alban Browaeys 2 participants 2 messages Mar 13, 2008 – Mar 14, 2008 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 shows error in logs if the special directories are not defined and close the server if failure to start obex server

This patch is made out of my attempt to start obex-data-server from debian without xdg-user-dirs . It does not work as the glib special directories are nto defined but worst than that :
- it did not tell in the log anything went wrong,
- it did not close the server when it failed to start it and sharing_enabled and received_enabled where not in sync with the server state anymore because of that. applet was trying to create the server while it was already running leading to socket already in use errors after two attempts.
This fixes those issues.

Best regards
Alban

Index: applet/obex.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/obex.c,v
retrieving revision 1.9

obex.c +20 -2
diff -u -r1.9 obex.c
@@ -93,10 +93,19 @@
 static void start_opp_notify(DBusGProxy *proxy,
 				DBusGProxyCall *call, void *user_data)
 {
+	GError *error = NULL;
 	opp_startup = FALSE;
 
-	if (dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID) == FALSE)
+	if (dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID) == FALSE) {
+		if (error != NULL) {
+			g_printerr("Bluetooth OBEX server start failed: %s\n",
+							error->message);
+			g_error_free(error);
+		}
+
+		close_opp_server();
 		return;
+	}
 
 	receive_enabled = TRUE;
 
@@ -150,10 +159,19 @@
 static void start_ftp_notify(DBusGProxy *proxy,
 				DBusGProxyCall *call, void *user_data)
 {
+	GError * error = NULL;
 	ftp_startup = FALSE;
 
-	if (dbus_g_proxy_end_call(proxy, call, NULL, G_TYPE_INVALID) == FALSE)
+	if (dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INVALID) == FALSE) {
+		if (error != NULL) {
+			g_printerr("Bluetooth FTP server start failed: %s\n",
+							error->message);
+			g_error_free(error);
+		}
+
+		close_ftp_server();
 		return;
+	}
 
 	sharing_enabled = TRUE;
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Alban,

Quoted 10 lines

This patch is made out of my attempt to start obex-data-server from debian without xdg-user-dirs . It does not work as the glib special directories are nto defined but worst than that :
- it did not tell in the log anything went wrong,
- it did not close the server when it failed to start it and sharing_enabled and received_enabled where not in sync with the server state anymore because of that. applet was trying to create the server while it was already running leading to socket already in use errors after two attempts.
This fixes those issues.

patch has been applied. Thanks.

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel