ishikota / PokerServer

Poker server using websocket
1 stars 0 forks source link

Cutout broadcast logic from PokerEngine #13

Closed ishikota closed 8 years ago

ishikota commented 8 years ago

https://github.com/ishikota/PokerServer/issues/12 への対応

問題

DBにGameStateを作ってる最中に,playerからのactionを受け付けて,game_stateにアクセスしてnilでエラー

対策

Channel側でGameStateの作成が完了してから,playerへask, notificationを送信することで,declare_actionでroom.game_stateがnilにならないようにする.

それに向けて,Dealerの中でゲームの進行に合わせて,messageをbroadcastしてたのを, dealerは送信すべきメッセージをまとめてchannelに返すようにして, channel側で送信を負担するように変更.

これによって,dealerからBroadcastのロジックが切り出せた.