matching table now stores the correct ip of the hosts

#story[1188]
This commit is contained in:
hba56
2017-08-31 13:55:16 +12:00
parent 9161f69547
commit a1fa09962a
3 changed files with 4 additions and 4 deletions
@@ -17,9 +17,9 @@ public class MatchTable {
this.matchTable = new HashMap<TableKey, List>();
}
public void addEntry(HostGame newEntry) {
public void addEntry(String ip, int port, HostGame newEntry) {
//create a key from the ip and port
TableKey entryKey = new TableKey( newEntry.getIp(), newEntry.getPort());
TableKey entryKey = new TableKey(ip, port);
//get the rest of the entry and use it as the value
List entryItems = new ArrayList();
@@ -55,7 +55,7 @@ public class NetworkInterface {
try{
newKnownGame = (HostGame) decoder.decode(messageDecoder.getMessageBody());
this.matchTable.addEntry(newKnownGame);
this.matchTable.addEntry(receivePacket.getAddress().getHostAddress(), receivePacket.getPort(), newKnownGame);
System.out.println(matchTable);
}catch (InvalidMessageException e){