diff options
author | Marc Laukien <marc@zeroc.com> | 2002-07-01 18:03:44 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-07-01 18:03:44 +0000 |
commit | 35486b505c44e937115759d29ecf12ca470951d5 (patch) | |
tree | 0cec36d62b0d08465598b79e5c207568daf6602e /java/src | |
parent | Added additional check to make sure that no exception is mentioned more (diff) | |
download | ice-35486b505c44e937115759d29ecf12ca470951d5.tar.bz2 ice-35486b505c44e937115759d29ecf12ca470951d5.tar.xz ice-35486b505c44e937115759d29ecf12ca470951d5.zip |
validation fixes
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/IceInternal/Connection.java | 20 | ||||
-rw-r--r-- | java/src/IceInternal/IncomingConnectionFactory.java | 62 |
2 files changed, 41 insertions, 41 deletions
diff --git a/java/src/IceInternal/Connection.java b/java/src/IceInternal/Connection.java index 8d37fbfb35c..b168179422f 100644 --- a/java/src/IceInternal/Connection.java +++ b/java/src/IceInternal/Connection.java @@ -746,11 +746,25 @@ public final class Connection extends EventHandler if(_adapter != null) { // - // Incoming connections play the active role with - // respect to connection validation. + // Incoming connections play the active role with respect + // to connection validation, and are implicitly validated. // + try + { + validateConnection(); + } + catch(Ice.LocalException ex) + { + if(_warn) + { + warning("connection exception", ex); + } + _transceiver.close(); + _state = StateClosed; + throw ex; + } + _connectionValidated = true; - validateConnection(); } else { diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java index cc35fe47cef..1f7d3dab626 100644 --- a/java/src/IceInternal/IncomingConnectionFactory.java +++ b/java/src/IceInternal/IncomingConnectionFactory.java @@ -106,16 +106,15 @@ public class IncomingConnectionFactory extends EventHandler // // Now accept a new connection. // + Transceiver transceiver; try { - Transceiver transceiver = _acceptor.accept(0); - Connection connection = new Connection(_instance, transceiver, _endpoint, _adapter); - connection.activate(); - _connections.add(connection); + transceiver = _acceptor.accept(0); } catch(Ice.TimeoutException ex) { // Ignore timeouts. + return; } catch(Ice.LocalException ex) { @@ -124,7 +123,28 @@ public class IncomingConnectionFactory extends EventHandler warning(ex); } setState(StateClosed); + return; } + + // + // Create and activate a connection object for the connection. + // + try + { + assert(transceiver); + Connection connection = new Connection(_instance, transceiver, _endpoint, _adapter); + connection.activate(); + _connections.add(connection); + } + catch(Ice.LocalException ex) + { + // + // Ignore all exceptions while creating or activating the + // connection object. Warning or error messages for such + // exceptions must be printed directly in the connection + // object code. + // + } } public synchronized void @@ -138,40 +158,6 @@ public class IncomingConnectionFactory extends EventHandler } else if(_state == StateClosed) { -// -// With the new connection validation, this code is not needed -// anymore. -// -/* - try - { - // - // Clear listen() backlog properly by accepting all queued - // connections, and then shutting them down. - // - while(true) - { - try - { - Transceiver transceiver = _acceptor.accept(0); - Connection connection = new Connection(_instance, transceiver, _endpoint, _adapter); - connection.destroy(Connection.ObjectAdapterDeactivated); - } - catch(Ice.TimeoutException ex) - { - break; // Exit loop on timeout. - } - } - } - catch(Ice.LocalException ex) - { - if(_warn) - { - warning(ex); - } - } -*/ - _acceptor.close(); // |