summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC/Ivy.cs
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:56:04 +0000
committerfcolin2007-02-01 09:56:04 +0000
commit1fa2f9f37991fe3234abf11d98bc9fd129d77a80 (patch)
treebda301db59e62c7484f714813027936d10119c99 /CSharp/Ivy/IvyPPC/Ivy.cs
parentf329ea3ffe878d11ff4c5493ec8a7aa19fb3c697 (diff)
downloadivy-csharp-1fa2f9f37991fe3234abf11d98bc9fd129d77a80.zip
ivy-csharp-1fa2f9f37991fe3234abf11d98bc9fd129d77a80.tar.gz
ivy-csharp-1fa2f9f37991fe3234abf11d98bc9fd129d77a80.tar.bz2
ivy-csharp-1fa2f9f37991fe3234abf11d98bc9fd129d77a80.tar.xz
Utilisateur : Fcolin Date : 20/04/06 Heure : 13:15 Archivé dans $/CSharp/Ivy/Ivy Commentaire: filtrage classes (vss 64)
Diffstat (limited to 'CSharp/Ivy/IvyPPC/Ivy.cs')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs34
1 files changed, 23 insertions, 11 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 17a388e..e0573e4 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -44,6 +44,7 @@ namespace IvyBus
public delegate ApplicationExit DieHandler(IvyClient app, int id, string arg);
public delegate void ClientAddBindingHandler(IvyClient app, string arg);
public delegate void ClientRemoveBindingHandler(IvyClient app, string arg);
+ public delegate void ClientFilterBindingHandler(IvyClient app, string arg);
public delegate void ErrorMessageHandler(IvyClient app, int id, string arg);
public delegate void MessageHandler(IvyClient app, string[] args);
@@ -66,6 +67,8 @@ namespace IvyBus
public event ClientAddBindingHandler BindingAdd;
/// <summary>fires when a client receive a remove binding from another client</summary>
public event ClientRemoveBindingHandler BindingRemove;
+ /// <summary>fires when a client receive a binding from another clientand it as been filtered </summary>
+ public event ClientRemoveBindingHandler BindingFilter;
/// <summary>fires when a client receive a remove binding from another client</summary>
public event ErrorMessageHandler ErrorMessage;
@@ -281,8 +284,8 @@ namespace IvyBus
/// the domain for the UDP rendez vous
private static readonly string DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT;
internal int protocolVersion = 3;
- private static bool debug = false;
- private static ushort serial = 0; /* an unique ID for each regexp */
+ private static bool debug; // false by deflaut runtime
+ private static ushort serial; /* an unique ID for each regexp */ // 0 by default runtime
private MyTcpListener app;
private List<IvyWatcher> watchers;
private volatile Thread serverThread; // to ensure quick communication of the end
@@ -308,7 +311,7 @@ namespace IvyBus
private string ready_message = null;
private CultureInfo culture = new CultureInfo("en-us");
// for synchronous event
- private Control syncControl = null;
+ private Control syncControl; // null by runtime default
public Ivy()
@@ -759,7 +762,7 @@ namespace IvyBus
if (DirectMessageReceived != null)
{
if (IsSynchronous())
- syncControl.Invoke(DirectMessageReceived, new object[] { clnt, id, arg });
+ syncControl.Invoke(DirectMessageReceived, clnt, id, arg );
else DirectMessageReceived(clnt, id, arg);
}
}
@@ -768,7 +771,7 @@ namespace IvyBus
if (ClientConnected != null)
{
if (IsSynchronous())
- syncControl.Invoke(ClientConnected, new object[] { clnt });
+ syncControl.Invoke(ClientConnected, clnt );
else ClientConnected(clnt);
}
@@ -780,7 +783,7 @@ namespace IvyBus
try
{
if (IsSynchronous())
- syncControl.Invoke(ClientDisconnected, new object[] { clnt });
+ syncControl.Invoke(ClientDisconnected, clnt );
else ClientDisconnected(clnt);
}
catch (ObjectDisposedException )
@@ -794,7 +797,7 @@ namespace IvyBus
if (BindingAdd != null)
{
if (IsSynchronous())
- syncControl.Invoke(BindingAdd, new object[] { clnt, regexp });
+ syncControl.Invoke(BindingAdd, clnt, regexp );
else BindingAdd(clnt, regexp);
}
}
@@ -803,16 +806,25 @@ namespace IvyBus
if (BindingRemove != null)
{
if (IsSynchronous())
- syncControl.Invoke(BindingRemove, new object[] { clnt, regexp });
+ syncControl.Invoke(BindingRemove, clnt, regexp );
else BindingRemove(clnt, regexp);
}
}
+ internal void FireClientFilterBinding(IvyClient clnt, string regexp)
+ {
+ if (BindingFilter != null)
+ {
+ if (IsSynchronous())
+ syncControl.Invoke(BindingFilter, clnt, regexp);
+ else BindingFilter(clnt, regexp);
+ }
+ }
internal ApplicationExit FireDie(IvyClient clnt, int id, string arg)
{
if (dieReceived != null)
{
if (IsSynchronous())
- return (ApplicationExit)syncControl.Invoke(dieReceived, new object[] { clnt, id, arg });
+ return (ApplicationExit)syncControl.Invoke(dieReceived, clnt, id, arg );
else return dieReceived(clnt, id, arg);
}
return ApplicationExit.FORCE_EXIT;
@@ -822,7 +834,7 @@ namespace IvyBus
if (ErrorMessage != null)
{
if (IsSynchronous())
- syncControl.Invoke(ErrorMessage, new object[] { clnt, id, arg });
+ syncControl.Invoke(ErrorMessage, clnt, id, arg );
else ErrorMessage(clnt, id, arg);
}
}
@@ -880,7 +892,7 @@ namespace IvyBus
throw new IvyException("(callCallback) Not regexp matching id " + key);
}
if (IsSynchronous())
- syncControl.Invoke(bind.callback, new object[] { client, arg });
+ syncControl.Invoke(bind.callback, client, arg );
else bind.callback(client, arg);
}