protected FABChannel(IFABChannel parent, FABChannelId id) { this.Parent = parent; this.Id = id; this.channelUnsafe = this.NewUnsafe(); this.pipeline = this.NewChannelPipeline(); }
public bool Matches(IFABChannel channel) { IFABChannelMatcher[] matchers = this.matchers; for (int i = 0; i < matchers.Length; i++) { if (!matchers[i].Matches(channel)) { return(false); } } return(true); }
protected FABSocketChannel(IFABChannel parent, Socket socket) : base(parent) { this.Socket = socket; this.state = StateFlags.Open; try { this.Socket.Blocking = false; } catch (SocketException ex) { try { socket.Dispose(); } catch (SocketException ex2) { throw ex2; } throw new FABChannelException("Failed to enter non-blocking mode.", ex); } }
public void Add(IFABChannel item) { this.Add(item); }
public static void CloseSafe(this IFABChannel channel) { CompleteChannelCloseTaskSafely(channel, channel.CloseAsync()); }
public int CompareTo(IFABChannel o) { return(ReferenceEquals(this, o) ? 0 : this.Id.CompareTo(o.Id)); }
internal FABChannelOutboundBuffer(IFABChannel channel) { this.channel = channel; }
public Task Find(IFABChannel channel) { return(this.futures[channel]); }
public bool Matches(IFABChannel ch) { return(this.channel == ch); }
public static IFABChannelMatcher IsNot(IFABChannel channel) { return(Invert(Is(channel))); }
public bool Matches(IFABChannel channel) { return(true); }
public static IFABChannelMatcher Is(IFABChannel channel) { return(new InstanceMatcher(channel)); }
public bool Matches(IFABChannel channel) { return(this.type.IsInstanceOfType(channel)); }
public bool Matches(IFABChannel channel) { return(!this.matcher.Matches(channel)); }
public bool Contains(IFABChannel item) { return(this.Contains(item)); }
public FABChannelGroupCompletionSource(IFABChannelGroup sgroup, Dictionary <IFABChannel, Task> futures /*, IEventExecutor executor*/, object state) : base(state) { Contract.Requires(sgroup != null); Contract.Requires(futures != null); this.groub = sgroup; this.futures = new Dictionary <IFABChannel, Task>(); foreach (KeyValuePair <IFABChannel, Task> pair in futures) { this.futures.Add(pair.Key, pair.Value); pair.Value.ContinueWith(x => { bool success = x.Status == TaskStatus.RanToCompletion; bool callSetDone; lock (this) { if (success) { this.successCount++; } else { this.failureCount++; } callSetDone = this.successCount + this.failureCount == this.futures.Count; Contract.Assert(this.successCount + this.failureCount <= this.futures.Count); } if (callSetDone) { if (this.failureCount > 0) { var failed = new List <KeyValuePair <IFABChannel, Exception> >(); foreach (KeyValuePair <IFABChannel, Task> ft in this.futures) { IFABChannel c = ft.Key; Task f = ft.Value; if (f.IsFaulted || f.IsCanceled) { if (f.Exception != null) { failed.Add(new KeyValuePair <IFABChannel, Exception>(c, f.Exception.InnerException)); } } } this.TrySetException(new FABChannelGroupException(failed)); } else { this.TrySetResult(0); } } }); } // Done on arrival? if (futures.Count == 0) { this.TrySetResult(0); } }
public bool Remove(IFABChannel item) { return(this.Remove(item)); }
public InstanceMatcher(IFABChannel channel) { this.channel = channel; }