Permalink
Browse files

Update #283 - Fixed issue where connection could be opened/closed mul…

…tiple times
  • Loading branch information...
1 parent 1dc893d commit fa75c96e5656b6b1772e9235b47e536d17ba108f @avanderhoorn avanderhoorn committed Mar 27, 2013
Showing with 8 additions and 0 deletions.
  1. +8 −0 source/Glimpse.Ado/AlternateType/GlimpseDbConnection.cs
@@ -15,6 +15,7 @@ public class GlimpseDbConnection : DbConnection
private IMessageBroker messageBroker;
private IExecutionTimer timerStrategy;
private TimeSpan timerTimeSpan;
+ private bool wasPreviouslyUsed;
public GlimpseDbConnection(DbConnection connection)
: this(connection, connection.TryGetProfiledProviderFactory())
@@ -218,6 +219,11 @@ private void StateChangeHaneler(object sender, StateChangeEventArgs args)
private void OpenConnection()
{
+ if (wasPreviouslyUsed)
+ {
+ ConnectionId = Guid.NewGuid();
+ }
+
timerTimeSpan = TimerTrigger();
MessageBroker.Publish(
@@ -227,6 +233,8 @@ private void OpenConnection()
private void ClosedConnection()
{
+ wasPreviouslyUsed = true;
+
MessageBroker.Publish(
new ConnectionClosedMessage(ConnectionId)
.AsTimedMessage(TimerStop(timerTimeSpan))

0 comments on commit fa75c96

Please sign in to comment.