Skip to content

Commit f5d8b0b

Browse files
committed
CSHARP-915: added MaxWireBatchSize to server info.
1 parent 31c93dd commit f5d8b0b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

MongoDB.Driver/Communication/MongoServerInstance.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,23 @@ public int MaxWireDocumentSize
302302
}
303303
}
304304

305+
/// <summary>
306+
/// Gets the maximum size of the wire batch.
307+
/// </summary>
308+
/// <value>
309+
/// The maximum size of the wire batch.
310+
/// </value>
311+
public int MaxWireBatchSize
312+
{
313+
get
314+
{
315+
lock (_serverInstanceLock)
316+
{
317+
return _serverInfo.MaxWireBatchSize;
318+
}
319+
}
320+
}
321+
305322
/// <summary>
306323
/// Gets the unique sequential Id for this server instance.
307324
/// </summary>
@@ -703,6 +720,7 @@ private void LookupServerInformation(MongoConnection connection)
703720
IsSecondary = false,
704721
MaxDocumentSize = currentServerInfo.MaxDocumentSize,
705722
MaxMessageLength = currentServerInfo.MaxMessageLength,
723+
MaxWireBatchSize = currentServerInfo.MaxWireBatchSize,
706724
ReplicaSetInformation = currentServerInfo.ReplicaSetInformation
707725
};
708726

@@ -860,6 +878,8 @@ private class ServerInformation
860878

861879
public int MaxWireDocumentSize { get { return MaxDocumentSize + 16 * 1024; } }
862880

881+
public int MaxWireBatchSize { get; set; }
882+
863883
public ReplicaSetInformation ReplicaSetInformation { get; set; }
864884

865885
public bool IsDifferentFrom(ServerInformation other)
@@ -904,6 +924,11 @@ public bool IsDifferentFrom(ServerInformation other)
904924
return true;
905925
}
906926

927+
if (MaxWireBatchSize != other.MaxWireBatchSize)
928+
{
929+
return true;
930+
}
931+
907932
if ((ReplicaSetInformation == null && other.ReplicaSetInformation != null) || (ReplicaSetInformation != other.ReplicaSetInformation))
908933
{
909934
return true;

0 commit comments

Comments
 (0)