diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/src/Ice/ConnectRequestHandler.js | 11 | ||||
-rw-r--r-- | js/src/Ice/ConnectionI.js | 30 | ||||
-rw-r--r-- | js/src/Ice/ConnectionRequestHandler.js | 5 | ||||
-rw-r--r-- | js/src/Ice/DefaultsAndOverrides.js | 7 | ||||
-rw-r--r-- | js/src/Ice/IncomingAsync.js | 19 | ||||
-rw-r--r-- | js/src/Ice/ObjectPrx.js | 19 | ||||
-rw-r--r-- | js/src/Ice/OutgoingAsync.js | 20 | ||||
-rw-r--r-- | js/src/Ice/OutgoingConnectionFactory.js | 36 | ||||
-rw-r--r-- | js/src/Ice/Reference.js | 79 | ||||
-rw-r--r-- | js/src/Ice/RequestHandlerFactory.js | 4 | ||||
-rw-r--r-- | js/test/Ice/proxy/Client.js | 5 |
11 files changed, 70 insertions, 165 deletions
diff --git a/js/src/Ice/ConnectRequestHandler.js b/js/src/Ice/ConnectRequestHandler.js index 6b33f5fb760..6126c277234 100644 --- a/js/src/Ice/ConnectRequestHandler.js +++ b/js/src/Ice/ConnectRequestHandler.js @@ -36,7 +36,6 @@ class ConnectRequestHandler this._initialized = false; this._connection = null; - this._compress = false; this._exception = null; this._requests = []; } @@ -67,7 +66,7 @@ class ConnectRequestHandler this._requests.push(out); return AsyncStatus.Queued; } - return out.invokeRemote(this._connection, this._compress, this._response); + return out.invokeRemote(this._connection, this._response); } asyncRequestCanceled(out, ex) @@ -113,11 +112,11 @@ class ConnectRequestHandler // // Implementation of Reference_GetConnectionCallback // - setConnection(values) + setConnection(connection) { Debug.assert(this._exception === null && this._connection === null); - [this._connection, this._compress] = values; + this._connection = connection; // // If this proxy is for a non-local object, and we are using a router, then @@ -213,7 +212,7 @@ class ConnectRequestHandler { try { - request.invokeRemote(this._connection, this._compress, this._response); + request.invokeRemote(this._connection, this._response); } catch(ex) { @@ -238,7 +237,7 @@ class ConnectRequestHandler if(this._reference.getCacheConnection() && exception === null) { - this._requestHandler = new ConnectionRequestHandler(this._reference, this._connection, this._compress); + this._requestHandler = new ConnectionRequestHandler(this._reference, this._connection); this._proxies.forEach(proxy => proxy._updateRequestHandler(this, this._requestHandler)); } diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js index 4541098ae78..4243b438ad9 100644 --- a/js/src/Ice/ConnectionI.js +++ b/js/src/Ice/ConnectionI.js @@ -67,7 +67,6 @@ class MessageInfo this.stream = new InputStream(instance, Protocol.currentProtocolEncoding); this.invokeNum = 0; this.requestId = 0; - this.compress = false; this.servantManager = null; this.adapter = null; this.outAsync = null; @@ -367,7 +366,7 @@ class ConnectionI } } - sendAsyncRequest(out, compress, response, batchRequestNum) + sendAsyncRequest(out, response, batchRequestNum) { let requestId = 0; const ostr = out.getOs(); @@ -424,7 +423,7 @@ class ConnectionI let status; try { - status = this.sendMessage(OutgoingMessage.create(out, out.getOs(), compress, requestId)); + status = this.sendMessage(OutgoingMessage.create(out, out.getOs(), requestId)); } catch(ex) { @@ -572,7 +571,7 @@ class ConnectionI } } - sendResponse(os, compressFlag) + sendResponse(os) { Debug.assert(this._state > StateNotValidated); @@ -593,7 +592,7 @@ class ConnectionI throw this._exception; } - this.sendMessage(OutgoingMessage.createForStream(os, compressFlag !== 0, true)); + this.sendMessage(OutgoingMessage.createForStream(os, true)); if(this._state === StateClosing && this._dispatchCount === 0) { @@ -927,8 +926,7 @@ class ConnectionI if(info.invokeNum > 0) { - this.invokeAll(info.stream, info.invokeNum, info.requestId, info.compress, info.servantManager, - info.adapter); + this.invokeAll(info.stream, info.invokeNum, info.requestId, info.servantManager, info.adapter); // // Don't increase count, the dispatch count is @@ -1444,7 +1442,7 @@ class ConnectionI os.writeByte(0); // compression status: always report 0 for CloseConnection. os.writeInt(Protocol.headerSize); // Message size. - if((this.sendMessage(OutgoingMessage.createForStream(os, false, false)) & AsyncStatus.Sent) > 0) + if((this.sendMessage(OutgoingMessage.createForStream(os, false)) & AsyncStatus.Sent) > 0) { // // Schedule the close timeout to wait for the peer to close the connection. @@ -1479,7 +1477,7 @@ class ConnectionI os.writeInt(Protocol.headerSize); // Message size. try { - this.sendMessage(OutgoingMessage.createForStream(os, false, false)); + this.sendMessage(OutgoingMessage.createForStream(os, false)); } catch(ex) { @@ -1769,8 +1767,8 @@ class ConnectionI // info.stream.pos = 8; const messageType = info.stream.readByte(); - info.compress = info.stream.readByte(); - if(info.compress === 2) + const compress = info.stream.readByte(); + if(compress === 2) { throw new Ice.FeatureNotSupportedException("Cannot uncompress compressed message"); } @@ -1902,7 +1900,7 @@ class ConnectionI return info; } - invokeAll(stream, invokeNum, requestId, compress, servantManager, adapter) + invokeAll(stream, invokeNum, requestId, servantManager, adapter) { try { @@ -1914,7 +1912,6 @@ class ConnectionI let inc = new IncomingAsync(this._instance, this, adapter, !this._endpoint.datagram() && requestId !== 0, // response - compress, requestId); // @@ -2102,7 +2099,6 @@ class OutgoingMessage { this.stream = null; this.outAsync = null; - this.compress = false; this.requestId = 0; this.prepared = false; } @@ -2140,11 +2136,10 @@ class OutgoingMessage } } - static createForStream(stream, compress, adopt) + static createForStream(stream, adopt) { const m = new OutgoingMessage(); m.stream = stream; - m.compress = compress; m.adopt = adopt; m.isSent = false; m.requestId = 0; @@ -2152,11 +2147,10 @@ class OutgoingMessage return m; } - static create(out, stream, compress, requestId) + static create(out, stream, requestId) { const m = new OutgoingMessage(); m.stream = stream; - m.compress = compress; m.outAsync = out; m.requestId = requestId; m.isSent = false; diff --git a/js/src/Ice/ConnectionRequestHandler.js b/js/src/Ice/ConnectionRequestHandler.js index 84e0c1a42a7..45ce1a8d29d 100644 --- a/js/src/Ice/ConnectionRequestHandler.js +++ b/js/src/Ice/ConnectionRequestHandler.js @@ -12,12 +12,11 @@ const ReferenceMode = Ice.ReferenceMode; class ConnectionRequestHandler { - constructor(ref, connection, compress) + constructor(ref, connection) { this._reference = ref; this._response = ref.getMode() == ReferenceMode.ModeTwoway; this._connection = connection; - this._compress = compress; } update(previousHandler, newHandler) @@ -47,7 +46,7 @@ class ConnectionRequestHandler sendAsyncRequest(out) { - return out.invokeRemote(this._connection, this._compress, this._response); + return out.invokeRemote(this._connection, this._response); } asyncRequestCanceled(out) diff --git a/js/src/Ice/DefaultsAndOverrides.js b/js/src/Ice/DefaultsAndOverrides.js index 420cdd048ea..753f48c46c1 100644 --- a/js/src/Ice/DefaultsAndOverrides.js +++ b/js/src/Ice/DefaultsAndOverrides.js @@ -11,9 +11,9 @@ const Ice = require("../Ice/ModuleRegistry").Ice; Ice._ModuleRegistry.require(module, [ - "../Ice/FormatType", - "../Ice/EndpointTypes", - "../Ice/Protocol", + "../Ice/FormatType", + "../Ice/EndpointTypes", + "../Ice/Protocol", "../Ice/LocalException" ]); @@ -88,7 +88,6 @@ class DefaultsAndOverrides this.overrideCloseTimeoutValue = -1; } - this.overrideCompress = false; this.overrideSecure = false; value = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random"); diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js index 92d074dda71..b46fd8a5c77 100644 --- a/js/src/Ice/IncomingAsync.js +++ b/js/src/Ice/IncomingAsync.js @@ -33,11 +33,10 @@ const StringUtil = Ice.StringUtil; class IncomingAsync { - constructor(instance, connection, adapter, response, compress, requestId) + constructor(instance, connection, adapter, response, requestId) { this._instance = instance; this._response = response; - this._compress = compress; this._connection = connection; this._format = Ice.FormatType.DefaultFormat; @@ -230,7 +229,7 @@ class IncomingAsync this._os.writeString(ex.operation); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -251,7 +250,7 @@ class IncomingAsync this._os.writeInt(this._current.requestId); this._os.writeByte(Protocol.replyUnknownLocalException); this._os.writeString(ex.unknown); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -272,7 +271,7 @@ class IncomingAsync this._os.writeInt(this._current.requestId); this._os.writeByte(Protocol.replyUnknownUserException); this._os.writeString(ex.unknown); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -293,7 +292,7 @@ class IncomingAsync this._os.writeInt(this._current.requestId); this._os.writeByte(Protocol.replyUnknownException); this._os.writeString(ex.unknown); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -321,7 +320,7 @@ class IncomingAsync s.push(ex.stack); } this._os.writeString(s.join("")); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -339,7 +338,7 @@ class IncomingAsync this._os.startEncapsulation(this._current.encoding, this._format); this._os.writeUserException(ex); this._os.endEncapsulation(); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -361,7 +360,7 @@ class IncomingAsync this._os.writeByte(Protocol.replyUnknownException); //this._os.writeString(ex.toString()); this._os.writeString(ex.toString() + (ex.stack ? "\n" + ex.stack : "")); - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { @@ -526,7 +525,7 @@ class IncomingAsync if(this._response) { - this._connection.sendResponse(this._os, this._compress); + this._connection.sendResponse(this._os); } else { diff --git a/js/src/Ice/ObjectPrx.js b/js/src/Ice/ObjectPrx.js index d68043eac47..506587e90d6 100644 --- a/js/src/Ice/ObjectPrx.js +++ b/js/src/Ice/ObjectPrx.js @@ -44,7 +44,7 @@ class ObjectPrx this._reference = null; this._requestHandler = null; } - + hashCode(r) { return this._reference.hashCode(); @@ -411,19 +411,6 @@ class ObjectPrx } } - ice_compress(co) - { - const ref = this._reference.changeCompress(co); - if(ref.equals(this._reference)) - { - return this; - } - else - { - return this._newInstance(ref); - } - } - ice_timeout(t) { if(t < 1 && t !== -1) @@ -661,7 +648,7 @@ class ObjectPrx } return false; } - + // // Generic invocation for operations that have input parameters. // @@ -878,7 +865,7 @@ class ObjectPrx return false; } - + static ice_staticId() { return this._id; diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js index bce53bc29a9..168dd78976f 100644 --- a/js/src/Ice/OutgoingAsync.js +++ b/js/src/Ice/OutgoingAsync.js @@ -102,7 +102,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase { this.markFinishedEx(ex); } - + invokeImpl(userThread) { try @@ -182,7 +182,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase } super.markFinishedEx.call(this, ex); } - + handleException(ex) { const interval = { value: 0 }; @@ -276,9 +276,9 @@ class OutgoingAsync extends ProxyOutgoingAsyncBase this.markSent(!this._proxy.ice_isTwoway()); } - invokeRemote(connection, compress, response) + invokeRemote(connection, response) { - return connection.sendAsyncRequest(this, compress, response, 0); + return connection.sendAsyncRequest(this, response, 0); } abort(ex) @@ -507,14 +507,14 @@ class ProxyFlushBatch extends ProxyOutgoingAsyncBase this._batchRequestNum = prx._getBatchRequestQueue().swap(this._os); } - invokeRemote(connection, compress, response) + invokeRemote(connection, response) { if(this._batchRequestNum === 0) { this.sent(); return AsyncStatus.Sent; } - return connection.sendAsyncRequest(this, compress, response, this._batchRequestNum); + return connection.sendAsyncRequest(this, response, this._batchRequestNum); } invoke() @@ -531,12 +531,12 @@ class ProxyGetConnection extends ProxyOutgoingAsyncBase super(prx, operation); } - invokeRemote(connection, compress, response) + invokeRemote(connection, response) { this.markFinished(true, r => r.resolve(connection)); return AsyncStatus.Sent; } - + invoke() { this.invokeImpl(true); // userThread = true @@ -563,7 +563,7 @@ class ConnectionFlushBatch extends OutgoingAsyncBase } else { - status = this._connection.sendAsyncRequest(this, false, false, batchRequestNum); + status = this._connection.sendAsyncRequest(this, false, batchRequestNum); } if((status & AsyncStatus.Sent) > 0) @@ -596,7 +596,7 @@ class HeartbeatAsync extends OutgoingAsyncBase this._os.writeByte(0); this._os.writeInt(Protocol.headerSize); // Message size. - let status = this._connection.sendAsyncRequest(this, false, false, 0); + let status = this._connection.sendAsyncRequest(this, false, 0); if((status & AsyncStatus.Sent) > 0) { diff --git a/js/src/Ice/OutgoingConnectionFactory.js b/js/src/Ice/OutgoingConnectionFactory.js index 860d78fd522..48dfabe7ce9 100644 --- a/js/src/Ice/OutgoingConnectionFactory.js +++ b/js/src/Ice/OutgoingConnectionFactory.js @@ -73,7 +73,7 @@ class OutgoingConnectionFactory } // - // Returns a promise, success callback receives (connection, compress) + // Returns a promise, success callback receives the connection // create(endpts, hasMore, selType) { @@ -89,11 +89,10 @@ class OutgoingConnectionFactory // try { - const compress = { value: false }; - const connection = this.findConnectionByEndpoint(endpoints, compress); + const connection = this.findConnectionByEndpoint(endpoints); if(connection !== null) { - return Ice.Promise.resolve([connection, compress.value]); + return Ice.Promise.resolve(connection); } } catch(ex) @@ -217,7 +216,7 @@ class OutgoingConnectionFactory }); } - findConnectionByEndpoint(endpoints, compress) + findConnectionByEndpoint(endpoints) { if(this._destroyed) { @@ -246,14 +245,6 @@ class OutgoingConnectionFactory { if(connectionList[j].isActiveOrHolding()) // Don't return destroyed or un-validated connections { - if(defaultsAndOverrides.overrideCompress) - { - compress.value = defaultsAndOverrides.overrideCompressValue; - } - else - { - compress.value = endpoint.compress(); - } return connectionList[j]; } } @@ -289,7 +280,7 @@ class OutgoingConnectionFactory } } - getConnection(endpoints, cb, compress) + getConnection(endpoints, cb) { if(this._destroyed) { @@ -322,7 +313,7 @@ class OutgoingConnectionFactory // // Search for a matching connection. If we find one, we're done. // - const connection = this.findConnectionByEndpoint(endpoints, compress); + const connection = this.findConnectionByEndpoint(endpoints); if(connection !== null) { return connection; @@ -447,12 +438,8 @@ class OutgoingConnectionFactory callbacks.forEach(cc => cc.removeFromPending()); - const defaultsAndOverrides = this._instance.defaultsAndOverrides(); - const compress = defaultsAndOverrides.overrideCompress ? defaultsAndOverrides.overrideCompressValue : - endpoint.compress(); - callbacks.forEach(cc => cc.getConnection()); - connectionCallbacks.forEach(cc => cc.setConnection(connection, compress)); + connectionCallbacks.forEach(cc => cc.setConnection(connection)); this.checkFinished(); } @@ -748,13 +735,13 @@ class ConnectCallback } } - setConnection(connection, compress) + setConnection(connection) { // // Callback from the factory: the connection to one of the callback // connectors has been established. // - this._promise.resolve([connection, compress]); + this._promise.resolve(connection); this._factory.decPendingConnectCount(); // Must be called last. } @@ -824,8 +811,7 @@ class ConnectCallback // // Ask the factory to get a connection. // - const compress = { value: false }; - const connection = this._factory.getConnection(this._endpoints, this, compress); + const connection = this._factory.getConnection(this._endpoints, this); if(connection === null) { // @@ -837,7 +823,7 @@ class ConnectCallback return; } - this._promise.resolve([connection, compress.value]); + this._promise.resolve(connection); this._factory.decPendingConnectCount(); // Must be called last. } catch(ex) diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js index 043947c5191..86b4d2ea4ca 100644 --- a/js/src/Ice/Reference.js +++ b/js/src/Ice/Reference.js @@ -877,8 +877,6 @@ class Reference this._encoding = encoding; this._invocationTimeout = invocationTimeout; this._hashInitialized = false; - this._overrideCompress = false; - this._compress = false; // Only used if _overrideCompress == true } getMode() @@ -1083,18 +1081,6 @@ class Reference return r; } - changeCompress(newCompress) - { - if(this._overrideCompress && this._compress === newCompress) - { - return this; - } - const r = this._instance.referenceFactory().copy(this); - r._compress = newCompress; - r._overrideCompress = true; - return r; - } - changeAdapterId(newAdapterId) { // Abstract @@ -1185,11 +1171,6 @@ class Reference } } h = HashUtil.addString(h, this._facet); - h = HashUtil.addBoolean(h, this._overrideCompress); - if(this._overrideCompress) - { - h = HashUtil.addBoolean(h, this._compress); - } h = HashUtil.addHashable(h, this._protocol); h = HashUtil.addHashable(h, this._encoding); h = HashUtil.addNumber(h, this._invocationTimeout); @@ -1424,15 +1405,6 @@ class Reference return false; } - if(this._overrideCompress !== r._overrideCompress) - { - return false; - } - if(this._overrideCompress && this._compress !== r._compress) - { - return false; - } - if(!this._protocol.equals(r._protocol)) { return false; @@ -1464,8 +1436,6 @@ class Reference // Copy the members that are not passed to the constructor. // r._context = this._context; - r._overrideCompress = this._overrideCompress; - r._compress = this._compress; } } @@ -1644,23 +1614,9 @@ class FixedReference extends Reference this._fixedConnection.throwException(); // Throw in case our connection is already destroyed. - let compress; - if(defaultsAndOverrides.overrideCompress) - { - compress = defaultsAndOverrides.overrideCompressValue; - } - else if(this._overrideCompress) - { - compress = this._compress; - } - else - { - compress = this._fixedConnection.endpoint().compress(); - } - - return proxy._setRequestHandler(new ConnectionRequestHandler(this, this._fixedConnection, compress)); + return proxy._setRequestHandler(new ConnectionRequestHandler(this, this._fixedConnection)); } - + getBatchRequestQueue() { return this._fixedConnection.getBatchRequestQueue(); @@ -1775,16 +1731,6 @@ class RoutableReference extends Reference return r; } - changeCompress(newCompress) - { - const r = super.changeCompress(newCompress); - if(r !== this && this._endpoints.length > 0) // Also override the compress flag on the endpoints if it was updated. - { - r._endpoints = this._endpoints.map(endpoint => endpoint.changeCompress(newCompress)); - } - return r; - } - changeAdapterId(newAdapterId) { if(this._adapterId === newAdapterId) @@ -2094,7 +2040,7 @@ class RoutableReference extends Reference getConnection() { - const p = new Ice.Promise(); // success callback receives (connection, compress) + const p = new Ice.Promise(); // success callback receives (connection) if(this._routerInfo !== null) { @@ -2225,10 +2171,6 @@ class RoutableReference extends Reference for(let i = 0; i < endpts.length; ++i) { endpts[i] = endpts[i].changeConnectionId(this._connectionId); - if(this._overrideCompress) - { - endpts[i] = endpts[i].changeCompress(this._compress); - } if(this._overrideTimeout) { endpts[i] = endpts[i].changeTimeout(this._timeout); @@ -2352,7 +2294,7 @@ class RoutableReference extends Reference // const cb = new CreateConnectionCallback(this, null, promise); factory.create(endpoints, false, this.getEndpointSelection()).then( - values => cb.setConnection(values)).catch(ex => cb.setException(ex)); + connection => cb.setConnection(connection)).catch(ex => cb.setException(ex)); } else { @@ -2365,7 +2307,7 @@ class RoutableReference extends Reference // const cb = new CreateConnectionCallback(this, endpoints, promise); factory.create([ endpoints[0] ], true, this.getEndpointSelection()).then( - values => cb.setConnection(values)).catch(ex => cb.setException(ex)); + connection => cb.setConnection(connection)).catch(ex => cb.setException(ex)); } return promise; } @@ -2385,9 +2327,8 @@ class CreateConnectionCallback this.exception = null; } - setConnection(values) + setConnection(connection) { - const [connection, compress] = values; // // If we have a router, set the object adapter for this router // (if any) to the new connection, so that callbacks from the @@ -2397,7 +2338,7 @@ class CreateConnectionCallback { connection.setAdapter(this.ref.getRouterInfo().getAdapter()); } - this.promise.resolve(values); + this.promise.resolve(connection); } setException(ex) @@ -2414,9 +2355,9 @@ class CreateConnectionCallback } this.ref.getInstance().outgoingConnectionFactory().create( - [ this.endpoints[this.i] ], - this.i != this.endpoints.length - 1, - this.ref.getEndpointSelection()).then(values => this.setConnection(values)) + [ this.endpoints[this.i] ], + this.i != this.endpoints.length - 1, + this.ref.getEndpointSelection()).then(connection => this.setConnection(connection)) .catch(ex => this.setException(ex)); } } diff --git a/js/src/Ice/RequestHandlerFactory.js b/js/src/Ice/RequestHandlerFactory.js index fdfbcffb766..5256b61e950 100644 --- a/js/src/Ice/RequestHandlerFactory.js +++ b/js/src/Ice/RequestHandlerFactory.js @@ -50,9 +50,9 @@ class RequestHandlerFactory if(connect) { - ref.getConnection().then(values => + ref.getConnection().then(connection => { - handler.setConnection(values); + handler.setConnection(connection); }, ex => { diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index e8d14bc0254..a93eae5b46b 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -698,8 +698,9 @@ test(compObj.ice_connectionId("id1").ice_getConnectionId() === "id1"); test(compObj.ice_connectionId("id2").ice_getConnectionId() === "id2"); - test(compObj.ice_compress(true).equals(compObj.ice_compress(true))); - test(!compObj.ice_compress(false).equals(compObj.ice_compress(true))); + // Proxy doesn't support ice_compress + //test(compObj.ice_compress(true).equals(compObj.ice_compress(true))); + //test(!compObj.ice_compress(false).equals(compObj.ice_compress(true))); test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20))); test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20))); |