/** {@inheritDoc} */ @Override public void sessionOpened(IoSession session) throws Exception { SocketSessionConfig ssc = (SocketSessionConfig) session.getConfig(); ssc.setTcpNoDelay(true); super.sessionOpened(session); }
@Override public void sessionOpened(IoSession session) throws Exception { // Create a new XML parser for the new connection. The parser will be used by the XMPPDecoder filter. final XMLLightweightParser parser = new XMLLightweightParser(StandardCharsets.UTF_8); session.setAttribute(XML_PARSER, parser); // Create a new NIOConnection for the new session final NIOConnection connection = createNIOConnection(session); session.setAttribute(CONNECTION, connection); session.setAttribute(HANDLER, createStanzaHandler(connection)); // Set the max time a connection can be idle before closing it. This amount of seconds // is divided in two, as Openfire will ping idle clients first (at 50% of the max idle time) // before disconnecting them (at 100% of the max idle time). This prevents Openfire from // removing connections without warning. final int idleTime = getMaxIdleTime() / 2; if (idleTime > 0) { session.getConfig().setIdleTime(IdleStatus.READER_IDLE, idleTime); } }
/** * @see IoSession#getConfig() */ public IoSessionConfig getConfig() { return wrappedSession.getConfig(); }
@Override public void sessionOpened(final IoSession session) throws Exception { session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE, this.idleTimeOut); }
@Override public void sessionCreated(IoSession session) throws Exception { session.getConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30000); }
@Override public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception { IoSession session = parent.getSession(); if (logger.isDebugEnabled()) { logger.debug(String.format("Setting idle timeout %d on TCP session %s ", idleTimeout, session)); } session.getConfig().setBothIdleTime(idleTimeout); }
private static void activateSessionIdleTimeout(IoSession session) { Integer keepaliveTimeout = SESSION_IDLE_TIMEOUT_KEY.get(session); if (keepaliveTimeout != null) { if (logger.isTraceEnabled()) { logger.trace(String.format("Setting idle timeout %d on HTTP parent session %s ", keepaliveTimeout, session)); } session.getConfig().setBothIdleTime(keepaliveTimeout); } }
@Override protected synchronized void handleSessionCreated ( final IoSession session ) throws Exception { super.handleSessionCreated ( session ); final int timeout = this.readTimeout / 1000; session.getConfig ().setIdleTime ( IdleStatus.READER_IDLE, timeout ); logger.debug ( "Setting timeout to {} seconds", timeout ); }
@Override public void sessionCreated(IoSession session) throws Exception { log.info("Session created..."); ((SocketSessionConfig) session.getConfig()).setReceiveBufferSize(2048); ((SocketSessionConfig) session.getConfig()).setIdleTime(IdleStatus.BOTH_IDLE, 10); PopSession sess = new PopSession(session, resourceFactory); session.setAttribute("stateMachine", sess); } }
@Override public void sessionCreated(IoSession session) throws Exception { super.sessionCreated(session); session.getConfig().setBothIdleTime(sessionIdleCheckInterval); }
@Override public void onPreRemove(IoFilterChain filterChain, String name, NextFilter nextFilter) { filterChain.getSession().getConfig().setReaderIdleTime(0); }
@Override protected void onConnectionConnected () { getSession ().getConfig ().setReaderIdleTime ( (int)TimeUnit.MILLISECONDS.toSeconds ( this.timeoutTime ) + 1 ); sendHello (); }
public void setMaxIdleTime(int maxIdleTime) { setAttribute(ATTRIBUTE_MAX_IDLE_TIME, maxIdleTime); int listenerTimeout = getListener().getIdleTimeout(); // the listener timeout should be the upper limit, unless set to unlimited // if the user limit is set to be unlimited, use the listener value is the threshold // (already used as the default for all sessions) // else, if the user limit is less than the listener idle time, use the user limit if (listenerTimeout <= 0 || (maxIdleTime > 0 && maxIdleTime < listenerTimeout)) { wrappedSession.getConfig().setBothIdleTime(maxIdleTime); } }
@Override public void sessionOpened ( final NextFilter nextFilter, final IoSession session ) throws Exception { final ProtocolConfiguration configuration = ProtocolConfiguration.fromSession ( session ); // init timeout for handshake // FIXME: this is not a real timeout but a read idle timeout only session.getConfig ().setReaderIdleTime ( (int)Math.ceil ( configuration.getHandshakeTimeout () / 1000.0 ) ); if ( this.clientMode ) { nextFilter.filterWrite ( session, new DefaultWriteRequest ( createHelloMessage ( session, nextFilter ) ) ); } }
@Override public void sessionOpened ( final NextFilter nextFilter, final IoSession session ) throws Exception { final ProtocolConfiguration configuration = ProtocolConfiguration.fromSession ( session ); // init timeout for handshake // FIXME: this is not a real timeout but a read idle timeout only session.getConfig ().setReaderIdleTime ( (int)Math.ceil ( configuration.getHandshakeTimeout () / 1000.0 ) ); if ( this.clientMode ) { nextFilter.filterWrite ( session, new DefaultWriteRequest ( createHelloMessage ( session, nextFilter ) ) ); } }