@@ -31,7 +31,7 @@ interface
31
31
// Sockets,
32
32
ssl_openssl,
33
33
BClasses,
34
- syncobjs;
34
+ syncobjs;
35
35
36
36
type
37
37
TCustomServer = class ;
@@ -41,24 +41,24 @@ TCustomConnection = class;
41
41
TTCPCustomConnectionSocket = class (TTCPBlockSocket)
42
42
43
43
protected
44
- fConnection : TCustomConnection;
45
- fCurrentStatusReason : THookSocketReason;
46
- fCurrentStatusValue : string;
47
- fOnSyncStatus : THookSocketStatus;
44
+ fConnection : TCustomConnection;
45
+ fCurrentStatusReason : THookSocketReason;
46
+ fCurrentStatusValue : string;
47
+ fOnSyncStatus : THookSocketStatus;
48
48
49
- procedure DoOnStatus (Sender: TObject; Reason: THookSocketReason; const Value : String);
50
- procedure SyncOnStatus ;
49
+ procedure DoOnStatus (Sender: TObject; Reason: THookSocketReason; const Value : String);
50
+ procedure SyncOnStatus ;
51
51
52
52
public
53
- constructor Create;
53
+ constructor Create;
54
54
55
- destructor Destroy; override;
55
+ destructor Destroy; override;
56
56
57
57
{ :Owner (@link(TCustomConnection))}
58
- property Connection: TCustomConnection read fConnection;
58
+ property Connection: TCustomConnection read fConnection;
59
59
60
60
{ :Socket status event (synchronized to main thread)}
61
- property OnSyncStatus: THookSocketStatus read fOnSyncStatus write fOnSyncStatus;
61
+ property OnSyncStatus: THookSocketStatus read fOnSyncStatus write fOnSyncStatus;
62
62
end ;
63
63
64
64
@@ -75,50 +75,50 @@ TCustomConnection = class(TBThread)
75
75
private
76
76
77
77
protected
78
- fIndex : integer;
79
- fParent : TCustomServer;
80
- fSocket : TTCPCustomConnectionSocket;
81
- fSSL : boolean;
82
- procedure AfterConnectionExecute ; virtual ;
83
- function BeforeExecuteConnection : boolean; virtual ;
84
- procedure ExecuteConnection ; virtual ;
85
- function GetIsTerminated : boolean;
78
+ fIndex : integer;
79
+ fParent : TCustomServer;
80
+ fSocket : TTCPCustomConnectionSocket;
81
+ fSSL : boolean;
82
+ procedure AfterConnectionExecute ; virtual ;
83
+ function BeforeExecuteConnection : boolean; virtual ;
84
+ procedure ExecuteConnection ; virtual ;
85
+ function GetIsTerminated : boolean;
86
86
87
87
public
88
- constructor Create(aSocket: TTCPCustomConnectionSocket); virtual ;
89
- destructor Destroy; override;
88
+ constructor Create(aSocket: TTCPCustomConnectionSocket); virtual ;
89
+ destructor Destroy; override;
90
90
91
91
{ :Thread execute method}
92
- procedure Execute ; override;
92
+ procedure Execute ; override;
93
93
94
94
{ :Thread resume method}
95
- procedure Start ;
95
+ procedure Start ;
96
96
{ :Thread suspend method}
97
- procedure Stop ;
97
+ procedure Stop ;
98
98
99
99
{ :Temination procedure
100
100
One should call this procedure to terminate thread,
101
101
it internally calls Terminate, but can be overloaded,
102
102
and can be used for clean um }
103
- procedure TerminateThread ; virtual ;
103
+ procedure TerminateThread ; virtual ;
104
104
105
105
{ :@Connection index.
106
106
Automatically generated. }
107
- property Index: integer read fIndex;
107
+ property Index: integer read fIndex;
108
108
109
109
{ :@True if thread is not terminated and @link(Socket) exists}
110
- property IsTerminated: boolean read GetIsTerminated;
110
+ property IsTerminated: boolean read GetIsTerminated;
111
111
112
112
{ :@Connection parent
113
113
If client connection, this property is always nil, if server
114
114
connection, this property is @link(TCustomServer) that created this connection }
115
- property Parent: TCustomServer read fParent;
115
+ property Parent: TCustomServer read fParent;
116
116
117
117
{ :@Connection socket}
118
- property Socket: TTCPCustomConnectionSocket read fSocket;
118
+ property Socket: TTCPCustomConnectionSocket read fSocket;
119
119
120
120
{ :Whether SSL is used}
121
- property SSL: boolean read fSSL write fSSL;
121
+ property SSL: boolean read fSSL write fSSL;
122
122
end ;
123
123
124
124
@@ -243,7 +243,7 @@ TCustomServer = class(TBThread)
243
243
This method should be called instead of Terminate to terminate thread,
244
244
it internally calls Terminate, but can be overloaded,
245
245
and can be used for data clean up
246
- }
246
+ }
247
247
procedure TerminateThread ; virtual ;
248
248
249
249
@@ -704,7 +704,7 @@ procedure TTCPCustomConnectionSocket.DoOnStatus(Sender: TObject; Reason: THookSo
704
704
fCurrentStatusReason := Reason;
705
705
fCurrentStatusValue := value ;
706
706
fConnection.Synchronize(SyncOnStatus);
707
-
707
+
708
708
{
709
709
if (fCurrentStatusReason = HR_Error) and (LastError = WSAECONNRESET) then
710
710
fConnection.Terminate;
@@ -744,7 +744,7 @@ destructor TCustomConnection.Destroy;
744
744
fSocket.OnStatus := nil ;
745
745
fSocket.Free;
746
746
end ;
747
-
747
+
748
748
inherited Destroy;
749
749
end ;
750
750
@@ -774,7 +774,7 @@ procedure TCustomConnection.Stop;
774
774
procedure TCustomConnection.TerminateThread ;
775
775
begin
776
776
if (terminated) then exit;
777
-
777
+
778
778
Socket.OnSyncStatus := nil ;
779
779
Socket.OnStatus := nil ;
780
780
Terminate;
0 commit comments