Skip to content

Commit

Permalink
Reset the peer when join (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
GodFuper authored Dec 25, 2024
1 parent 5a20e88 commit bcaec85
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public GameSession() {}
* @return the port the ice adapter will be listening/sending for FA
*/
public int connectToPeer(String remotePlayerLogin, int remotePlayerId, boolean offer, int preferredPort) {
if (peers.containsKey(remotePlayerId)) {
reconnectToPeer(remotePlayerId);
return peers.get(remotePlayerId).getLocalPort();
}
Peer peer = new Peer(this, remotePlayerId, remotePlayerLogin, offer, preferredPort);
peers.put(remotePlayerId, peer);
debug().connectToPeer(remotePlayerId, remotePlayerLogin, offer);
Expand Down

0 comments on commit bcaec85

Please sign in to comment.