Examples of LobbySession


Examples of net.yura.lobby.server.LobbySession

    }
   
    private void handleMessage(ClientHandler ch, Message message) {
       
        LobbyServer server = ((Server)ch.getServer()).lobbyServer;
        LobbySession session = ((Session)ch.getClientData()).lobbySession;
       
        server.handleMessage(session,message);
    }
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

    @Override
    public List<LobbySession> getLobbySession(String username) {
        List<LobbySession> result = new ArrayList();
        for (Channel channel:allClientChannels) {
            LobbySession session = channel.attr( SESSION_KEY ).get();
            if (
                    (username == null) ||
                    (username.equals( session.getUsername() )) ||
                    ("".equals(username) && session.getUsername()==null)
                ) {
                result.add(session);
            }
        }
        return result;
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

    private Channel getChannel(LobbySession key) {
        // TODO this is not very good and would be much better if instead of the UUID
        // we could store the cannel ID and then we could use allClientChannels.find(Integer)
        for (Channel channel:allClientChannels) {
            LobbySession session = channel.attr( SESSION_KEY ).get();
            if (session == key) {
                return channel;
            }
        }
        return null;
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

        this.allClientChannels = allClientChannels;
    }
   
    @Override
    public void channelRead(ChannelHandlerContext chc, Object msg) throws Exception {
        LobbySession session = getLobbySession(chc);
        server.handleMessage(session, (Message)msg);
    }
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

        server.handleMessage(session, (Message)msg);
    }
   
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        LobbySession session = getLobbySession(ctx);
        Server.logger.log(Level.WARNING, "exception "+ctx+" "+session, cause);
        ctx.close();
    }
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

    @Override
    public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
        super.channelRegistered(ctx);
       
        LobbySession session = new LobbySession();
        ctx.channel().attr(Server.SESSION_KEY).set(session);
       
        Server.logger.info("channelRegistered "+ctx+" "+session);
       
        allClientChannels.add(ctx.channel());
View Full Code Here

Examples of net.yura.lobby.server.LobbySession

    @Override
    public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
        super.channelUnregistered(ctx);
       
        LobbySession session = getLobbySession(ctx);
       
        Server.logger.info("channelUnregistered "+ctx+" "+session);
       
        allClientChannels.remove(ctx.channel()); // TODO not sure if needed
        server.closingConnection(session);
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.