dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit b7238dc2aa4d77de5c221a9102858041cce6761b
parent e9167b2dcf7d8e6e37c38e8c7640d63fd98cbba9
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 18 Dec 2023 04:46:17 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -109,10 +109,9 @@ type SeatedPlayer struct { LastActionTS time.Time } -func (p *SeatedPlayer) GetCash() database.PokerChip { - p.Cash.RLock() - defer p.Cash.RUnlock() - return *p.Cash.Val() +func (p *SeatedPlayer) GetCash() (out database.PokerChip) { + p.Cash.RWith(func(v *database.PokerChip) { out = *v }) + return } // Return either or not a player is eligible to play a game @@ -131,10 +130,9 @@ type PokerPlayer struct { countChancesToAction int } -func (p *PokerPlayer) GetBet() database.PokerChip { - p.Bet.RLock() - defer p.Bet.RUnlock() - return *p.Bet.Val() +func (p *PokerPlayer) GetBet() (out database.PokerChip) { + p.Bet.RWith(func(v *database.PokerChip) { out = *v }) + return } func (p *PokerPlayer) isAllIn() bool {