Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.07.23;
Скачать: CL | DM;

Вниз

Метод OnExecute в Indy10   Найти похожие ветки 

 
Derr   (2006-03-17 11:12) [0]

есть маленькая проблема.... при присоединении клиента к серверу вначале на стороне сервера  вызывается OnConnect
после ентого OnExecute....  в этом методе я пытаюсь что то считать..
но когда я делаю сервер не активным... у меня происходит ошибка.... и сервак повисает... в Indy других версийй все было нормально... а тут ......

Код метода:
procedure TTCPServerClass._OnExecute(aThread: TIdContext);
var
aBuffer: TBytes;
aQ:      RQuery;
aR:      RReply;
begin

 try
   aThread.Connection.IOHandler.ReadBytes(aBuffer, SizeOf(aQ), False);
 except
   on E: Exception do
   begin
     MessageController.SendMessage(CONST_ARRAY_ERR[6,0] + CONST_ARRAY_ERR[6,1] + ": " + E.Message ,tmcErrMess);
     Exit;
   end;
 end;
 BytesToRaw(aBuffer, aQ, SizeOf(aQ));
 case aQ.QueryType of
   tqtSendToHost:
   begin
   end;
   tqtNewFile:
   begin
     NewFile(AThread, aQ);
   end;
   else begin
   end;
 end;

end;


 
Eraser ©   (2006-03-17 12:42) [1]


> Derr   (17.03.06 11:12)

так и должно быть! см. исходники Indy

procedure TIdCustomTCPServer.TerminateAllThreads;
var
 i: Integer;
begin
 // TODO:  reimplement support for TerminateWaitTimeout

 //BGO: find out why TerminateAllThreads is sometimes called multiple times
 //Kudzu: Its because of notifications. It calls shutdown when the Scheduler is
 // set to nil and then again on destroy.
 if Contexts <> nil then begin
   with Contexts.LockList do try
     for i := 0 to Count - 1 do begin
       // Dont call disconnect with true. Otherwise it frees the IOHandler and the thread
       // is still running which often causes AVs and other.
       TIdContext(Items[i]).Connection.Disconnect(False);
     end;
   finally Contexts.UnLockList; end;
 end;

 // Scheduler may be nil during destroy which calls TerminateAllThreads
 // This happens with explicit schedulers
 if Scheduler <> nil then begin
   Scheduler.TerminateAllYarns;
 end;
end;



Страницы: 1 вся ветка

Текущий архив: 2006.07.23;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.029 c
15-1151231537
@BraIN
2006-06-25 14:32
2006.07.23
Windows Vista Product Key


6-1142431139
RzCoDer
2006-03-15 16:58
2006.07.23
Перехват пакетов


2-1151994656
PRT
2006-07-04 10:30
2006.07.23
разрешение экрана


15-1150734006
Ketmar
2006-06-19 20:20
2006.07.23
профессиональная деформация...


2-1151913237
K_Lock
2006-07-03 11:53
2006.07.23
Сортировка в обратном порядке