.
This commit is contained in:
@@ -172,6 +172,19 @@ public class SteamNetImpl implements SteamNetworkingCallback, SteamMatchmakingCa
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void disconnectSteamUser(SteamID steamid){
|
||||||
|
//a client left
|
||||||
|
int sid = steamid.getAccountID();
|
||||||
|
snet.closeP2PSessionWithUser(steamid);
|
||||||
|
|
||||||
|
if(steamConnections.containsKey(sid)){
|
||||||
|
SteamConnection con = steamConnections.get(sid);
|
||||||
|
Net.handleServerReceived(con.id, new Disconnect());
|
||||||
|
steamConnections.remove(sid);
|
||||||
|
connections.remove(con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFavoritesListChanged(int i, int i1, int i2, int i3, int i4, boolean b, int i5){
|
public void onFavoritesListChanged(int i, int i1, int i2, int i3, int i4, boolean b, int i5){
|
||||||
|
|
||||||
@@ -218,13 +231,7 @@ public class SteamNetImpl implements SteamNetworkingCallback, SteamMatchmakingCa
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//a client left
|
//a client left
|
||||||
int id = who.getAccountID();
|
disconnectSteamUser(who);
|
||||||
snet.closeP2PSessionWithUser(who);
|
|
||||||
|
|
||||||
if(steamConnections.containsKey(id)){
|
|
||||||
Net.handleServerReceived(id, new Disconnect());
|
|
||||||
steamConnections.remove(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,15 +282,7 @@ public class SteamNetImpl implements SteamNetworkingCallback, SteamMatchmakingCa
|
|||||||
public void onP2PSessionConnectFail(SteamID steamIDRemote, P2PSessionError sessionError){
|
public void onP2PSessionConnectFail(SteamID steamIDRemote, P2PSessionError sessionError){
|
||||||
if(Net.server()){
|
if(Net.server()){
|
||||||
Log.info("{0} has disconnected: {1}", steamIDRemote.getAccountID(), sessionError);
|
Log.info("{0} has disconnected: {1}", steamIDRemote.getAccountID(), sessionError);
|
||||||
|
disconnectSteamUser(steamIDRemote);
|
||||||
if(Net.server()){
|
|
||||||
int id = steamIDRemote.getAccountID();
|
|
||||||
|
|
||||||
if(steamConnections.containsKey(id)){
|
|
||||||
Net.handleServerReceived(id, new Disconnect());
|
|
||||||
steamConnections.remove(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else if(steamIDRemote == currentServer){
|
}else if(steamIDRemote == currentServer){
|
||||||
Log.info("Disconnected! {1}: {0}", steamIDRemote.getAccountID(), sessionError);
|
Log.info("Disconnected! {1}: {0}", steamIDRemote.getAccountID(), sessionError);
|
||||||
Net.handleClientReceived(new Disconnect());
|
Net.handleClientReceived(new Disconnect());
|
||||||
|
|||||||
Reference in New Issue
Block a user