mirror of
https://github.com/magefree/mage.git
synced 2026-01-22 19:29:59 -08:00
[load] one place server ping
This commit is contained in:
parent
a17f8e6059
commit
1c0b807a02
8 changed files with 61 additions and 8 deletions
|
|
@ -51,6 +51,8 @@ public interface MageServer {
|
|||
|
||||
public boolean setUserData(String userName, String sessionId, UserDataView userDataView) throws MageException;
|
||||
public ServerState getServerState() throws MageException;
|
||||
|
||||
public boolean ping(String sessionId) throws MageException;
|
||||
|
||||
//table methods
|
||||
public TableView createTable(String sessionId, UUID roomId, MatchOptions matchOptions) throws MageException;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public interface Session {
|
|||
|
||||
boolean isConnected();
|
||||
|
||||
boolean ping();
|
||||
|
||||
String[] getPlayerTypes();
|
||||
|
||||
List<GameTypeView> getGameTypes();
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,21 @@ public class SessionImpl implements Session {
|
|||
public void setEmbeddedMageServerAction(Action embeddedMageServerAction) {
|
||||
this.embeddedMageServerAction = embeddedMageServerAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ping() {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.ping(sessionId);
|
||||
}
|
||||
return true;
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class MageAuthenticator extends Authenticator {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue