Search in sources :

Example 1 with DefaultChannelFuture

use of com.generallycloud.baseio.protocol.DefaultChannelFuture in project baseio by generallycloud.

the class AbstractSocketChannel method fireOpend.

@Override
public void fireOpend() {
    SocketChannelContext context = getContext();
    if (context.isEnableSSL()) {
        InetSocketAddress remote = getRemoteSocketAddress();
        this.sslHandler = getSocketChannelThreadContext().getSslHandler();
        this.sslEngine = context.getSslContext().newEngine(remote.getHostName(), remote.getPort());
    }
    if (isEnableSSL() && context.getSslContext().isClient()) {
        doFlush(new DefaultChannelFuture(getContext(), EmptyByteBuf.getInstance()));
    }
    UnsafeSocketSession session = getSession();
    if (!session.isClosed()) {
        threadContext.getSocketSessionManager().putSession(session);
        SocketSessionEventListenerWrapper linkable = context.getSessionEventListenerLink();
        if (linkable != null) {
            linkable.sessionOpened(session);
        }
    }
}
Also used : InetSocketAddress(java.net.InetSocketAddress) DefaultChannelFuture(com.generallycloud.baseio.protocol.DefaultChannelFuture)

Example 2 with DefaultChannelFuture

use of com.generallycloud.baseio.protocol.DefaultChannelFuture in project baseio by generallycloud.

the class Http2PrefaceFuture method doComplete.

private void doComplete(SocketChannel channel, ByteBuf buf) throws IOException {
    Http2SocketSession session = (Http2SocketSession) channel.getSession();
    session.setPrefaceRead(false);
    if (!isPreface(buf)) {
        throw new IOException("not http2 preface");
    }
    session.doFlush(new DefaultChannelFuture(context, PREFACE_BUF.duplicate()));
}
Also used : Http2SocketSession(com.generallycloud.baseio.codec.http2.Http2SocketSession) DefaultChannelFuture(com.generallycloud.baseio.protocol.DefaultChannelFuture) IOException(java.io.IOException)

Aggregations

DefaultChannelFuture (com.generallycloud.baseio.protocol.DefaultChannelFuture)2 Http2SocketSession (com.generallycloud.baseio.codec.http2.Http2SocketSession)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1