summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-11-05 15:33:01 +0100
committerBenoit Foucher <benoit@zeroc.com>2014-11-05 15:33:01 +0100
commitcb4d5772e9a7a9228577df83027e45ec7de022ea (patch)
treebd6489fe77ed5fba43adff613293d580fda8e0f3 /js
parentFixed src tree build of IceJS (diff)
downloadice-cb4d5772e9a7a9228577df83027e45ec7de022ea.tar.bz2
ice-cb4d5772e9a7a9228577df83027e45ec7de022ea.tar.xz
ice-cb4d5772e9a7a9228577df83027e45ec7de022ea.zip
Fixed ICE-5607: relaxed Ice.MessageSizeMax
Diffstat (limited to 'js')
-rw-r--r--js/src/Ice/AsyncResult.js2
-rw-r--r--js/src/Ice/BasicStream.js23
-rw-r--r--js/src/Ice/ConnectRequestHandler.js17
-rw-r--r--js/src/Ice/ConnectionI.js39
-rw-r--r--js/src/Ice/EndpointFactoryManager.js2
-rw-r--r--js/src/Ice/Instance.js38
-rw-r--r--js/src/Ice/OutgoingAsync.js4
-rw-r--r--js/src/Ice/PropertyNames.js5
-rw-r--r--js/src/Ice/TcpTransceiver.js6
-rw-r--r--js/src/Ice/browser/WSTransceiver.js6
-rw-r--r--js/test/Ice/exceptions/Client.js36
-rw-r--r--js/test/Ice/exceptionsBidir/Client.js3
-rwxr-xr-xjs/test/Ice/exceptionsBidir/run.py8
-rw-r--r--js/test/Ice/operations/BatchOneways.js39
-rw-r--r--js/test/Ice/operations/Client.js8
-rw-r--r--js/test/Ice/operations/Makefile1
-rw-r--r--js/test/Ice/operations/Test.ice1
-rw-r--r--js/test/Ice/operationsBidir/AMDMyDerivedClassI.js12
-rw-r--r--js/test/Ice/operationsBidir/Client.js7
-rw-r--r--js/test/Ice/operationsBidir/MyDerivedClassI.js12
-rw-r--r--js/test/Ice/operationsBidir/Test.ice1
-rw-r--r--js/test/Ice/operationsBidir/TestAMD.ice1
22 files changed, 147 insertions, 124 deletions
diff --git a/js/src/Ice/AsyncResult.js b/js/src/Ice/AsyncResult.js
index 082b73b689a..dc87e74f18e 100644
--- a/js/src/Ice/AsyncResult.js
+++ b/js/src/Ice/AsyncResult.js
@@ -41,7 +41,7 @@ var AsyncResult = Ice.Class(AsyncResultBase, {
this._completed = completedFn;
this._is = null;
- this._os = com !== null ? new BasicStream(this._instance, Protocol.currentProtocolEncoding, false) : null;
+ this._os = com !== null ? new BasicStream(this._instance, Protocol.currentProtocolEncoding) : null;
this._state = 0;
this._exception = null;
this._sentSynchronously = false;
diff --git a/js/src/Ice/BasicStream.js b/js/src/Ice/BasicStream.js
index 1fd7eae3567..3328cc3a727 100644
--- a/js/src/Ice/BasicStream.js
+++ b/js/src/Ice/BasicStream.js
@@ -1626,7 +1626,7 @@ var WriteEncaps = Class({
});
var BasicStream = Class({
- __init__: function(instance, encoding, unlimited, data)
+ __init__: function(instance, encoding, data)
{
this._instance = instance;
this._closure = null;
@@ -1639,9 +1639,6 @@ var BasicStream = Class({
this._sliceObjects = true;
- this._messageSizeMax = this._instance.messageSizeMax(); // Cached for efficiency.
- this._unlimited = unlimited !== undefined ? unlimited : false;
-
this._startSeq = -1;
this._sizePos = -1;
@@ -1689,7 +1686,7 @@ var BasicStream = Class({
{
Debug.assert(this._instance === other._instance);
- var tmpBuf, tmpClosure, tmpUnlimited, tmpStartSeq, tmpMinSeqSize, tmpSizePos;
+ var tmpBuf, tmpClosure, tmpStartSeq, tmpMinSeqSize, tmpSizePos;
tmpBuf = other._buf;
other._buf = this._buf;
@@ -1707,10 +1704,6 @@ var BasicStream = Class({
this.resetEncaps();
other.resetEncaps();
- tmpUnlimited = other._unlimited;
- other._unlimited = this._unlimited;
- this._unlimited = tmpUnlimited;
-
tmpStartSeq = other._startSeq;
other._startSeq = this._startSeq;
this._startSeq = tmpStartSeq;
@@ -1730,14 +1723,6 @@ var BasicStream = Class({
},
resize: function(sz)
{
- //
- // Check memory limit if stream is not unlimited.
- //
- if(!this._unlimited && sz > this._messageSizeMax)
- {
- ExUtil.throwMemoryLimitException(sz, this._messageSizeMax);
- }
-
this._buf.resize(sz);
this._buf.position = sz;
},
@@ -2758,10 +2743,6 @@ var BasicStream = Class({
},
expand: function(n)
{
- if(!this._unlimited && this._buf && this._buf.position + n > this._messageSizeMax)
- {
- ExUtil.throwMemoryLimitException(this._buf.position + n, this._messageSizeMax);
- }
this._buf.expand(n);
},
createObject: function(id)
diff --git a/js/src/Ice/ConnectRequestHandler.js b/js/src/Ice/ConnectRequestHandler.js
index 62d7210d8cf..9bbd94e9610 100644
--- a/js/src/Ice/ConnectRequestHandler.js
+++ b/js/src/Ice/ConnectRequestHandler.js
@@ -46,13 +46,9 @@ var ConnectRequestHandler = Ice.Class({
this._response = ref.getMode() === ReferenceMode.ModeTwoway;
this._proxy = proxy;
this._proxies = [];
- this._batchAutoFlush = ref.getInstance().initializationData().properties.getPropertyAsIntWithDefault(
- "Ice.BatchAutoFlush", 1) > 0 ? true : false;
this._initialized = false;
this._batchRequestInProgress = false;
- this._batchRequestsSize = Protocol.requestBatchHdr.length;
- this._batchStream =
- new BasicStream(ref.getInstance(), Protocol.currentProtocolEncoding, this._batchAutoFlush);
+ this._batchStream = new BasicStream(ref.getInstance(), Protocol.currentProtocolEncoding);
this._connection = null;
this._compress = false;
@@ -128,13 +124,6 @@ var ConnectRequestHandler = Ice.Class({
this._batchStream.swap(os);
- if(!this._batchAutoFlush &&
- this._batchStream.size + this._batchRequestsSize > this._reference.getInstance().messageSizeMax())
- {
- ExUtil.throwMemoryLimitException(this._batchStream.size + this._batchRequestsSize,
- this._reference.getInstance().messageSizeMax());
- }
-
this._requests.push(new Request(this._batchStream));
return;
}
@@ -147,10 +136,8 @@ var ConnectRequestHandler = Ice.Class({
Debug.assert(this._batchRequestInProgress);
this._batchRequestInProgress = false;
- var dummy = new BasicStream(this._reference.getInstance(), Protocol.currentProtocolEncoding,
- this._batchAutoFlush);
+ var dummy = new BasicStream(this._reference.getInstance(), Protocol.currentProtocolEncoding);
this._batchStream.swap(dummy);
- this._batchRequestsSize = Protocol.requestBatchHdr.length;
return;
}
this._connection.abortBatchRequest();
diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js
index 5b3d1697cdc..0a44caa195a 100644
--- a/js/src/Ice/ConnectionI.js
+++ b/js/src/Ice/ConnectionI.js
@@ -59,7 +59,7 @@ var StateFinished = 6;
var MessageInfo = function(instance)
{
- this.stream = new BasicStream(instance, Protocol.currentProtocolEncoding, false);
+ this.stream = new BasicStream(instance, Protocol.currentProtocolEncoding);
this.invokeNum = 0;
this.requestId = 0;
@@ -99,9 +99,8 @@ var ConnectionI = Class({
this._warnUdp = instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
this._acmLastActivity = this._monitor !== null && this._monitor.getACM().timeout > 0 ? Date.now() : -1;
this._nextRequestId = 1;
- this._batchAutoFlush =
- initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0 ? true : false;
- this._batchStream = new BasicStream(instance, Protocol.currentProtocolEncoding, this._batchAutoFlush);
+ this._batchAutoFlushSize = instance.batchAutoFlushSize();
+ this._batchStream = new BasicStream(instance, Protocol.currentProtocolEncoding);
this._batchStreamInUse = false;
this._batchRequestNum = 0;
this._batchRequestCompress = false;
@@ -397,7 +396,7 @@ var ConnectionI = Class({
// Ensure the message isn't bigger than what we can send with the
// transport.
//
- this._transceiver.checkSendSize(os, this._instance.messageSizeMax());
+ this._transceiver.checkSendSize(os);
//
// Notify the request that it's cancelable with this connection.
@@ -515,15 +514,20 @@ var ConnectionI = Class({
}
var flush = false;
- if(this._batchAutoFlush)
+ if(this._batchAutoFlushSize > 0)
{
+ if(this._batchStream.size > this._batchAutoFlushSize)
+ {
+ flush = true;
+ }
+
//
// Throw memory limit exception if the first message added causes us to go over
// limit. Otherwise put aside the marshalled message that caused limit to be
// exceeded and rollback stream to the marker.
try
{
- this._transceiver.checkSendSize(this._batchStream.buffer, this._instance.messageSizeMax());
+ this._transceiver.checkSendSize(this._batchStream.buffer);
}
catch(ex)
{
@@ -564,7 +568,7 @@ var ConnectionI = Class({
this._batchStream.writeInt(this._batchRequestNum);
this.sendMessage(OutgoingMessage.createForStream(this._batchStream, this._batchRequestCompress,
- true));
+ true));
}
catch(ex)
{
@@ -583,23 +587,12 @@ var ConnectionI = Class({
//
// Reset the batch stream.
//
- this._batchStream =
- new BasicStream(this._instance, Protocol.currentProtocolEncoding, this._batchAutoFlush);
+ this._batchStream = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
this._batchRequestNum = 0;
this._batchRequestCompress = false;
this._batchMarker = 0;
//
- // Check again if the last request doesn't exceed the maximum message size.
- //
- if(Protocol.requestBatchHdr.length + lastRequest.length > this._instance.messageSizeMax())
- {
- ExUtil.throwMemoryLimitException(
- Protocol.requestBatchHdr.length + lastRequest.length,
- this._instance.messageSizeMax());
- }
-
- //
// Start a new batch with the last message that caused us to go over the limit.
//
this._batchStream.writeBlob(Protocol.requestBatchHdr);
@@ -637,7 +630,7 @@ var ConnectionI = Class({
},
abortBatchRequest: function()
{
- this._batchStream = new BasicStream(this._instance, Protocol.currentProtocolEncoding, this._batchAutoFlush);
+ this._batchStream = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
this._batchRequestNum = 0;
this._batchRequestCompress = false;
this._batchMarker = 0;
@@ -700,7 +693,7 @@ var ConnectionI = Class({
//
// Reset the batch stream.
//
- this._batchStream = new BasicStream(this._instance, Protocol.currentProtocolEncoding, this._batchAutoFlush);
+ this._batchStream = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
this._batchRequestNum = 0;
this._batchRequestCompress = false;
this._batchMarker = 0;
@@ -1614,7 +1607,7 @@ var ConnectionI = Class({
// Before we shut down, we send a close connection
// message.
//
- var os = new BasicStream(this._instance, Protocol.currentProtocolEncoding, false);
+ var os = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
os.writeBlob(Protocol.magic);
Protocol.currentProtocol.__write(os);
Protocol.currentProtocolEncoding.__write(os);
diff --git a/js/src/Ice/EndpointFactoryManager.js b/js/src/Ice/EndpointFactoryManager.js
index 288a4d886a3..9b94b033794 100644
--- a/js/src/Ice/EndpointFactoryManager.js
+++ b/js/src/Ice/EndpointFactoryManager.js
@@ -113,7 +113,7 @@ var EndpointFactoryManager = Ice.Class({
// and ask the factory to read the endpoint data from that stream to create
// the actual endpoint.
//
- var bs = new BasicStream(this._instance, Protocol.currentProtocolEncoding, true);
+ var bs = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
bs.writeShort(ue.type());
ue.streamWrite(bs);
bs.pos = 0;
diff --git a/js/src/Ice/Instance.js b/js/src/Ice/Instance.js
index 78c148e2729..38587bb2b2d 100644
--- a/js/src/Ice/Instance.js
+++ b/js/src/Ice/Instance.js
@@ -80,7 +80,8 @@ var Instance = Ice.Class({
this._traceLevels = null;
this._defaultsAndOverrides = null;
- this._messageSizeMax = null;
+ this._messageSizeMax = 0;
+ this._batchAutoFlushSize = 0;
this._clientACM = null;
this._implicitContext = null;
this._routerManager = null;
@@ -246,6 +247,11 @@ var Instance = Ice.Class({
// This value is immutable.
return this._messageSizeMax;
},
+ batchAutoFlushSize: function()
+ {
+ // This value is immutable.
+ return this._batchAutoFlushSize;
+ },
clientACM: function()
{
// This value is immutable.
@@ -332,6 +338,31 @@ var Instance = Ice.Class({
this._messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
}
+ if(this._initData.properties.getProperty("Ice.BatchAutoFlushSize").length === 0 &&
+ this._initData.properties.getProperty("Ice.BatchAutoFlush").length > 0)
+ {
+ if(this._initData.properties.getPropertyAsInt("Ice.BatchAutoFlush") > 0)
+ {
+ this._batchAutoFlushSize = this._messageSizeMax;
+ }
+ }
+ else
+ {
+ var num = this._initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlushSize", 1024); // 1MB
+ if(num < 1)
+ {
+ this._batchAutoFlushSize = num;
+ }
+ else if(num > 0x7fffffff / 1024)
+ {
+ this._batchAutoFlushSize = 0x7fffffff;
+ }
+ else
+ {
+ this._batchAutoFlushSize = num * 1024; // Property is in kilobytes, _batchAutoFlushSize in bytes
+ }
+ }
+
this._clientACM = new ACMConfig(this._initData.properties, this._initData.logger, "Ice.ACM.Client",
new ACMConfig(this._initData.properties, this._initData.logger,
"Ice.ACM", new ACMConfig()));
@@ -504,6 +535,7 @@ var Instance = Ice.Class({
self._endpointFactoryManager.destroy();
}
+ var i;
if(self._initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0)
{
var unusedProperties = self._initData.properties.getUnusedProperties();
@@ -511,7 +543,7 @@ var Instance = Ice.Class({
{
var message = [];
message.push("The following properties were set but never read:");
- for(var i = 0; i < unusedProperties.length; ++i)
+ for(i = 0; i < unusedProperties.length; ++i)
{
message.push("\n ");
message.push(unusedProperties[i]);
@@ -537,7 +569,7 @@ var Instance = Ice.Class({
if(this._destroyPromises)
{
- for(var i = 0; i < this._destroyPromises.length; ++i)
+ for(i = 0; i < this._destroyPromises.length; ++i)
{
this._destroyPromises[i].succeed(this._destroyPromises[i]);
}
diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js
index cb83b4578d7..b2ec025175a 100644
--- a/js/src/Ice/OutgoingAsync.js
+++ b/js/src/Ice/OutgoingAsync.js
@@ -41,7 +41,7 @@ var OutgoingAsyncBase = Ice.Class(AsyncResult, {
if(communicator !== undefined)
{
AsyncResult.call(this, communicator, operation, connection, proxy, adapter);
- this._os = new BasicStream(this._instance, Protocol.currentProtocolEncoding, false);
+ this._os = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
}
else
{
@@ -345,7 +345,7 @@ var OutgoingAsync = Ice.Class(ProxyOutgoingAsyncBase, {
{
if(this._is === null) // _is can already be initialized if the invocation is retried
{
- this._is = new BasicStream(this._instance, Protocol.currentProtocolEncoding, false);
+ this._is = new BasicStream(this._instance, Protocol.currentProtocolEncoding);
}
this._is.swap(istr);
replyStatus = this._is.readByte();
diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js
index 89758e4ce5a..7bcaf0fd3bb 100644
--- a/js/src/Ice/PropertyNames.js
+++ b/js/src/Ice/PropertyNames.js
@@ -6,7 +6,7 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Tue Oct 28 14:34:04 2014
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Wed Nov 5 13:47:49 2014
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -76,7 +76,8 @@ PropertyNames.IceProps =
new Property("/^Ice\.Admin\.Logger\.Properties/", false, null),
new Property("/^Ice\.Admin\.ServerId/", false, null),
new Property("/^Ice\.BackgroundLocatorCacheUpdates/", false, null),
- new Property("/^Ice\.BatchAutoFlush/", false, null),
+ new Property("/^Ice\.BatchAutoFlush/", true, null),
+ new Property("/^Ice\.BatchAutoFlushSize/", false, null),
new Property("/^Ice\.ChangeUser/", false, null),
new Property("/^Ice\.ClientAccessPolicyProtocol/", false, null),
new Property("/^Ice\.Compression\.Level/", false, null),
diff --git a/js/src/Ice/TcpTransceiver.js b/js/src/Ice/TcpTransceiver.js
index 2e79719c8b2..52c9a313ce5 100644
--- a/js/src/Ice/TcpTransceiver.js
+++ b/js/src/Ice/TcpTransceiver.js
@@ -279,12 +279,8 @@ var TcpTransceiver = Ice.Class({
{
return new Ice.TCPConnectionInfo();
},
- checkSendSize: function(stream, messageSizeMax)
+ checkSendSize: function(stream)
{
- if(stream.size > messageSizeMax)
- {
- ExUtil.throwMemoryLimitException(stream.size, messageSizeMax);
- }
},
toString: function()
{
diff --git a/js/src/Ice/browser/WSTransceiver.js b/js/src/Ice/browser/WSTransceiver.js
index dc07ff6f323..a12516d30f3 100644
--- a/js/src/Ice/browser/WSTransceiver.js
+++ b/js/src/Ice/browser/WSTransceiver.js
@@ -297,12 +297,8 @@ var WSTransceiver = Ice.Class({
{
return new Ice.WSConnectionInfo();
},
- checkSendSize: function(stream, messageSizeMax)
+ checkSendSize: function(stream)
{
- if(stream.size > messageSizeMax)
- {
- ExUtil.throwMemoryLimitException(stream.size, messageSizeMax);
- }
},
toString: function()
{
diff --git a/js/test/Ice/exceptions/Client.js b/js/test/Ice/exceptions/Client.js
index ecb23e4d560..ebfd35e6549 100644
--- a/js/test/Ice/exceptions/Client.js
+++ b/js/test/Ice/exceptions/Client.js
@@ -14,7 +14,7 @@
var Promise = Ice.Promise;
- var allTests = function(out, communicator, Test)
+ var allTests = function(out, communicator, Test, bidir)
{
var EmptyI = function()
{
@@ -369,22 +369,29 @@
).then(
function()
{
- out.write("testing memory limit marshal exception...");
- return thrower.throwMemoryLimitException(null);
- }
- ).then(
- failCB,
- function(ex)
- {
- test(ex instanceof Ice.UnknownLocalException);
- return thrower.throwMemoryLimitException(new Array(20 * 1024));
+ if(!bidir)
+ {
+ out.write("testing memory limit marshal exception...");
+ return thrower.throwMemoryLimitException(null).then(
+ failCB,
+ function(ex)
+ {
+ test(ex instanceof Ice.MemoryLimitException);
+ return thrower.throwMemoryLimitException(Ice.Buffer.createNative(20 * 1024));
+ }
+ ).then(
+ failCB,
+ function(ex)
+ {
+ test(ex instanceof Ice.ConnectionLostException);
+ out.writeLine("ok");
+ }
+ );
+ }
}
).then(
- failCB,
- function(ex)
+ function()
{
- test(ex instanceof Ice.MemoryLimitException);
- out.writeLine("ok");
out.write("catching object not exist exception... ");
var id = communicator.stringToIdentity("does not exist");
var thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id));
@@ -477,6 +484,7 @@
var run = function(out, id)
{
id.properties.setProperty("Ice.MessageSizeMax", "10");
+ id.properties.setProperty("Ice.Warn.Connections", "0");
var c = Ice.initialize(id);
return Promise.try(
function()
diff --git a/js/test/Ice/exceptionsBidir/Client.js b/js/test/Ice/exceptionsBidir/Client.js
index 0c73f3928fc..2cda879f0c0 100644
--- a/js/test/Ice/exceptionsBidir/Client.js
+++ b/js/test/Ice/exceptionsBidir/Client.js
@@ -41,7 +41,7 @@
function(conn)
{
conn.setAdapter(adapter);
- return Client.__clientAllTests__(out, communicator, amd ? TestAMD : Test);
+ return Client.__clientAllTests__(out, communicator, amd ? TestAMD : Test, true);
});
});
});
@@ -51,6 +51,7 @@
{
id.properties.setProperty("Ice.MessageSizeMax", "10");
id.properties.setProperty("Ice.Warn.Dispatch", "0");
+ id.properties.setProperty("Ice.Warn.Connections", "0");
var communicator = Ice.initialize(id);
return Promise.try(
function()
diff --git a/js/test/Ice/exceptionsBidir/run.py b/js/test/Ice/exceptionsBidir/run.py
index d40340f6d10..9d71627b8b4 100755
--- a/js/test/Ice/exceptionsBidir/run.py
+++ b/js/test/Ice/exceptionsBidir/run.py
@@ -21,12 +21,14 @@ sys.path.append(os.path.join(path[0], "scripts"))
import TestUtil
print("Running test with compact (default) format.")
-TestUtil.clientEchoTest(additionalServerOptions="--Ice.Warn.Dispatch=0")
+TestUtil.clientEchoTest(additionalServerOptions="--Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0")
print("Running test with sliced format.")
TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat --Ice.Warn.Dispatch=0")
+ additionalServerOptions="--Ice.Default.SlicedFormat" +
+ " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0")
print("Running test with 1.0 encoding.")
TestUtil.clientEchoTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0 --Ice.Warn.Dispatch=0")
+ additionalServerOptions="--Ice.Default.EncodingVersion=1.0" +
+ " --Ice.Warn.Dispatch=0 --Ice.Warn.Connections=0")
diff --git a/js/test/Ice/operations/BatchOneways.js b/js/test/Ice/operations/BatchOneways.js
index 7711fe49ef2..2e2bb748c5d 100644
--- a/js/test/Ice/operations/BatchOneways.js
+++ b/js/test/Ice/operations/BatchOneways.js
@@ -15,7 +15,7 @@
var run = function(communicator, prx, Test, bidir)
{
var Promise = Ice.Promise;
- var bs1, bs2, bs3, batch, batch2, batch3;
+ var bs1, bs2, batch, batch2, batch3;
var p = new Promise();
var test = function(b)
{
@@ -47,11 +47,6 @@
{
bs2[i] = 0;
}
- bs3 = Ice.Buffer.createNative(new Array(100 * 1024));
- for(i = 0; i < bs3.length; ++i)
- {
- bs3[i] = 0;
- }
return prx.opByteSOneway(bs1);
}
@@ -63,17 +58,11 @@
).then(
function()
{
- return prx.opByteSOneway(bs3);
+ return prx.opByteSOnewayCallCount();
}
).then(
- function()
- {
- test(false);
- },
- function(ex)
+ function(count)
{
- test(ex instanceof Ice.MemoryLimitException);
-
batch = prx.ice_batchOneway();
var all = [];
@@ -85,6 +74,28 @@
return Promise.all(all).then(
function()
{
+ var wait = function(count)
+ {
+ if(count != 27) // 3 * 9 requests auto-flushed.
+ {
+ return Promise.delay(10).then(
+ function()
+ {
+ return prx.opByteSOnewayCallCount();
+ }
+ ).then(
+ function(count)
+ {
+ return wait(count);
+ }
+ );
+ }
+ }
+ return wait(0);
+ }
+ ).then(
+ function()
+ {
return batch.ice_getConnection();
}
).then(
diff --git a/js/test/Ice/operations/Client.js b/js/test/Ice/operations/Client.js
index 66a8d8b5273..12fbbadb04a 100644
--- a/js/test/Ice/operations/Client.js
+++ b/js/test/Ice/operations/Client.js
@@ -71,12 +71,7 @@
var run = function(out, id)
{
- //
- // We must set MessageSizeMax to an explicit value,
- // because we run tests to check whether
- // Ice.MemoryLimitException is raised as expected.
- //
- id.properties.setProperty("Ice.MessageSizeMax", "100");
+ id.properties.setProperty("Ice.BatchAutoFlushSize", "100");
var c = Ice.initialize(id);
return Promise.try(
function()
@@ -91,7 +86,6 @@
).finally(
function()
{
- c.destroy(); // Test concurrent destroy() calls
return c.destroy();
}
);
diff --git a/js/test/Ice/operations/Makefile b/js/test/Ice/operations/Makefile
index 8f81ea44140..bfddcfe50ed 100644
--- a/js/test/Ice/operations/Makefile
+++ b/js/test/Ice/operations/Makefile
@@ -20,4 +20,3 @@ SRCS = Client.js
include $(top_srcdir)/config/Make.rules.js
SLICE2JSFLAGS := $(SLICE2JSFLAGS) -I$(slicedir)
-
diff --git a/js/test/Ice/operations/Test.ice b/js/test/Ice/operations/Test.ice
index 5027b5de6b6..494cafe69b7 100644
--- a/js/test/Ice/operations/Test.ice
+++ b/js/test/Ice/operations/Test.ice
@@ -161,6 +161,7 @@ class MyClass
IntS opIntS(IntS s);
void opByteSOneway(ByteS s);
+ int opByteSOnewayCallCount();
Ice::Context opContext();
diff --git a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js
index a4a0f5e1c23..521b436bf97 100644
--- a/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js
+++ b/js/test/Ice/operationsBidir/AMDMyDerivedClassI.js
@@ -26,6 +26,10 @@
//
// Override the Object "pseudo" operations to verify the operation mode.
//
+ __init__: function()
+ {
+ this._opByteSOnewayCount = 0;
+ },
ice_isA: function(id, current)
{
@@ -223,9 +227,17 @@
opByteSOneway_async: function(cb, s, current)
{
+ this._opByteSOnewayCount += 1;
cb.ice_response();
},
+ opByteSOnewayCallCount_async: function(cb, current)
+ {
+ var count = this._opByteSOnewayCount;
+ this._opByteSOnewayCount = 0;
+ cb.ice_response(count);
+ },
+
opContext_async: function(cb, current)
{
cb.ice_response(current.ctx);
diff --git a/js/test/Ice/operationsBidir/Client.js b/js/test/Ice/operationsBidir/Client.js
index daeba069c21..76ceabbf769 100644
--- a/js/test/Ice/operationsBidir/Client.js
+++ b/js/test/Ice/operationsBidir/Client.js
@@ -43,12 +43,7 @@
var run = function(out, id)
{
- //
- // We must set MessageSizeMax to an explicit value,
- // because we run tests to check whether
- // Ice.MemoryLimitException is raised as expected.
- //
- id.properties.setProperty("Ice.MessageSizeMax", "100");
+ id.properties.setProperty("Ice.BatchAutoFlushSize", "100");
var communicator = Ice.initialize(id);
return Promise.try(
function()
diff --git a/js/test/Ice/operationsBidir/MyDerivedClassI.js b/js/test/Ice/operationsBidir/MyDerivedClassI.js
index 181adf4279b..0663d292544 100644
--- a/js/test/Ice/operationsBidir/MyDerivedClassI.js
+++ b/js/test/Ice/operationsBidir/MyDerivedClassI.js
@@ -26,6 +26,10 @@
//
// Override the Object "pseudo" operations to verify the operation mode.
//
+ __init__: function()
+ {
+ this._opByteSOnewayCount = 0;
+ },
ice_isA: function(id, current)
{
@@ -221,6 +225,14 @@
opByteSOneway: function(s, current)
{
+ this._opByteSOnewayCount += 1;
+ },
+
+ opByteSOnewayCallCount: function(current)
+ {
+ var count = this._opByteSOnewayCount;
+ this._opByteSOnewayCount = 0;
+ return count;
},
opContext: function(current)
diff --git a/js/test/Ice/operationsBidir/Test.ice b/js/test/Ice/operationsBidir/Test.ice
index 3163de99915..9a699fa94da 100644
--- a/js/test/Ice/operationsBidir/Test.ice
+++ b/js/test/Ice/operationsBidir/Test.ice
@@ -161,6 +161,7 @@ class MyClass
IntS opIntS(IntS s);
void opByteSOneway(ByteS s);
+ int opByteSOnewayCallCount();
Ice::Context opContext();
diff --git a/js/test/Ice/operationsBidir/TestAMD.ice b/js/test/Ice/operationsBidir/TestAMD.ice
index 11719b8c247..4a673f57c12 100644
--- a/js/test/Ice/operationsBidir/TestAMD.ice
+++ b/js/test/Ice/operationsBidir/TestAMD.ice
@@ -161,6 +161,7 @@ dictionary<MyStruct, MyEnum> MyStructMyEnumD;
IntS opIntS(IntS s);
void opByteSOneway(ByteS s);
+ int opByteSOnewayCallCount();
Ice::Context opContext();