我有一个带有 TIdCmdTcpClient 和命令处理程序的应用程序。
发生的情况是,有时如果从服务器(C 外部应用程序)连续调用相同的命令处理程序(相同的 cmd),命令处理程序事件不会触发,即使我可以在日志中看到 cmd 已正确到达。命令以 LF 结尾。
我在命令处理程序事件中放置了一个断点,它实际上并没有在它应该停止的时候停止。cmd 实际上在日志中(TIdLogEvent)。这是随机发生的。
这个问题有什么线索吗?
使用带有 Indy 组件的 XE2。
命令处理程序的定义:
procedure TdmConn.tcpChannelCommandHandlers9Command(ASender: TIdCommand) { TR };
var
Idx, Slot: Integer;
TheTourn: TTourn;
begin
Slot := StrToInt(ASender.Params[0]);
Idx := TournBySlot(Slot);
if Idx > -1 then
TheTourn := TournList[Idx]
else
TheTourn := nil;
if ASender.Params[2] = 'info' then
begin
if ASender.Params[3] = 'rules' then
if Client.Accepted then
tcpChannel.IOHandler.Write('UPBAL ALL' + LF);
TSyncTRInfo.SyncTRInfo(TheTourn, ASender.Params.Text, frmLobby);
end;
if ASender.Params[2] = 'ok' then
begin
TSyncTROk.SyncTROk(TheTourn, ASender.Params.Text, frmLobby);
end;
if ASender.Params[2] = 'assign' then
begin
TSyncTR.SyncTR(TheTourn, ASender.Params.Text, frmLobby);
end;
if ASender.Params[2] = 'leave' then
begin
TSyncTR.SyncTR(TheTourn, ASender.Params.Text, frmLobby);
end;
end;
TIdSync 类的定义:
TSyncTR = class(TIdSync)
protected
FTourn: TTourn;
FParams: string;
Flobby: TfrmLobby;
procedure DoSynchronize; override;
public
constructor Create(ATourn: TTourn; AParams: string; Alobby: TfrmLobby); reintroduce;
class procedure SyncTR(ATourn: TTourn; AParams: string; Alobby: TfrmLobby);
end;
procedure TSyncTR.DoSynchronize;
var
I, Idx, RoomID, RoomSlot: Integer;
slParams: TStringList;
RoomForm: TfrmRoom;
begin
inherited;
slParams := TStringList.Create;
try
slParams.Text := FParams;
if slParams[2] = 'assign' then // TR 0 tournament assign table 3748 seat 0
begin
RoomID := StrToIntDef(FTourn.Rooms.Values[slParams[4]], -1);
CreateRoomItem(RoomID, '', '', '', '', FTourn);
Client.Seat := StrToInt(slParams[6]);
end;
if slParams[2] = 'leave' then // TR 0 tournament leave table 3654
begin
RoomID := StrToIntDef(FTourn.Rooms.Values[slParams[4]], -1);
if RoomID > -1 then
begin
Idx := RoomByID(RoomID);
if Idx > -1 then
begin
DelPlyr(Client.UserName, Client.Seat, RoomList.Items[Idx]);
RoomSlot := RoomList.Items[Idx].Slot;
dmConn.SendChannel('JOIN ' + IntToStr(RoomSlot) + ' poker ' + IntToStr(RoomID));
end
else // in case GSLOTFREED
begin
for I := 0 to Application.ComponentCount - 1 do // room item may have been freed
begin
if Application.Components[I] is TfrmRoom then
begin
RoomForm := TfrmRoom(Application.Components[I]);
if (RoomForm.RoomData.TournSlot = FTourn.Slot) then
begin
CreateRoomItem(RoomID, '', '', '', '', FTourn, RoomForm);
dmConn.SendChannel('JOIN ' + IntToStr(RoomForm.RoomData.Slot) + ' poker ' + IntToStr(RoomID));
end;
end;
end; { }
end;
end;
end;
finally
slParams.Free;
end;
end;
这是日志的一大块
Revd : 28/05/2013 11:32:24 GR 0 poker rejoin 77<LF>GR 0 poker rejoin 79<LF>GR 0 poker rejoin 80<LF>GR 0 poker rejoin 82<LF>GR 0 tournament rejoin 33406<LF>GR 0 tournament rejoin 103452<LF>GR 0 tournament rejoin 103453<LF>GR 0 tournament rejoin 103483<LF>GR 0 tournament rejoin 103490<LF>GR 0 tournament rejoin 103491<LF>CLIENTINFO screenname= levelname= stagename= levelnumber=0 userpoints=-1<LF>GR 0 tournament rejoin 33406<LF>GR 0 tournament rejoin 103452<LF>GR 0 tournament rejoin 103453<LF>GR 0 tournament rejoin 103483<LF>GR 0 tournament rejoin 103490<LF>GR 0 tournament rejoin 103491<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 0 33406<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 1 103452<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 2 103453<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 3 103483<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 4 103490<LF>
Sent : 28/05/2013 11:32:24 TOURNJOIN 5 103491<LF>
Revd : 28/05/2013 11:32:24 BALANCE FUN=38440 TRN=30000 USD=27388 PTS=4008560<LF>
Revd : 28/05/2013 11:32:25 GR 0 poker rejoin 77<LF>GR 0 poker rejoin 79<LF>GR 0 poker rejoin 80<LF>GR 0 poker rejoin 82<LF>TR 0 tournament ok rejoin 33406<LF>TR 0 tournament info stats players_registered=2 players_playing=2 tables_created=1 cur_time=1369733542 reg_open=1360188060 reg_close=1360274459 dereg_close=1360274459 start=1360274460 started=0<LF>TR 0 tournament info rules tournament=8 currency=USD buyin=25 fee=10 chips=100000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=10 min_players=8 reserved=0 reserved_left=0 can_register=0 type=GS max_bet=0 no_restrict=1 min_buyin=6000 deck=1 pot_limit=0 rake=0 timer=8 max_buyin=20000 start=5 min_player=2 mod_bet=1 ante=100 num_decks=1 min_bet=100 max_player=10 small_blind=50 big_blind=100<LF>TR 0 tournament info tourn_name test 10<LF>TR 0 tournament info tourn_desc test 10<LF>TR 0 tournament info game Texas Holdem<LF>TR 0 tournament info break next=0 interval=3600 length=300<LF>TR 0 tournament info table 1 id=335 seats=2 room=82<LF>TR 0 tournament info player table=335 seat=0 chips=100000 username=Willix position=0 winnings=0<LF>TR 0 tournament info player table=335 seat=9 chips=100000 username=josefm position=0 winnings=0<LF>TR 0 tournament info you registered=1 chips=100000 rebuys=0 addons=0<LF>TR 0 tournament info pot total=50 remaining=50<LF>TR 0 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 0 tournament
Revd : 28/05/2013 11:32:25 tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 0 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 0 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 0 tournament tourn expiry cur_round matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 0 tournament info prize total 0<LF>TR 0 tournament assign table 335 seat 0<LF>TRB 0 tournament player assign Willix table 335 seat 0<LF>TR 1 tournament ok rejoin 103452<LF>TR 1 tournament info stats players_registered=2 players_playing=2 tables_created=1 cur_time=1369733542 reg_open=1369643700 reg_close=1369730099 dereg_close=1369730099 start=1369730100 started=1369730100<LF>TR 1 tournament info rules tournament=2 currency=USD buyin=50 fee=10 chips=200000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=0 min_players=2 reserved=0 reserved_left=0 can_register=0 type=WM max_bet=0 no_restrict=1 min_buyin=12000 deck=1 pot_limit=0 rake=0 timer=8 max_buyin=40000 start=5 min_player=2 mod_bet=1 ante=200 num_decks=1 min_bet=200 max_player=10 small_blind=100 big_blind=200<LF>TR 1 tournament info tourn_name $0.60 NL Holdem<LF>TR 1 tournament info tourn_desc Only $0.60 to enter! 2.000 chip stack. Good luck!<LF>TR 1 tournament info game Texas Holdem<LF>TR 1 tournament info break next=158 interval=3600 length=300<LF>TR 1 tournament info table 1 id=3141 seats=2 room=80<LF>TR 1 tournament info player table=3141 seat=0 chips=213500 username=josefm position=0 winnings=0<LF>TR 1 tournament info player table=3141 seat=3 chips=186500 username=Willix position=0 winnings=0<LF>TR 1 tournament info you registered=1 chips=186500 rebuys=0 addons=0<LF>TR 1 tournament info pot total=100 remaining=100<LF>TR 1 tournament payout start<LF>TR 1 tournament payout entry start=1 end=1 cut=10000<LF>TR 1 tournament payout end<LF>TR 1 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 1 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 1 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 1 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 1 tournament tourn expiry cur_round matched=1 time=159 rounds=-1 hands=-1 players=-1<LF>TR 1 tournament info prize total 0<LF>TR 1 tournament assign table 3141 seat 3<LF>TRB 1 tournament player assign Willix table 3141 seat 3<LF>TR 2 tournament ok rejoin 103453<LF>TR 2 tournament info stats players_registered=2 players_playing=2 tables_created=1 cur_time=1369733542 reg_open=1369643700 reg_close=1369730099 dereg_close=1369730099 start=1369730100 started=1369730100<LF>TR 2 tournament info rules tournament=4 currency=USD buyin=100 fee=10 chips=100000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=0 min_players=2 reserved=0 reserved_left=0 can_register=0 type=WM max_bet=0 no_restrict=0 min_buyin=6000 deck=1 pot_limit=1 rake=1 timer=15 max_buyin=20000 hi_lo=0 start=5 min_player=2 mod_bet=1 ante=100 num_decks=1 min_bet=100 max_player=10 small_blind=50 big_blind=100<LF>TR 2 tournament info tourn_name $1.10 NL Omaha<LF>TR 2 tournament info tourn_desc Payouts are based on the number of entrants. Final payouts will be shown after registration closes<LF>TR 2 tournament info game Omaha<LF>TR 2 tournament info break next=158 interval=3600 length=300<LF>TR 2 tournament info table 1 id=3142 seats=2 room=79<LF>TR 2 tournament info player table=3142 seat=0 chips=108550 username=josefm position=0 winnings=0<LF>TR 2 tournament info player table=3142 seat=8 chips=91450 username=Willix position=0 winnings=0<LF>TR 2 tournament info you registered=1 chips=91450 rebuys=0 addons=0<LF>TR 2 tournament info pot total=200 remaining=200<LF>TR 2 tournament payout start<LF>TR 2 tournament payout entry start=1 end=1 cut=10000<LF>TR 2 tournament payout end<LF>TR 2 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 2 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 2 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 2 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 2 tournament tourn expiry cur_round matched=1 time=159 rounds=-1 hands=-1 players=-1<LF>TR 2 tournament info prize total 0<LF>TR 2 tournament assign table 3142 seat 8<LF>TRB 2 tournament player assign Willix table 3142 seat 8<LF>TR 3 tournament ok rejoin 103483<LF>TR 3 tournament info stats players_registered=5 players_playing=2 tables_created=1 cur_time=1369733542 reg_open=1369646100 reg_close=1369732499 dereg_close=1369732499 start=1369732500 started=1369732501<LF>TR 3 tournament info rules tournament=2 currency=USD buyin=50 fee=10 chips=200000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=0 min_players=2 reserved=0 reserved_left=0 can_register=0 type=WM max_bet=0 no_restrict=1 min_buyin=12000 deck=1 pot_limit=0 rake=0 timer=8 max_buyin=40000 start=5 min_player=2 mod_bet=1 ante=200 num_decks=1 min_bet=200 max_player=10 small_blind=100 big_blind=200<LF>TR 3 tournament info tourn_name $0.60 NL Holdem<LF>TR 3 tournament info tourn_desc Only $0.60 to enter! 2.000 chip stack. Good luck!<LF>TR 3 tournament info game Texas Holdem<LF>TR 3 tournament info break next=2559 interval=3600 length=300<LF>TR 3 tournament info table 1 id=3148 seats=2 room=77<LF>TR 3 tournament info player table=3148 seat=0 chips=804000 username=Willix position=0 winnings=0<LF>TR 3 tournament info player table=3148 seat=9 chips=196000 username=twoaces position=0 winnings=0<LF>TR 3 tournament info player table=0 seat=-1 chips=0 username=josefm position=5 winnings=0<LF>TR 3 tournament info player table=0 seat=-1 chips=0 username=josefm6 position=4 winnings=0<LF>TR 3 tournament info player table=0 seat=-1 chips=0 username=willifras12 position=3 winnings=0<LF>TR 3 tournament info you registered=1 chips=804000 rebuys=0 addons=0<LF>TR 3 tournament info pot total=250 remaining=250<LF>TR 3 tournament payout start<LF>TR 3 tournament payout entry start=1 end=1 cut=10000<LF>TR 3 tournament payout end<LF>TR 3 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 3 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 3 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 3 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 3 tournament tourn expiry cur_round matched=1 time=159 rounds=-1 hands=-1 players=-1<LF>TR 3 tournament info prize total 0<LF>TR 3 tournament assign table 3148 seat 0<LF>TRB 3 tournament player assign Willix table 3148 seat 0<LF>TR 4 tournament ok rejoin 103490<LF>TR 4 tournament info stats players_registered=9 players_playing=3 tables_created=1 cur_time=1369733542 reg_open=1369646701 reg_close=1369733100 dereg_close=1369733100 start=1369733101 started=1369733100<LF>TR 4 tournament info rules tournament=2 currency=USD buyin=50 fee=10 chips=200000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=0 min_players=2 reserved=0 reserved_left=0 can_register=0 type=WM max_bet=0 no_restrict=1 min_buyin=12000 deck=1 pot_limit=0 rake=0 timer=8 max_buyin=40000 start=5 min_player=2 mod_bet=1 ante=200 num_decks=1 min_bet=200 max_player=10 small_blind=100 big_blind=200<LF>TR 4 tournament info tourn_name $0.60 NL Holdem<LF>TR 4 tournament info tourn_desc Only $0.60 to enter! 2.000 chip stack. Good luck!<LF>TR 4 tournament info game Texas Holdem<LF>TR 4 tournament info break next=3158 interval=3600 length=300<LF>TR 4 tournament info table 1 id=3151 seats=3 room=76<LF>TR 4 tournament info player table=3151 seat=1 chips=298800 username=pokerqueen2 position=0 winnings=0<LF>TR 4 tournament info player table=3151 seat=5 chips=198700 username=josefm position=0 winnings=0<LF>TR 4 tournament info player table=3151 seat=8 chips=1302500 username=josefm6 position=0 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=willifras12 position=4 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=pokerwin position=5 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=rocococo position=8 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=azucar position=6 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=twoaces positio
Sent : 28/05/2013 11:32:25 TOURNINFO 103500<LF>
Sent : 28/05/2013 11:32:25 UPBAL ALL<LF>
Sent : 28/05/2013 11:32:25 JOIN 0 poker 82<LF>
Sent : 28/05/2013 11:32:25 CLIENT 0 canbuy<LF>
Revd : 28/05/2013 11:32:25 n=9 winnings=0<LF>TR 4 tournament info player table=0 seat=-1 chips=0 username=Willix position=7 winnings=0<LF>TR 4 tournament info you registered=1 chips=0 rebuys=0 addons=0<LF>TR 4 tournament info pot total=450 remaining=450<LF>TR 4 tournament payout start<LF>TR 4 tournament payout entry start=1 end=1 cut=10000<LF>TR 4 tournament payout end<LF>TR 4 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 4 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 4 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 4 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 4 tournament tourn expiry cur_round matched=1 time=158 rounds=-1 hands=-1 players=-1<LF>TR 4 tournament info prize total 0<LF>TR 5 tournament ok rejoin 103491<LF>TR 5 tournament info stats players_registered=9 players_playing=2 tables_created=1 cur_time=1369733542 reg_open=1369646521 reg_close=1369732920 dereg_close=1369732920 start=1369732921 started=1369732920<LF>TR 5 tournament info rules tournament=1 currency=USD buyin=25 fee=10 chips=100000 addon_cost=0 addon_chips=0 addon_count=0 rebuys=0 insurance=0 reserved=0 max_players=0 min_players=8 reserved=0 reserved_left=0 can_register=0 type=WM max_bet=0 no_restrict=1 min_buyin=6000 deck=1 pot_limit=0 rake=0 timer=8 max_buyin=20000 start=5 min_player=2 mod_bet=1 ante=100 num_decks=1 min_bet=100 max_player=10 small_blind=50 big_blind=100<LF>TR 5 tournament info tourn_name $0.35 NL Holdem<LF>TR 5 tournament info tourn_desc Only $0.35 to enter! 1.000 chip stack. Good luck!<LF>TR 5 tournament info game Texas Holdem<LF>TR 5 tournament info break next=2978 interval=3600 length=300<LF>TR 5 tournament info table 1 id=3150 seats=2 room=75<LF>TR 5 tournament info player table=3150 seat=0 chips=495500 username=pokerwin position=0 winnings=0<LF>TR 5 tournament info player table=3150 seat=7 chips=404500 username=josefm6 position=0 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=pokerqueen2 position=8 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=rocococo position=7 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=josefm position=4 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=azucar position=9 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=willifras12 position=6 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=twoaces position=3 winnings=0<LF>TR 5 tournament info player table=0 seat=-1 chips=0 username=Willix position=5 winnings=0<LF>TR 5 tournament info you registered=1 chips=0 rebuys=0 addons=0<LF>TR 5 tournament info pot total=225 remaining=225<LF>TR 5 tournament payout start<LF>TR 5 tournament payout entry start=1 end=1 cut=10000<LF>TR 5 tournament payout end<LF>TR 5 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 5 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 5 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 5 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TR 5 tournament tourn expiry cur_round matched=1 time=278 rounds=-1 hands=-1 players=-1<LF>TR 5 tournament info prize total 0<LF>TRB 5 tournament chips pokerwin 495200<LF>TRB 5 tournament chips josefm6 404800<LF>TRB 5 tournament tourn expiry late_reg matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TRB 5 tournament tourn expiry addon matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TRB 5 tournament tourn expiry rebuy matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TRB 5 tournament tourn expiry hand_wait matched=-1 time=-1 rounds=-1 hands=-1 players=-1<LF>TRB 5 tournament tourn expiry cur_round matched=1 time=278 rounds=-1 hands=-1 players=-1<LF>BALANCE FUN=38440 TRN=30000 USD=27388 PTS=4008560<LF>