Forwarding this to the list, since it seems to have been ignored.
---------- Forwarded message ----------
From: Johan Euphrosine <[EMAIL PROTECTED]>
Date: Thu, Jul 31, 2008 at 9:25 PM
Subject: poker-network pokertable getPlayerInfo bug
To: Pokersource Users <[email protected]>
Hi,
When testing jpoker tourney reconnection, I came across the following
server bug:
http://pastebin.com/f66c242a6
Later on irc://#pokersource Loic advised the following:
(05:12:15 PM) dachary: if self.serial2client.has_key(serial) and
self.serial2client[serial].user.isLogged():
(05:12:25 PM) dachary: this is a fix for the following bug
(05:12:31 PM) dachary: 1) a user joins a table
(05:12:35 PM) dachary: 2) the hand starts
(05:12:38 PM) dachary: 3) the user logs out
(05:12:52 PM) dachary: 4) another player joins the table
(05:14:40 PM) dachary: 5) getPlayerInfo is called on pokeravatar for
the player that has been logged out because the hand is not over and
returns an error
(05:15:11 PM) dachary: The fix instructs the getPlayerInfo at the
table level to query the database for user information when the player
is not logged in instead of relying on obsolete in core information
I believe the attached patch reproduce and correct the issue, while
following Loic's guidelines.
--
bou ^
--
bou ^
Index: pokernetwork/pokertable.py
===================================================================
--- pokernetwork/pokertable.py (revision 4180)
+++ pokernetwork/pokertable.py (working copy)
@@ -134,7 +134,7 @@
return name
def getPlayerInfo(self, serial):
- if self.serial2client.has_key(serial):
+ if self.serial2client.has_key(serial) and self.serial2client[serial].user.isLogged():
info = self.serial2client[serial].getPlayerInfo()
else:
info = self.factory.getPlayerInfo(serial)
Index: tests/test-pokeravatar.py.in
===================================================================
--- tests/test-pokeravatar.py.in (revision 4180)
+++ tests/test-pokeravatar.py.in (working copy)
@@ -2809,9 +2809,36 @@
d.addCallback(self.tourneyManager, 0, 1)
return d
# ------------------------------------------------------------------------
+ def test67_getPlayerInfoBug(self):
+ d = self.client_factory[0].established_deferred
+ d.addCallback(self.setupCallbackChain)
+ d.addCallback(self.sendRolePlay)
+ d.addCallback(self.login, 0)
+ d.addCallback(self.joinTable, 0, 101, 'Table2', '2-4-limit')
+ d.addCallback(self.seatTable, 0, 101)
+ d.addCallback(self.buyInTable, 0, 101, 1000)
+ d.addCallback(self.autoBlindAnte, 0, 101)
+
+ d2 = self.client_factory[1].established_deferred
+ d2.addCallback(self.setupCallbackChain)
+ d2.addCallback(self.sendRolePlay)
+ d2.addCallback(self.login, 1)
+ d2.addCallback(self.joinTable, 1, 101, 'Table2', '2-4-limit')
+ d2.addCallback(self.seatTable, 1, 101)
+ d2.addCallback(self.buyInTable, 1, 101, 1000)
+ d2.addCallback(self.autoBlindAnte, 1, 101)
+
+ def logout(x):
+ avatar = self.service.avatars[0]
+ avatar.logout()
+ avatar.join(avatar.tables[101])
+ d2.addCallback(logout)
+
+ return defer.DeferredList((d, d2))
+ # ------------------------------------------------------------------------
def Run():
loader = runner.TestLoader()
-# loader.methodPrefix = "test66"
+# loader.methodPrefix = "test67"
suite = loader.suiteFactory()
suite.addTest(loader.loadClass(PokerAvatarTestCase))
return runner.TrialRunner(
_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users