From 8fb855336e8f2fdf319c56253fb063f57346e8ad Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 2 Oct 2019 19:21:07 +0200 Subject: The Ice connection will now print warnings for first invalid messages received by a client, fixes #565 --- csharp/src/Ice/ConnectionI.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'csharp/src') diff --git a/csharp/src/Ice/ConnectionI.cs b/csharp/src/Ice/ConnectionI.cs index 318fe77c562..81c4b9f6f98 100644 --- a/csharp/src/Ice/ConnectionI.cs +++ b/csharp/src/Ice/ConnectionI.cs @@ -1216,6 +1216,15 @@ namespace Ice _observer.receivedBytes(Protocol.headerSize); } + // + // Connection is validated on first message. This is only used by + // setState() to check wether or not we can print a connection + // warning (a client might close the connection forcefully if the + // connection isn't validated, we don't want to print a warning + // in this case). + // + _validated = true; + int pos = _readStream.pos(); if(pos < Protocol.headerSize) { @@ -1253,6 +1262,7 @@ namespace Ice { throw new IllegalMessageSizeException(); } + if(size > _messageSizeMax) { Ex.throwMemoryLimitException(size, _messageSizeMax); @@ -2256,6 +2266,8 @@ namespace Ice observerFinishRead(_readStream.getBuffer()); } + _validated = true; + Debug.Assert(_readStream.pos() == Protocol.headerSize); _readStream.pos(0); byte[] m = _readStream.readBlob(4); @@ -2287,8 +2299,6 @@ namespace Ice throw new IllegalMessageSizeException(); } TraceUtil.traceRecv(_readStream, _logger, _traceLevels); - - _validated = true; } } @@ -2579,14 +2589,6 @@ namespace Ice Debug.Assert(info.stream.pos() == info.stream.size()); - // - // Connection is validated on first message. This is only used by - // setState() to check wether or not we can print a connection - // warning (a client might close the connection forcefully if the - // connection isn't validated). - // - _validated = true; - try { // -- cgit v1.2.3