void handleException(IOException e) { handleException(e, true); }
private void notifyEnd() { synchronized (connection.getLock()) { if (nextReceiver != null) { final Receiver receiver = nextReceiver; nextReceiver = null; try { getExecutor().execute(() -> receiver.handleEnd(RemoteConnectionChannel.this)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } } }
public void receiveMessage(final Receiver handler) { synchronized (connection.getLock()) { if (inboundMessageQueue.isEmpty()) { if ((channelState & READ_CLOSED) != 0) { getExecutor().execute(() -> handler.handleEnd(RemoteConnectionChannel.this)); } else if (nextReceiver != null) { throw new IllegalStateException("Message handler already queued"); } else { nextReceiver = handler; } } else { final InboundMessage message = inboundMessageQueue.remove(); try { getExecutor().execute(() -> handler.handleMessage(RemoteConnectionChannel.this, message.messageInputStream)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } connection.getLock().notify(); } }
final int bufRemaining = buffer.remaining(); if ((inboundWindow -= bufRemaining) < 0) { channel.getRemoteConnection().handleException(new IOException("Input overrun")); return;
handleException(e, false); Pooled<ByteBuffer> unqueued; while ((unqueued = queue.poll()) != null) {
public void handleEvent(final ConduitStreamSourceChannel channel) { final Pooled<ByteBuffer> pooled = connection.allocate(); boolean ok = false; try { ByteBuffer sendBuffer = pooled.getResource(); sendBuffer.put(Protocol.GREETING); ProtocolUtils.writeString(sendBuffer, Protocol.GRT_SERVER_NAME, serverName); sendBuffer.flip(); connection.setReadListener(new Initial(), true); connection.send(pooled); ok = true; return; } catch (BufferUnderflowException | BufferOverflowException e) { connection.handleException(log.invalidMessage(connection)); return; } finally { if (! ok) pooled.free(); } }
public void shutdownWrites() { synchronized (queue) { closed = true; terminateHeartbeat(); final ConduitStreamSinkChannel sinkChannel = connection.getSinkChannel(); try { if (! queue.isEmpty()) { sinkChannel.resumeWrites(); return; } sinkChannel.shutdownWrites(); if (! sinkChannel.flush()) { sinkChannel.resumeWrites(); return; } Messages.conn.logf(FQCN, Logger.Level.TRACE, null, "Shut down writes on channel"); } catch (IOException e) { handleException(e, false); Pooled<ByteBuffer> unqueued; while ((unqueued = queue.poll()) != null) { unqueued.free(); } } } }
message = connection.getMessageReader().getMessage(); } catch (IOException e) { connection.handleException(e); return; connection.handleException(client.abruptClose(connection)); return; } else { connection.handleException(new IOException("Client starting STARTTLS but channel doesn't support SSL")); return; connection.handleException(client.invalidMessage(connection)); return; connection.handleException(client.invalidMessage(connection)); return; } finally {
message = connection.getMessageReader().getMessage(); } catch (IOException e) { connection.handleException(e); return; connection.handleException(client.abruptClose(connection)); return; connection.handleException(client.invalidMessage(connection)); return; connection.handleException(client.invalidMessage(connection)); return; } finally {
ok2 = true; } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return;
message = connection.getMessageReader().getMessage(); } catch (IOException e) { connection.handleException(e); return; connection.handleException(allMechanismsFailed()); return; connection.handleException(client.abruptClose(connection)); return; connection.handleException(new SaslException("Authentication failed: the server presented no authentication mechanisms")); } else { connection.handleException(allMechanismsFailed()); connection.handleException((SaslException) e); } else { connection.handleException(new SaslException(e.getMessage(), e)); connection.handleException(new SaslException(b.toString())); } else { connection.handleException(allMechanismsFailed()); connection.handleException(client.invalidMessage(connection)); return; connection.handleException(client.invalidMessage(connection)); return;
handleException(e, false); while ((pooled = queue.poll()) != null) { pooled.free();
message = connection.getMessageReader().getMessage(); } catch (IOException e) { connection.handleException(e); saslDispose(saslServer); return; connection.handleException(log.invalidMessage(connection)); saslDispose(saslServer); break; connection.handleException(log.invalidMessage(connection)); saslDispose(saslServer); return;
connection.handleException(e); synchronized (lock) { IoUtils.safeClose(channel);
message = messageReader.getMessage(); } catch (IOException e) { connection.handleException(e); return; connection.handleException(client.abruptClose(connection)); saslDispose(saslClient); return; final boolean clientComplete = saslClient.isComplete(); if (clientComplete) { connection.handleException(new SaslException(saslClient.getMechanismName() + ": Received extra auth message after completion")); return; final byte[] response = saslClient.evaluateChallenge(challenge); if (response != null && response.length > 0) { connection.handleException(new SaslException(saslClient.getMechanismName() + ": Received extra auth message after completion")); saslDispose(saslClient); return; connection.handleException(new SaslException(saslClient.getMechanismName() + ": Client not complete after processing auth complete message")); saslDispose(saslClient); return; connection.handleException(client.invalidMessage(connection)); saslDispose(saslClient); return;
message = connection.getMessageReader().getMessage(); } catch (IOException e) { connection.handleException(e); return; if (retryCount.getAndDecrement() <= 0) { connection.handleException(new SaslException("Too many authentication failures; connection terminated"), false); return; connection.handleException(log.invalidMessage(connection)); break; connection.handleException(log.invalidMessage(connection)); return; } finally {
void handleException(IOException e) { handleException(e, true); }
void handleException(IOException e) { handleException(e, true); }
public SaslServer run() { try { return saslServerFactory.createSaslServer(mechName, protocol, serverName, propertyMap, callbackHandler); } catch (SaslException e) { connection.handleException(e); return null; } } }, accessControlContext);
private void notifyEnd() { synchronized (connection.getLock()) { if (nextReceiver != null) { final Receiver receiver = nextReceiver; nextReceiver = null; try { getExecutor().execute(() -> receiver.handleEnd(RemoteConnectionChannel.this)); } catch (Throwable t) { connection.handleException(new IOException("Fatal connection error", t)); return; } } } }