|
@@ -119,10 +119,13 @@ type
|
|
Private
|
|
Private
|
|
procedure SetActive(const AValue: Boolean);
|
|
procedure SetActive(const AValue: Boolean);
|
|
procedure SetServerID(const AValue: String);
|
|
procedure SetServerID(const AValue: String);
|
|
|
|
+ procedure SetSystemGlobal(const AValue: Boolean);
|
|
Protected
|
|
Protected
|
|
FBusy: Boolean;
|
|
FBusy: Boolean;
|
|
FActive : Boolean;
|
|
FActive : Boolean;
|
|
|
|
+ FSystemGlobal : Boolean;
|
|
FServerID : String;
|
|
FServerID : String;
|
|
|
|
+ procedure CheckServerID(aValue : string);
|
|
procedure PrepareServerID;
|
|
procedure PrepareServerID;
|
|
Procedure DoError(const Msg: String; const Args: array of const);
|
|
Procedure DoError(const Msg: String; const Args: array of const);
|
|
Procedure CheckInactive;
|
|
Procedure CheckInactive;
|
|
@@ -133,6 +136,7 @@ type
|
|
Property Busy : Boolean Read FBusy;
|
|
Property Busy : Boolean Read FBusy;
|
|
Published
|
|
Published
|
|
Property Active : Boolean Read FActive Write SetActive;
|
|
Property Active : Boolean Read FActive Write SetActive;
|
|
|
|
+ Property SystemGlobal : Boolean Read FSystemGlobal Write SetSystemGlobal;
|
|
Property ServerID : String Read FServerID Write SetServerID;
|
|
Property ServerID : String Read FServerID Write SetServerID;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -147,6 +151,7 @@ type
|
|
DefaultMaxAction = ipcmoaNone;
|
|
DefaultMaxAction = ipcmoaNone;
|
|
DefaultMaxQueue = 0;
|
|
DefaultMaxQueue = 0;
|
|
private
|
|
private
|
|
|
|
+ FGlobal: Boolean;
|
|
FOnMessageError: TMessageQueueEvent;
|
|
FOnMessageError: TMessageQueueEvent;
|
|
FOnMessageQueued: TNotifyEvent;
|
|
FOnMessageQueued: TNotifyEvent;
|
|
FOnMessage: TNotifyEvent;
|
|
FOnMessage: TNotifyEvent;
|
|
@@ -154,7 +159,6 @@ type
|
|
FQueue: TIPCServerMsgQueue;
|
|
FQueue: TIPCServerMsgQueue;
|
|
FQueueLock: TCriticalSection;
|
|
FQueueLock: TCriticalSection;
|
|
FQueueAddEvent: TSimpleEvent;
|
|
FQueueAddEvent: TSimpleEvent;
|
|
- FGlobal: Boolean;
|
|
|
|
// Access to the message is not locked by design!
|
|
// Access to the message is not locked by design!
|
|
// In the threaded mode, it must be accessed only during event callbacks.
|
|
// In the threaded mode, it must be accessed only during event callbacks.
|
|
FMessage: TIPCServerMsg;
|
|
FMessage: TIPCServerMsg;
|
|
@@ -178,10 +182,10 @@ type
|
|
function GetMaxAction: TIPCMessageOverflowAction;
|
|
function GetMaxAction: TIPCMessageOverflowAction;
|
|
function GetMaxQueue: Integer;
|
|
function GetMaxQueue: Integer;
|
|
function GetStringMessage: String;
|
|
function GetStringMessage: String;
|
|
- procedure SetGlobal(const AValue: Boolean);
|
|
|
|
procedure SetMaxAction(AValue: TIPCMessageOverflowAction);
|
|
procedure SetMaxAction(AValue: TIPCMessageOverflowAction);
|
|
procedure SetMaxQueue(AValue: Integer);
|
|
procedure SetMaxQueue(AValue: Integer);
|
|
procedure SetThreaded(AValue: Boolean);
|
|
procedure SetThreaded(AValue: Boolean);
|
|
|
|
+ procedure SetGlobal(AValue: Boolean);
|
|
procedure SetThreadTimeout(AValue: Integer);
|
|
procedure SetThreadTimeout(AValue: Integer);
|
|
procedure SetSynchronizeEvents(AValue: Boolean);
|
|
procedure SetSynchronizeEvents(AValue: Boolean);
|
|
function WaitForReady(Timeout: Integer = -1): Boolean;
|
|
function WaitForReady(Timeout: Integer = -1): Boolean;
|
|
@@ -218,7 +222,7 @@ type
|
|
property ThreadExecuting: Boolean read FThreadExecuting;
|
|
property ThreadExecuting: Boolean read FThreadExecuting;
|
|
property ThreadError: String read FThreadError;
|
|
property ThreadError: String read FThreadError;
|
|
Published
|
|
Published
|
|
- Property Global : Boolean Read FGlobal Write SetGlobal;
|
|
|
|
|
|
+ Property Global : Boolean Read FGlobal write SetGlobal default false;
|
|
// Called during ReadMessage
|
|
// Called during ReadMessage
|
|
Property OnMessage : TNotifyEvent Read FOnMessage Write FOnMessage;
|
|
Property OnMessage : TNotifyEvent Read FOnMessage Write FOnMessage;
|
|
// Called when a message is pushed on the queue.
|
|
// Called when a message is pushed on the queue.
|
|
@@ -276,6 +280,7 @@ type
|
|
Procedure SendStringMessage(MsgType : TMessageType; const Msg : String);
|
|
Procedure SendStringMessage(MsgType : TMessageType; const Msg : String);
|
|
Procedure SendStringMessageFmt(const Msg : String; Args : Array of const);
|
|
Procedure SendStringMessageFmt(const Msg : String; Args : Array of const);
|
|
Procedure SendStringMessageFmt(MsgType : TMessageType; const Msg : String; Args : Array of const);
|
|
Procedure SendStringMessageFmt(MsgType : TMessageType; const Msg : String; Args : Array of const);
|
|
|
|
+ published
|
|
Property ServerInstance : String Read FServerInstance Write SetServerInstance;
|
|
Property ServerInstance : String Read FServerInstance Write SetServerInstance;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -539,7 +544,7 @@ end;
|
|
|
|
|
|
{$REGION 'TSimpleIPC'}
|
|
{$REGION 'TSimpleIPC'}
|
|
|
|
|
|
-Procedure TSimpleIPC.DoError(const Msg: String; const Args: array of const);
|
|
|
|
|
|
+procedure TSimpleIPC.DoError(const Msg: String; const Args: array of const);
|
|
var
|
|
var
|
|
FullMsg: String;
|
|
FullMsg: String;
|
|
begin
|
|
begin
|
|
@@ -583,6 +588,7 @@ begin
|
|
if (FServerID<>AValue) then
|
|
if (FServerID<>AValue) then
|
|
begin
|
|
begin
|
|
CheckInactive;
|
|
CheckInactive;
|
|
|
|
+ CheckServerID(aValue);
|
|
FServerID:=AValue;
|
|
FServerID:=AValue;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -608,6 +614,21 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TSimpleIPC.SetSystemGlobal(const AValue: Boolean);
|
|
|
|
+begin
|
|
|
|
+ CheckInactive;
|
|
|
|
+ FSystemGlobal:=AValue;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TSimpleIPC.CheckServerID(aValue: string);
|
|
|
|
+var
|
|
|
|
+ OK : Boolean;
|
|
|
|
+begin
|
|
|
|
+ OK:=(Pos('\',aValue)=0) and (Pos('/',aValue)=0) and (Pos(':',aValue)=0);
|
|
|
|
+ if not OK then
|
|
|
|
+ Raise EIPCError.Create('Characters / \ and : not allowed in server ID');
|
|
|
|
+end;
|
|
|
|
+
|
|
{$ENDREGION}
|
|
{$ENDREGION}
|
|
|
|
|
|
{$REGION 'TIPCServerThread'}
|
|
{$REGION 'TIPCServerThread'}
|
|
@@ -681,16 +702,17 @@ begin
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TSimpleIPCServer.SetGlobal(const AValue: Boolean);
|
|
|
|
|
|
+
|
|
|
|
+procedure TSimpleIPCServer.SetThreaded(AValue: Boolean);
|
|
begin
|
|
begin
|
|
CheckInactive;
|
|
CheckInactive;
|
|
- FGlobal:=AValue;
|
|
|
|
|
|
+ FThreaded:=AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TSimpleIPCServer.SetThreaded(AValue: Boolean);
|
|
|
|
|
|
+procedure TSimpleIPCServer.SetGlobal(AValue: Boolean);
|
|
begin
|
|
begin
|
|
CheckInactive;
|
|
CheckInactive;
|
|
- FThreaded:=AValue;
|
|
|
|
|
|
+ FGlobal:=AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TSimpleIPCServer.SetThreadTimeout(AValue: Integer);
|
|
procedure TSimpleIPCServer.SetThreadTimeout(AValue: Integer);
|