forked from External/mage
Added connection speed information per user (milliseconds the ping needs). Some minor changes to server console.
This commit is contained in:
parent
1285df5da3
commit
b98c16f061
20 changed files with 166 additions and 54 deletions
|
|
@ -152,13 +152,35 @@ public class SessionManager {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin requested the disconnect of a user
|
||||
* @param sessionId
|
||||
* @param userSessionId
|
||||
*/
|
||||
public void disconnectUser(String sessionId, String userSessionId) {
|
||||
if (isAdmin(sessionId)) {
|
||||
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_DISCONNECTED_BY_ADMIN, sessionId, userSessionId);
|
||||
User userAdmin, user;
|
||||
if ((userAdmin = getUserFromSession(sessionId)) != null) {
|
||||
if ((user = getUserFromSession(userSessionId)) != null) {
|
||||
user.showUserMessage("Admin operation","Your session was disconnected by Admin.");
|
||||
userAdmin.showUserMessage("Admin action", "User" + user.getName() + " was disconnected.");
|
||||
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
||||
LogServiceImpl.instance.log(LogKeys.KEY_SESSION_DISCONNECTED_BY_ADMIN, sessionId, userSessionId);
|
||||
} else {
|
||||
userAdmin.showUserMessage("Admin operation","User with sessionId " + userSessionId + " could not be found!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private User getUserFromSession(String sessionId) {
|
||||
Session session = getSession(sessionId);
|
||||
if (session == null) {
|
||||
return null;
|
||||
}
|
||||
return UserManager.getInstance().getUser(session.getUserId());
|
||||
}
|
||||
|
||||
public void endUserSession(String sessionId, String userSessionId) {
|
||||
if (isAdmin(sessionId)) {
|
||||
disconnect(userSessionId, DisconnectReason.AdminDisconnect);
|
||||
|
|
@ -186,10 +208,10 @@ public class SessionManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean extendUserSession(String sessionId) {
|
||||
public boolean extendUserSession(String sessionId, String pingInfo) {
|
||||
Session session = sessions.get(sessionId);
|
||||
if (session != null) {
|
||||
return UserManager.getInstance().extendUserSession(session.getUserId());
|
||||
return UserManager.getInstance().extendUserSession(session.getUserId(), pingInfo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue