summaryrefslogtreecommitdiff
path: root/cs
diff options
context:
space:
mode:
Diffstat (limited to 'cs')
-rw-r--r--cs/src/Ice/Instance.cs60
-rw-r--r--cs/src/Ice/Network.cs29
-rw-r--r--cs/src/Ice/ProtocolInstance.cs15
-rw-r--r--cs/src/Ice/StreamSocket.cs2
-rw-r--r--cs/src/Ice/TcpAcceptor.cs2
-rw-r--r--cs/src/Ice/UdpTransceiver.cs32
-rw-r--r--cs/src/IceSSL/AcceptorI.cs2
7 files changed, 125 insertions, 17 deletions
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs
index 882a0dcdabc..8dd99f3860f 100644
--- a/cs/src/Ice/Instance.cs
+++ b/cs/src/Ice/Instance.cs
@@ -16,6 +16,21 @@ namespace IceInternal
using System.Threading;
using System;
+ public sealed class BufSizeWarnInfo
+ {
+ // Whether send size warning has been emitted
+ public bool sndWarn;
+
+ // The send size for which the warning wwas emitted
+ public int sndSize;
+
+ // Whether receive size warning has been emitted
+ public bool rcvWarn;
+
+ // The receive size for which the warning wwas emitted
+ public int rcvSize;
+ }
+
public sealed class Instance
{
private class ObserverUpdaterI : Ice.Instrumentation.ObserverUpdater
@@ -1323,6 +1338,50 @@ namespace IceInternal
}
}
+ public BufSizeWarnInfo getBufSizeWarn(short type)
+ {
+ lock(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info;
+ if(!_setBufSizeWarn.ContainsKey(type))
+ {
+ info = new BufSizeWarnInfo();
+ info.sndWarn = false;
+ info.sndSize = -1;
+ info.rcvWarn = false;
+ info.rcvSize = -1;
+ _setBufSizeWarn.Add(type, info);
+ }
+ else
+ {
+ info = _setBufSizeWarn[type];
+ }
+ return info;
+ }
+ }
+
+ public void setSndBufSizeWarn(short type, int size)
+ {
+ lock(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info = getBufSizeWarn(type);
+ info.sndWarn = true;
+ info.sndSize = size;
+ _setBufSizeWarn[type] = info;
+ }
+ }
+
+ public void setRcvBufSizeWarn(short type, int size)
+ {
+ lock(_setBufSizeWarn)
+ {
+ BufSizeWarnInfo info = getBufSizeWarn(type);
+ info.rcvWarn = true;
+ info.rcvSize = size;
+ _setBufSizeWarn[type] = info;
+ }
+ }
+
internal void updateConnectionObservers()
{
try
@@ -1507,6 +1566,7 @@ namespace IceInternal
private Dictionary<string, Ice.Object> _adminFacets = new Dictionary<string, Ice.Object>();
private HashSet<string> _adminFacetFilter = new HashSet<string>();
private Ice.Identity _adminIdentity;
+ private Dictionary<short, BufSizeWarnInfo> _setBufSizeWarn = new Dictionary<short, BufSizeWarnInfo>();
#if !SILVERLIGHT
private static bool _printProcessIdDone = false;
diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs
index 55f5c8131c5..f1e1580d7bb 100644
--- a/cs/src/Ice/Network.cs
+++ b/cs/src/Ice/Network.cs
@@ -1024,7 +1024,7 @@ namespace IceInternal
}
public static void
- setTcpBufSize(Socket socket, Ice.Properties properties, Ice.Logger logger)
+ setTcpBufSize(Socket socket, ProtocolInstance instance)
{
//
// By default, on Windows we use a 128KB buffer size. On Unix
@@ -1036,7 +1036,7 @@ namespace IceInternal
dfltBufSize = 128 * 1024;
}
- int sizeRequested = properties.getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
+ int sizeRequested = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
if(sizeRequested > 0)
{
//
@@ -1046,14 +1046,21 @@ namespace IceInternal
//
setRecvBufferSize(socket, sizeRequested);
int size = getRecvBufferSize(socket);
- if(size < sizeRequested) // Warn if the size that was set is less than the requested size.
+ if(size < sizeRequested)
{
- logger.warning("TCP receive buffer size: requested size of " + sizeRequested + " adjusted to " +
- size);
+ // Warn if the size that was set is less than the requested size and
+ // we have not already warned.
+ BufSizeWarnInfo winfo = instance.getBufSizeWarn(Ice.TCPEndpointType.value);
+ if(!winfo.rcvWarn || sizeRequested != winfo.rcvSize)
+ {
+ instance.logger().warning("TCP receive buffer size: requested size of " + sizeRequested +
+ " adjusted to " + size);
+ instance.setRcvBufSizeWarn(Ice.TCPEndpointType.value, sizeRequested);
+ }
}
}
- sizeRequested = properties.getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
+ sizeRequested = instance.properties().getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
if(sizeRequested > 0)
{
//
@@ -1065,7 +1072,15 @@ namespace IceInternal
int size = getSendBufferSize(socket);
if(size < sizeRequested) // Warn if the size that was set is less than the requested size.
{
- logger.warning("TCP send buffer size: requested size of " + sizeRequested + " adjusted to " + size);
+ // Warn if the size that was set is less than the requested size and
+ // we have not already warned.
+ BufSizeWarnInfo winfo = instance.getBufSizeWarn(Ice.TCPEndpointType.value);
+ if(!winfo.sndWarn || sizeRequested != winfo.sndSize)
+ {
+ instance.logger().warning("TCP send buffer size: requested size of " + sizeRequested +
+ " adjusted to " + size);
+ instance.setSndBufSizeWarn(Ice.TCPEndpointType.value, sizeRequested);
+ }
}
}
}
diff --git a/cs/src/Ice/ProtocolInstance.cs b/cs/src/Ice/ProtocolInstance.cs
index ca7c3b4824a..68c8d33e13f 100644
--- a/cs/src/Ice/ProtocolInstance.cs
+++ b/cs/src/Ice/ProtocolInstance.cs
@@ -121,6 +121,21 @@ namespace IceInternal
}
#endif
+ public BufSizeWarnInfo getBufSizeWarn(short type)
+ {
+ return instance_.getBufSizeWarn(type);
+ }
+
+ public void setSndBufSizeWarn(short type, int size)
+ {
+ instance_.setSndBufSizeWarn(type, size);
+ }
+
+ public void setRcvBufSizeWarn(short type, int size)
+ {
+ instance_.setRcvBufSizeWarn(type, size);
+ }
+
protected Instance instance_;
protected int traceLevel_;
protected string traceCategory_;
diff --git a/cs/src/Ice/StreamSocket.cs b/cs/src/Ice/StreamSocket.cs
index c820f900d38..b6f75545222 100644
--- a/cs/src/Ice/StreamSocket.cs
+++ b/cs/src/Ice/StreamSocket.cs
@@ -558,7 +558,7 @@ namespace IceInternal
#if !SILVERLIGHT
Network.setBlock(_fd, false);
#endif
- Network.setTcpBufSize(_fd, instance.properties(), instance.logger());
+ Network.setTcpBufSize(_fd, instance);
#if ICE_SOCKET_ASYNC_API
_readEventArgs = new SocketAsyncEventArgs();
diff --git a/cs/src/Ice/TcpAcceptor.cs b/cs/src/Ice/TcpAcceptor.cs
index 062f89b21d5..d896d4367df 100644
--- a/cs/src/Ice/TcpAcceptor.cs
+++ b/cs/src/Ice/TcpAcceptor.cs
@@ -137,7 +137,7 @@ namespace IceInternal
_fd = Network.createServerSocket(false, _addr.AddressFamily, protocol);
Network.setBlock(_fd, false);
# if !COMPACT
- Network.setTcpBufSize(_fd, _instance.properties(), _instance.logger());
+ Network.setTcpBufSize(_fd, _instance);
# endif
if(AssemblyUtil.platform_ != AssemblyUtil.Platform.Windows)
{
diff --git a/cs/src/Ice/UdpTransceiver.cs b/cs/src/Ice/UdpTransceiver.cs
index 68ff87944c5..167794ac963 100644
--- a/cs/src/Ice/UdpTransceiver.cs
+++ b/cs/src/Ice/UdpTransceiver.cs
@@ -856,7 +856,7 @@ namespace IceInternal
try
{
_fd = Network.createSocket(true, _addr.AddressFamily);
- setBufSize(instance.properties());
+ setBufSize();
#if !SILVERLIGHT
Network.setBlock(_fd, false);
if(AssemblyUtil.osx_)
@@ -912,7 +912,7 @@ namespace IceInternal
#endif
_fd = Network.createServerSocket(true, _addr.AddressFamily, instance.protocolSupport());
- setBufSize(instance.properties());
+ setBufSize();
#if !SILVERLIGHT
Network.setBlock(_fd, false);
#endif
@@ -934,17 +934,19 @@ namespace IceInternal
}
}
- private void setBufSize(Ice.Properties properties)
+ private void setBufSize()
{
Debug.Assert(_fd != null);
for (int i = 0; i < 2; ++i)
{
+ bool isSnd;
string direction;
string prop;
int dfltSize;
if(i == 0)
{
+ isSnd = false;
direction = "receive";
prop = "Ice.UDP.RcvSize";
dfltSize = Network.getRecvBufferSize(_fd);
@@ -952,6 +954,7 @@ namespace IceInternal
}
else
{
+ isSnd = true;
direction = "send";
prop = "Ice.UDP.SndSize";
dfltSize = Network.getSendBufferSize(_fd);
@@ -961,7 +964,7 @@ namespace IceInternal
//
// Get property for buffer size and check for sanity.
//
- int sizeRequested = properties.getPropertyAsIntWithDefault(prop, dfltSize);
+ int sizeRequested = _instance.properties().getPropertyAsIntWithDefault(prop, dfltSize);
if(sizeRequested < (_udpOverhead + IceInternal.Protocol.headerSize))
{
_instance.logger().warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " +
@@ -991,12 +994,27 @@ namespace IceInternal
}
//
- // Warn if the size that was set is less than the requested size.
+ // Warn if the size that was set is less than the requested size
+ // and we have not already warned
//
if(sizeSet < sizeRequested)
{
- _instance.logger().warning("UDP " + direction + " buffer size: requested size of " +
- sizeRequested + " adjusted to " + sizeSet);
+ BufSizeWarnInfo winfo = _instance.getBufSizeWarn(Ice.UDPEndpointType.value);
+ if((isSnd && (!winfo.sndWarn || winfo.sndSize != sizeRequested)) ||
+ (!isSnd && (!winfo.rcvWarn || winfo.rcvSize != sizeRequested)))
+ {
+ _instance.logger().warning("UDP " + direction + " buffer size: requested size of " +
+ sizeRequested + " adjusted to " + sizeSet);
+
+ if(isSnd)
+ {
+ _instance.setSndBufSizeWarn(Ice.UDPEndpointType.value, sizeRequested);
+ }
+ else
+ {
+ _instance.setRcvBufSizeWarn(Ice.UDPEndpointType.value, sizeRequested);
+ }
+ }
}
}
}
diff --git a/cs/src/IceSSL/AcceptorI.cs b/cs/src/IceSSL/AcceptorI.cs
index 7391bf9f37e..5ddc84ff337 100644
--- a/cs/src/IceSSL/AcceptorI.cs
+++ b/cs/src/IceSSL/AcceptorI.cs
@@ -162,7 +162,7 @@ namespace IceSSL
IPEndPoint;
_fd = IceInternal.Network.createServerSocket(false, _addr.AddressFamily, protocol);
IceInternal.Network.setBlock(_fd, false);
- IceInternal.Network.setTcpBufSize(_fd, _instance.properties(), _instance.logger());
+ IceInternal.Network.setTcpBufSize(_fd, _instance);
if(IceInternal.AssemblyUtil.platform_ != IceInternal.AssemblyUtil.Platform.Windows)
{
//