当前位置: 首页>>代码示例>>C#>>正文


C# Edge.Subscribe方法代码示例

本文整理汇总了C#中Edge.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# Edge.Subscribe方法的具体用法?C# Edge.Subscribe怎么用?C# Edge.Subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Edge的用法示例。


在下文中一共展示了Edge.Subscribe方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ETClient

 public ETClient(Edge e)
 {
   _sync = new object();
   _sent_blocks = new Hashtable();
   _e = e;
   _e.Subscribe(this, null );
 }
开发者ID:twchoi,项目名称:tmp-brunet-deetoo,代码行数:7,代码来源:EdgeTester.cs

示例2: WrapperEdge

 ///<summary>Creates a new WrapperEdge.<summary>
 ///<param name="edge">The edge to wrap.</param>
 ///<param name="SubscribeToEdge">Should this subscribe to the edge.</param>
 public WrapperEdge(Edge edge, bool SubscribeToEdge) {
   _weclosed = 0;
   _edge = edge;
   if(SubscribeToEdge) {
     _edge.Subscribe(this, null);
   }
 }
开发者ID:kyungyonglee,项目名称:BrunetTutorial,代码行数:10,代码来源:WrapperEdge.cs

示例3: WrapEdge

 ///<summary>Makes the SecurityOverlord listen to the edge and instantiates
 ///a new SecurityAssociation for the insecure edge.  CreateSecurityAssociation
 ///is idempotent.</summary>
 protected override void WrapEdge(Edge edge) {
   edge.Subscribe(_so, null);
   SecurityAssociation sa = _so.CreateSecurityAssociation(edge, DefaultEdgeSPI, !edge.IsInbound);
   if(edge.IsClosed) {
     sa.Close("Edge closed too quickly.");
   }
 }
开发者ID:twchoi,项目名称:tmp-brunet-deetoo,代码行数:10,代码来源:SecureEdgeListener.cs

示例4: WrapEdge

    ///<summary>Makes the SecurityOverlord listen to the edge and instantiates
    ///a new SecurityAssociation for the insecure edge.  CreateSecurityAssociation
    ///is idempotent.</summary>
    protected override void WrapEdge(Edge edge) {
      edge.Subscribe(_so, null);

      if(edge.IsInbound) {
        lock(_sync) {
          _edge_to_inbound.Add(edge, true);
        }
      } else {
        SecurityAssociation sa = _so.CreateSecurityAssociation(edge);
        lock(_sync) {
          _edge_to_sa.Add(edge, sa);
        }
      }

      try {
        edge.CloseEvent += HandleEdgeClose;
      } catch {
        HandleEdgeClose(edge, EventArgs.Empty);
      }
    }
开发者ID:pstjuste,项目名称:brunet,代码行数:23,代码来源:SecureEdgeListener.cs

示例5: ETServer

 public ETServer(Edge e) {
   e.Subscribe(this, null);
   _e = e;
 }
开发者ID:twchoi,项目名称:tmp-brunet-deetoo,代码行数:4,代码来源:EdgeTester.cs

示例6: HandleEC

 public void HandleEC(bool succ, Edge e, Exception x) {
   if( succ ) {
     /*
      * Got the underlying Edge, now do the path protocol
      */ 
     Channel results = new Channel(1);
     results.CloseEvent += delegate(object q, EventArgs args) {
       try {
         RpcResult res = (RpcResult)results.Dequeue();
         object o = res.Result;
         if(o is Exception) {
           Console.WriteLine(o);
           throw (o as Exception);
         }
         //If we get here, everything looks good:
         PathEdge pe = new PathEdge(e, LocalPath, RemotePath);
         //Start sending e's packets into pe
         pe.Subscribe();
         ECB(true, pe, null);
       }
       catch(Exception cx) {
         ECB(false, null, cx);
       }
     };
     //Make sure we hear the packets on this edge:
     e.Subscribe(_pel._pem, null);
     //Now make the rpc call:
     _pel._pem.Rpc.Invoke(e, results, "sys:pathing.create", LocalPath, RemotePath ); 
   }
   else {
     ECB(false, null, x);
   }
 }
开发者ID:johnynek,项目名称:brunet,代码行数:33,代码来源:PathEdgeListener.cs


注:本文中的Edge.Subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。