Package io.netty.channel

Examples of io.netty.channel.Channel.attr()


        this.encoder = encoder;
    }

    private void write(XHRSendPacketsMessage msg, ChannelHandlerContext ctx, ByteBuf out) throws IOException {
        Channel channel = ctx.channel();
        Attribute<Boolean> attr = channel.attr(XHRPollingClient.WRITE_ONCE);

        if (!channel.isActive()
                || msg.getPacketQueue().isEmpty()
                    || !attr.compareAndSet(null, true)) {
            out.release();
View Full Code Here


               // Get 16 bit nonce and base 64 encode it
               byte[] nonce = randomBytes(16);
               String key = base64(nonce);
               request.headers().set(SEC_HORNETQ_REMOTING_KEY, key);
               ch.attr(REMOTING_KEY).set(key);

               HornetQClientLogger.LOGGER.debugf("Sending HTTP request %s", request);

               // Send the HTTP request.
               ch.writeAndFlush(request);
View Full Code Here

    public ServerHandler(RsfContext rsfContext) {
        this.rsfContext = rsfContext;
    }
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        Channel channel = ctx.channel();
        if (channel.attr(NetworkChanneKey).get() == null)
            channel.attr(NetworkChanneKey).set(new NetworkChanne(channel));
        super.channelActive(ctx);
    }
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        if (msg instanceof RequestMsg == false)
View Full Code Here

        this.rsfContext = rsfContext;
    }
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        Channel channel = ctx.channel();
        if (channel.attr(NetworkChanneKey).get() == null)
            channel.attr(NetworkChanneKey).set(new NetworkChanne(channel));
        super.channelActive(ctx);
    }
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        if (msg instanceof RequestMsg == false)
            return;
View Full Code Here

        PlayerState state = world.isCharCreate() ? PlayerState.CreatingCharacter : PlayerState.LoadingInstance;
        client.setPlayerState(state);

        // sign the client
        Channel channel = client.getChannel();
        channel.attr(GameAppContextKey.KEY).set(context.get());
        channel.attr(GameAppContextKey.IS_SET).set(true);

        // register it
        // this will trigger an event from the client registry notification decorator,
        // instructing other controllers to deal with this newly registered client
View Full Code Here

        client.setPlayerState(state);

        // sign the client
        Channel channel = client.getChannel();
        channel.attr(GameAppContextKey.KEY).set(context.get());
        channel.attr(GameAppContextKey.IS_SET).set(true);

        // register it
        // this will trigger an event from the client registry notification decorator,
        // instructing other controllers to deal with this newly registered client
        Handle<ClientBean> clientHandle = clientRegistry.registerExisting(client, clientUid);
View Full Code Here

        // register it
        // this will trigger an event from the client registry notification decorator,
        // instructing other controllers to deal with this newly registered client
        Handle<ClientBean> clientHandle = clientRegistry.registerExisting(client, clientUid);
        channel.attr(ClientBean.HANDLE_KEY).set(clientHandle);

        // also inform the login shard
        loginShard.get().trigger(
                new GSNotify_ClientConnected(
                    context.getUid(),
View Full Code Here

    }

    private void handleHTTP(OutPacketMessage msg, ChannelHandlerContext ctx) throws IOException {
        Channel channel = ctx.channel();
        Attribute<Boolean> attr = channel.attr(WRITE_ONCE);

        Queue<Packet> queue = msg.getClientHead().getPacketsQueue(msg.getTransport());

        if (!channel.isActive() || queue.isEmpty() || !attr.compareAndSet(null, true)) {
            return;
View Full Code Here

        TransportState state = channels.get(transport);
        state.getPacketsQueue().add(packet);

        Channel channel = state.getChannel();
        if (channel == null
                || (transport == Transport.POLLING && channel.attr(EncoderHandler.WRITE_ONCE).get() != null)) {
            return null;
        }
        return sendPackets(transport, channel);
    }
View Full Code Here

        this.configuration = configuration;
    }

    private void write(XHRSendPacketsMessage msg, ChannelHandlerContext ctx, ByteBuf out) throws IOException {
        Channel channel = ctx.channel();
        Attribute<Boolean> attr = channel.attr(XHRPollingClient.WRITE_ONCE);

        if (!channel.isActive()
                || msg.getPacketQueue().isEmpty()
                    || !attr.compareAndSet(null, true)) {
            out.release();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.