rpms/ndesk-dbus-glib/devel ndesk-dbus-glib-sugar-datastore.patch, NONE, 1.1 ndesk-dbus-glib.spec, 1.6, 1.7

Peter Gordon pgordon at fedoraproject.org
Thu Jul 30 03:27:54 UTC 2009


Author: pgordon

Update of /cvs/pkgs/rpms/ndesk-dbus-glib/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24091

Modified Files:
	ndesk-dbus-glib.spec 
Added Files:
	ndesk-dbus-glib-sugar-datastore.patch 
Log Message:
Apply patch for rh#503151, reading from the socket with the Sugar datastore.

ndesk-dbus-glib-sugar-datastore.patch:
 GLib.IO.cs |   44 ++++++++++++++++++++++++++++++++++++++++++++
 GLib.cs    |   12 ++++++++++++
 2 files changed, 56 insertions(+)

--- NEW FILE ndesk-dbus-glib-sugar-datastore.patch ---
diff --git a/src/GLib.IO.cs b/src/GLib.IO.cs
index e9601d9..1df22df 100644
--- a/src/GLib.IO.cs
+++ b/src/GLib.IO.cs
@@ -5,6 +5,7 @@
 using System;
 using System.Collections;
 using System.Runtime.InteropServices;
+using NDesk.DBus;
 
 namespace NDesk.GLib
 {
@@ -167,6 +168,49 @@ namespace NDesk.GLib
 		{
 			g_main_context_wakeup (context);
 		}
+
+		[DllImport(GLIB)]
+			static extern bool g_main_context_iteration (IntPtr context, bool may_block);
+
+		private static bool timerThreadException=false;
+		private static int timeoutReceivingData=500;
+
+		public int TimeoutReceivingData {
+			get {
+				return timeoutReceivingData;
+			}
+			set {
+				timeoutReceivingData=value;
+			}
+		}
+
+		private static void timerThread() {
+			// If timout value is not positive, the timeout handling is disabled.
+			if (timeoutReceivingData>0) {
+				System.Threading.Thread.Sleep(timeoutReceivingData);
+				System.Console.Out.WriteLine("Timer expired...");
+				timerThreadException=true;
+			}
+			return;
+		}
+
+		public static void MainContextIterator (IntPtr context, bool may_block, Connection conn)
+		{
+
+			System.Threading.Thread thread=new System.Threading.Thread(new System.Threading.ThreadStart(timerThread));
+			thread.IsBackground=true;
+			thread.Start();
+			BusG.readEvent=false;
+			while (!BusG.readEvent) {
+				g_main_context_iteration (context,may_block);
+				if (timerThreadException) {
+					throw new Exception("Timer Expired");
+				}
+			}
+			thread.Abort();
+			thread=null;
+		}
+
 	}
 
 	//From Mono.Unix and poll(2)
diff --git a/src/GLib.cs b/src/GLib.cs
index ccfdfc4..3e91a2d 100644
--- a/src/GLib.cs
+++ b/src/GLib.cs
@@ -6,6 +6,7 @@ using System;
 using NDesk.DBus;
 using NDesk.GLib;
 using org.freedesktop.DBus;
+using System.Runtime.InteropServices;
 
 namespace NDesk.DBus
 {
@@ -13,6 +14,9 @@ namespace NDesk.DBus
 	public static class BusG
 	{
 		static bool initialized = false;
+
+		public static bool readEvent=false;
+
 		public static void Init ()
 		{
 			if (initialized)
@@ -36,6 +40,8 @@ namespace NDesk.DBus
 					return false;
 				}
 
+				readEvent=true;
+
 				//this may not provide expected behaviour all the time, but works for now
 				conn.Iterate ();
 				return true;
@@ -48,6 +54,12 @@ namespace NDesk.DBus
 		{
 			IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle);
 			IO.AddWatch (channel, IOCondition.In | IOCondition.Hup, dispatchHandler);
+			conn.WaitForIOCompletitionFuncEvent += waitForData;
+		}
+
+		static public void waitForData(Connection conn) {
+			IO.MainContextIterator(System.IntPtr.Zero,true,conn);
 		}
+			
 	}
 }


Index: ndesk-dbus-glib.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ndesk-dbus-glib/devel/ndesk-dbus-glib.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- ndesk-dbus-glib.spec	25 Jul 2009 15:54:05 -0000	1.6
+++ ndesk-dbus-glib.spec	30 Jul 2009 03:27:54 -0000	1.7
@@ -5,7 +5,7 @@ URL:			http://www.ndesk.org/DBusSharp
 License:		MIT
 Group:			Development/Libraries
 Version:		0.4.1
-Release:		6%{?dist}
+Release:		7%{?dist}
 Summary:		Provides glib mainloop integration for ndesk-dbus
 Source0:		http://www.ndesk.org/archive/dbus-sharp/ndesk-dbus-glib-%{version}.tar.gz
 BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -57,6 +57,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/ndesk-dbus-glib-1.0.pc
 
 %changelog
+* Wed Jul 29 2009 Peter Gordon <peter at thecodergeek.com> - 0.4.1-7
+- Apply patch from Torello Querci to fix reading from the socket with the
+  Sugar datastore (#503151):
+  + sugar-datastore.patch
+
 * Sat Jul 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.4.1-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 




More information about the fedora-extras-commits mailing list