Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

连接登录问题 #17

Open
losye opened this issue Jul 31, 2017 · 2 comments
Open

连接登录问题 #17

losye opened this issue Jul 31, 2017 · 2 comments

Comments

@losye
Copy link

losye commented Jul 31, 2017

当接收到连接时,
public static void addClientConnection(ChannelHandlerContext c) {
//fixme 之后重复登录需要踢掉原来的连接
ClientConnection conn = new ClientConnection(c);

    if(ClientConnectionMap.allClientMap.putIfAbsent(conn.getNetId(), conn) != null) {
        logger.error("Duplicated netid");
    }
}

这里什么case会 != null呢 ? 因为每次都是new 一个新的Connection ,然后id会incrementAndGet

另外如果重复登录要踢掉原来的连接,如何知道是重复登录呢?

@twjitm
Copy link

twjitm commented Aug 2, 2017

采用统一session认证的方式

@haoshijing
Copy link

这里缺少一个客户端管理,比如加一个心跳包的响应,用一个map管理起来.下次在进来的时候,从map中发现是否已经一个没有失效的clientInfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants