Author: gedmurphy
Date: Wed Jun 3 13:41:47 2009
New Revision: 41268
URL:
http://svn.reactos.org/svn/reactos?rev=41268&view=rev
Log:
- Detect when clients disconnect from the pipe server and raise an event
- Reinitialize the pipe server and wait for new connections on disconnect
- You can disconnect and reconnect reactos without restarting rosdbg now
- Fix the read and write threads to we don't have to call the evil Thread.Abort (for
kjk)
- Don't enumerate the externals tools if the list is empty, fixes a
NullReferenceException
Modified:
trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
trunk/tools/reactosdbg/Pipe/namedpipe.cs
trunk/tools/reactosdbg/Pipe/pipe.cs
trunk/tools/reactosdbg/RosDBG/MainWindow.cs
trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs
Modified: trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/Deb…
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] Wed Jun 3
13:41:47 2009
@@ -173,6 +173,8 @@
#region Named Pipe Members
NamedPipe mNamedPipe;
+ string mPipeName;
+ ConnectionMode mMode;
Thread ReadThread;
Thread WriteThread;
#endregion
@@ -235,13 +237,24 @@
WriteThread.Start();
}
+ void NamedPipe_ClientDisconectedEvent(object sender, EventArgs e)
+ {
+ Running = false;
+ mNamedPipe.Close();
+ mNamedPipe.CreatePipe(mPipeName, mMode);
+ }
+
public void StartPipe(string pipeName, ConnectionMode mode)
{
+ mPipeName = pipeName;
+ mMode = mode;
+
Close();
ConnectionMode = Mode.PipeMode;
mNamedPipe = new NamedPipe();
mNamedPipe.ClientConnectedEvent += new
EventHandler(NamedPipe_ClientConnectedEvent);
+ mNamedPipe.ClientDisconnectedEvent += new
EventHandler(NamedPipe_ClientDisconectedEvent);
mNamedPipe.PipeReceiveEvent +=new PipeReceiveEventHandler(PipeReceiveEvent);
mNamedPipe.PipeErrorEvent +=new PipeErrorEventHandler(MediumErrorEvent);
@@ -352,10 +365,7 @@
mNamedPipe = null;
}
Running = false;
- if (ReadThread != null)
- ReadThread.Abort();
- if (WriteThread != null)
- WriteThread.Abort();
+
break;
}
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] Wed Jun 3 13:41:47 2009
@@ -27,6 +27,7 @@
private Thread waitThread;
public event EventHandler ClientConnectedEvent;
+ public event EventHandler ClientDisconnectedEvent;
public event PipeReceiveEventHandler PipeReceiveEvent;
public event PipeErrorEventHandler PipeErrorEvent;
@@ -129,6 +130,11 @@
if (ioStream != null)
ioStream.Close();
+ bClientConn = false;
+
+ /* Wake up the write thread so it can die */
+ newWriteData.Set();
+
if (waitThread != null)
waitThread.Abort();
}
@@ -144,7 +150,7 @@
{
try
{
- while (true)
+ while (bClientConn)
{
if (cmdList.Count > 0)
{
@@ -186,7 +192,7 @@
{
try
{
- while (true)
+ while (bClientConn)
{
read = ioStream.Read(buf, 0, PIPE_SIZE);
if (read > 0)
@@ -196,7 +202,16 @@
}
else
{
- /* connecion closed */
+ /*
+ * Connecion closed!
+ * We'll hijack this thread and use it to set up our pipe
server again.
+ * This thread will terminate once the connection is set up,
it does not block.
+ */
+ if (ClientDisconnectedEvent != null)
+ {
+ ClientDisconnectedEvent(this, EventArgs.Empty);
+ }
+
break;
}
}
Modified: trunk/tools/reactosdbg/Pipe/pipe.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/pipe.cs?rev=…
==============================================================================
--- trunk/tools/reactosdbg/Pipe/pipe.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/Pipe/pipe.cs [iso-8859-1] Wed Jun 3 13:41:47 2009
@@ -35,5 +35,6 @@
public interface NPipe
{
event EventHandler ClientConnectedEvent;
+ event EventHandler ClientDisconnectedEvent;
}
}
Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] Wed Jun 3 13:41:47 2009
@@ -408,14 +408,17 @@
if (i >= toolsMenu.DropDownItems.Count - 1)
break;
}
- foreach (object o in Settings.ExternalTools)
- {
- ToolStripMenuItem item = new ToolStripMenuItem(o.ToString(), null,
- new
System.EventHandler(this.LaunchExternalToolToolStripMenuItem_Click),
- ((ExternalTool)o).Path);
- item.Tag = "tool";
- toolsMenu.DropDownItems.Insert(bFirst ? 0 : 1, item);
- bFirst = false;
+ if (Settings.ExternalTools != null)
+ {
+ foreach (object o in Settings.ExternalTools)
+ {
+ ToolStripMenuItem item = new ToolStripMenuItem(o.ToString(), null,
+ new
System.EventHandler(this.LaunchExternalToolToolStripMenuItem_Click),
+ ((ExternalTool)o).Path);
+ item.Tag = "tool";
+ toolsMenu.DropDownItems.Insert(bFirst ? 0 : 1, item);
+ bFirst = false;
+ }
}
}
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] Wed Jun 3
13:41:47 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.53")]
-[assembly: AssemblyFileVersion("1.0.2.53")]
+[assembly: AssemblyVersion("1.0.2.54")]
+[assembly: AssemblyFileVersion("1.0.2.54")]