[Pogamut-list] Changing map with randomPorts
nvh
pogamut-forum at artemis.ms.mff.cuni.cz
Mon Apr 20 20:53:23 CEST 2009
Re: Changing map with randomPorts
Author: nvh
In search for a solution I implemented this function in UCCWrapper:
^
public void changeMap(String mapName) {
try {
utServer.waitForCommunication();
if (utServer.isConnectionAlive()) {
this.scanner.resetPorts();
if(utServer.setMap(mapName)) {
utServer.info.gamebotsControlConnectionURI = null;
scanner.portsBindedLatch.await();
utServer.setGamebotsControlConnectionURI(URI.create("ut://localhost:" + scanner.controlPort));
utServer.setGamebotsBotURI(URI.create("ut://localhost:" + scanner.botsPort));
}
}
}
catch (PogamutException pe) {
System.out.println("Failed to change map");
pe.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
utServer.waitForCommunication();
}
^
Now, this works, but I'm not sure if setting the gamebotsControlConnectionURI to null manually is a good idea. Is there anyone that can comment on that?
My suspicion is that hypotheticly the connection could be set to null before the request for the mapchange being sent, leaving the code stuck waiting for ports. Is this a possibility?
More information about the Pogamut-list
mailing list