/*
* Represents the connection to the debuggee
*/
- public abstract class Connection
+ public abstract class Connection : IDisposable
{
/*
* The protocol and the packet format is based on JDWP, the differences
res.domain_id = r.ReadId ();
return res;
}
-
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ }
+
+ ~Connection ()
+ {
+ Dispose (false);
+ }
}
class TcpConnection : Connection
{
socket.Close ();
}
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing) {
+ //Socket.Dispose is explicit in < .NET 4.0
+ ((IDisposable)socket).Dispose ();
+ }
+ base.Dispose (disposing);
+ }
}
/* This is the interface exposed by the debugger towards the debugger agent */