Brunet.Transport.EdgeCreationWrapper.CreationCallback C# (CSharp) Method

CreationCallback() public method

public CreationCallback ( bool success, Edge e, Exception x ) : void
success bool
e Edge
x System.Exception
return void
    public void CreationCallback(bool success, Edge e, Exception x) {
      if(!success && _edge != null) {
        _edge.Close();
      }
      if(System.Threading.Interlocked.Exchange(ref _called, 1) == 1) {
        return;
      }

      ExternalECB(success, e, x);
    }
  }

Usage Example

Example #1
0
        ///<summary>When the edge is finally wrapped, this is called to finalize
        ///the adding of the edge to the edgelistner.</summary>
        protected void Finalize(WrapperEdge wedge)
        {
            EdgeCreationWrapper ecw = null;

            lock (_sync) {
                if (_edge_to_ecw.ContainsKey(wedge.WrappedEdge))
                {
                    ecw = _edge_to_ecw[wedge.WrappedEdge];
                    _edge_to_ecw.Remove(wedge.WrappedEdge);
                    _edge_to_wrapper_edge[wedge.WrappedEdge] = wedge;
                }
                else
                {
                    throw new Exception("No record of edge");
                }
            }

            // if ecw is null, that means someone else failed before we announced
            // furthermore, we now have a wedge that needs to be manually closed!
            if (ecw != null)
            {
                ecw.CreationCallback(true, wedge, null);
            }
            else
            {
                wedge.Close();
            }
        }
All Usage Examples Of Brunet.Transport.EdgeCreationWrapper::CreationCallback