Author: gschneider
Date: Tue Aug 18 14:45:45 2009
New Revision: 42763
URL:
http://svn.reactos.org/svn/reactos?rev=42763&view=rev
Log:
- Improve pipe client mode for improved QEmu debugging: it now waits for a pipe server,
threaded
- Remove automatic pipe connection mode, that idea is outdated
Modified:
trunk/tools/reactosdbg/Pipe/namedpipe.cs
trunk/tools/reactosdbg/RosDBG/Connect.cs
trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs
Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/namedpipe.cs…
==============================================================================
--- trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] Tue Aug 18 14:45:45 2009
@@ -13,7 +13,6 @@
{
MODE_CLIENT = 0x00000000,
MODE_SERVER = 0x00000001,
- MODE_AUTO = 0x00000002
}
public class NamedPipe : Pipe, NPipe
@@ -26,6 +25,7 @@
private bool bClientConn;
private Thread waitThread;
private NamedPipeServerStream sStream;
+ private NamedPipeClientStream cStream;
public event EventHandler ClientConnectedEvent;
public event EventHandler ClientDisconnectedEvent;
@@ -90,30 +90,49 @@
waitThread.Start();
}
+ private void WaitForServer()
+ {
+ while (true)
+ {
+ try
+ {
+ cStream.Connect(10);
+ }
+ catch (TimeoutException)
+ {
+ /* Dismiss timeout, will try again */
+ }
+ catch (Exception)
+ {
+ /* Pipe was killed externally */
+ return;
+ }
+ if (cStream.IsConnected)
+ {
+ ioStream = cStream;
+ signalConnected();
+ return;
+ }
+ Thread.Sleep(500);
+ }
+ }
+
public bool CreateClientPipe(string name)
{
- /* try to connect as a client */
+ /* Try to connect as a client */
/* (QEMU -serial pipe or VMware in pipe server mode) */
try
{
- NamedPipeClientStream cStream = new NamedPipeClientStream(".",
name, PipeDirection.InOut, PipeOptions.Asynchronous);
- cStream.Connect(100);
-
- if (cStream.IsConnected)
- {
- ioStream = cStream;
- signalConnected();
- return true;
- }
- else
- {
- return false;
- }
+ cStream = new NamedPipeClientStream(".", name,
PipeDirection.InOut, PipeOptions.Asynchronous);
}
catch (Exception)
{
+ /* Pipe couldn't be created */
return false;
}
+ waitThread = new Thread(WaitForServer);
+ waitThread.Start();
+ return true;
}
public bool CreatePipe(string name, ConnectionMode mode)
@@ -124,14 +143,6 @@
}
switch (mode)
{
- case ConnectionMode.MODE_AUTO:
- //check if pipe exists, if not create server pipe, wait certain time,
check if pipe...
- //TODO: server-client lookup should time out
- CreateClientPipe(name);
- CreateServerPipe(name);
-
- return true;
-
case ConnectionMode.MODE_CLIENT:
CreateClientPipe(name);
return true;
@@ -153,9 +164,17 @@
/* Wake up the write thread so it can die */
newWriteData.Set();
+ /* Close connection streams */
if (waitThread != null)
{
- sStream.Close();
+ if (sStream != null)
+ {
+ sStream.Close();
+ }
+ else if (cStream != null)
+ {
+ cStream.Close();
+ }
}
}
Modified: trunk/tools/reactosdbg/RosDBG/Connect.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Connect.cs…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/Connect.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/Connect.cs [iso-8859-1] Tue Aug 18 14:45:45 2009
@@ -98,8 +98,6 @@
pipeMode = ConnectionMode.MODE_CLIENT;
else if (cType.SelectedItem.ToString().CompareTo("Server") == 0)
pipeMode = ConnectionMode.MODE_SERVER;
- else if (cType.SelectedItem.ToString().CompareTo("Automatic") ==
0)
- pipeMode = ConnectionMode.MODE_AUTO;
Settings.SelectedConnType = Type;
Settings.Mode = cType.SelectedItem.ToString();
Modified: trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Properties…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] Tue Aug 18
14:45:45 2009
@@ -39,5 +39,5 @@
// will be increased as well. MSI installers must not be generated with the same Build
Number
// otherwise they won't upgrade the old installation!
-[assembly: AssemblyVersion("1.0.2.68")]
-[assembly: AssemblyFileVersion("1.0.2.68")]
+[assembly: AssemblyVersion("1.0.2.69")]
+[assembly: AssemblyFileVersion("1.0.2.69")]