Пример #1
0
 /**
  * Invoked when the idle status of a session changes.
  *
  * @param session The session in question
  * @param status The new idle status
  */
 public void sessionIdle(IoSession session, IdleStatus status) {
   Player player = (Player) session.getAttachment();
   if (!player.destroyed()) {
     player.destroy(false);
   }
   session.close();
 }
Пример #2
0
 public void stop() {
   for (IoSession session : sessions) {
     if (session != null) {
       session.close();
     }
   }
 }
 @Override
 public void sessionCreated(NextFilter nextFilter, IoSession session) throws Exception {
   if (!isConnectionOk(session)) {
     session.close();
     return;
   }
   nextFilter.sessionCreated(session);
 }
Пример #4
0
 protected void closeSession() {
   logger.warn("Closing session");
   session.close();
 }
Пример #5
0
  /**
   * Invoked whenever an exception is thrown by MINA or this IoHandler.
   *
   * @param session The associated session
   * @param cause The exception thrown
   */
  public void exceptionCaught(IoSession session, Throwable cause) {
    Player p = (Player) session.getAttachment();

    if (p != null) p.getActionSender().sendLogout();
    session.close();
  }
Пример #6
0
 public void disconnect() {
   if (session != null) {
     session.close().join(30);
     session = null;
   }
 }