From dfb91df7615554ba46258c4eb64c1649a567f86c Mon Sep 17 00:00:00 2001 From: rstam Date: Wed, 20 Jul 2011 17:25:01 -0400 Subject: [PATCH] Changed MongoConnection to remember the RequestId of the last message sent on this connection. --- Driver/Internal/MongoConnection.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Driver/Internal/MongoConnection.cs b/Driver/Internal/MongoConnection.cs index 6ed1671e9f..25efb84683 100644 --- a/Driver/Internal/MongoConnection.cs +++ b/Driver/Internal/MongoConnection.cs @@ -61,6 +61,7 @@ namespace MongoDB.Driver.Internal { private DateTime createdAt; private DateTime lastUsedAt; // set every time the connection is Released private int messageCounter; + private int requestId; private Dictionary authentications = new Dictionary(); #endregion @@ -105,6 +106,13 @@ namespace MongoDB.Driver.Internal { get { return messageCounter; } } + /// + /// Gets the RequestId of the last message sent on this connection. + /// + public int RequestId { + get { return requestId; } + } + /// /// Gets the server instance this connection is connected to. /// @@ -378,6 +386,8 @@ namespace MongoDB.Driver.Internal { ) { if (state == MongoConnectionState.Closed) { throw new InvalidOperationException("Connection is closed."); } lock (connectionLock) { + requestId = message.RequestId; + message.WriteToBuffer(); CommandDocument safeModeCommand = null; if (safeMode.Enabled) {