Changeset 96 for trunk/Packages/CoolWeb


Ignore:
Timestamp:
Oct 2, 2012, 9:22:02 AM (12 years ago)
Author:
chronos
Message:
  • Opraveno: Neuvolňovaly se správně registrované stránky.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        55backup
        66ZdechovNET.lps
         7heaptrclog.trc
  • trunk/Packages/CoolWeb/CoolWeb.lpk

    r84 r96  
    99      <SearchPaths>
    1010        <IncludeFiles Value="WebServer"/>
    11         <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common;/usr/lib/mysql/;/usr/lib64/mysql/"/>
     11        <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common;/usr/lib/mysql;/usr/lib64/mysql"/>
    1212        <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    1313      </SearchPaths>
     
    145145      <Version Value="2"/>
    146146    </PublishOptions>
     147    <CustomOptions Items="ExternHelp" Version="2">
     148      <_ExternHelp Items="Count"/>
     149    </CustomOptions>
    147150  </Package>
    148151</CONFIG>
  • trunk/Packages/CoolWeb/Network/UTCPServer.pas

    r84 r96  
    2121
    2222  TTCPClientThread = class(TResetableThread)
     23    Id: Integer;
    2324    Parent: TTCPServer;
    2425    Socket: TTCPBlockSocket;
     
    5556    FActive: Boolean;
    5657    AcceptThread: TAcceptThread;
     58    NewId: Integer;
    5759    procedure SetActive(const AValue: Boolean);
    5860  public
     
    9496      AcceptThread.Terminate;
    9597      AcceptThread.WaitFor;
    96       AcceptThread.Destroy;
     98      FreeAndNil(AcceptThread);
    9799      ThreadPool.Active := False;
    98100      CloseSocket;
     
    115117destructor TTCPServer.Destroy;
    116118begin
    117   ThreadPool.Destroy;
    118119  Active := False;
    119   Socket.Destroy;
    120   inherited Destroy;
     120  FreeAndNil(ThreadPool);
     121  FreeAndNil(Socket);
     122  inherited;
    121123end;
    122124
     
    136138        NewObject.Socket.Socket := NewSocket;
    137139        NewObject.Start;
     140        NewObject.Id := Parent.NewId;
     141        Inc(Parent.NewId);
    138142      end;
    139143    end;
     
    160164destructor TTCPClientThread.Destroy;
    161165begin
    162   Socket.Destroy;
     166  FreeAndNil(Socket);
    163167  inherited;
    164168end;
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r84 r96  
    77uses
    88  Classes, SysUtils, UTCPServer, UCommon, UMemoryStreamEx, UMIMEType,
    9   Synautil, SpecializedList, SpecializedDictionary;
     9  Synautil, SpecializedList, SpecializedDictionary, Syncobjs;
    1010
    1111type
     
    102102    procedure SetShowExceptions(const AValue: Boolean);
    103103  public
     104    Lock: TCriticalSection;
    104105    procedure Run; virtual;
    105106    procedure ErrorResponse(HandlerData: THTTPHandlerData);
     
    228229begin
    229230  inherited;
     231  Lock := TCriticalSection.Create;
    230232  ShowExceptions := False;
    231233  DocumentRoot := './';
     
    234236destructor THTTPServer.Destroy;
    235237begin
    236   inherited Destroy;
     238  FreeAndNil(Lock);
     239  inherited;
    237240end;
    238241
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas

    r84 r96  
    4444begin
    4545  with TTCPClientThread(Sender), Socket do begin
    46     WriteLn('Used thrads ' + IntToStr(Parent.ThreadPool.UsedCount) + '. Client connected from ' + GetRemoteSinIP);
     46    WriteLn('Thread ' + IntToStr(Id) + ' from ' + IntToStr(Parent.ThreadPool.UsedCount) + '. Client connected from ' + GetRemoteSinIP);
    4747
    4848    HandlerData := THTTPHandlerData.Create;
     
    5858        repeat
    5959          Line := RecvString(10000);
     60          WriteLn(IntToStr(Id) + ' ' + Line);
    6061          if (LineIndex = 0) then begin
    6162            LineParts.Explode(Line, ' ', StrToStr);
     
    115116      // Send headers
    116117      for I := 0 to Headers.Count - 1 do begin
    117         WriteLn(Headers.Keys[I] + ': ' + Headers.Items[I].Value + #13#10);
     118        //WriteLn(Headers.Keys[I] + ': ' + Headers.Items[I].Value + #13#10);
    118119        SendString(Headers.Keys[I] + ': ' + Headers.Items[I].Value + #13#10);
    119120      end;
  • trunk/Packages/CoolWeb/WebServer/UWebApp.pas

    r91 r96  
    1212  THTTPServerType = (stCGI, stTCP, stTurboPower);
    1313
     14  { TRegistredPage }
     15
    1416  TRegistredPage = class
    1517    Name: string;
    1618    Page: TWebPage;
     19    destructor Destroy; override;
    1720  end;
    1821
     
    6568end;
    6669
     70{ TRegistredPage }
     71
     72destructor TRegistredPage.Destroy;
     73begin
     74  if Assigned(Page) then FreeAndNil(Page);
     75end;
     76
    6777
    6878{ TPageList }
Note: See TracChangeset for help on using the changeset viewer.