From: Hendrik B. <nh...@us...> - 2010-02-22 18:09:39
|
Update of /cvsroot/arianne/marauroa/src/marauroa/server/game/container In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20752/src/marauroa/server/game/container Modified Files: PlayerEntry.java Log Message: limit number of parallel connections Index: PlayerEntry.java =================================================================== RCS file: /cvsroot/arianne/marauroa/src/marauroa/server/game/container/PlayerEntry.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** PlayerEntry.java 8 Feb 2010 21:44:54 -0000 1.44 --- PlayerEntry.java 22 Feb 2010 18:09:30 -0000 1.45 *************** *** 134,137 **** --- 134,153 ---- /** + * counts the number of connections from this ip-address + * + * @param playerContainer PlayerEntryContainer + * @return number of active connections + */ + public int countConnectionsFromSameIPAddress(PlayerEntryContainer playerContainer) { + int counter = 0; + for (PlayerEntry playerEntry : playerContainer) { + if (playerEntry.getAddress().getHostAddress().equals(address.getHostAddress())) { + counter++; + } + } + return counter; + } + + /** * Returns true if an account is temporally blocked due to too many * tries on the defined time frame. |