Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ OfferMessage() [1/2]

DataflowMessageStatus ITargetBlock< T >. System.Threading.Tasks.Dataflow.BroadcastBlock< T >.OfferMessage ( DataflowMessageHeader messageHeader,
T messageValue,
ISourceBlock< T > source,
bool consumeToAccept )
inlineprivate

Definition at line 701 of file BroadcastBlock.cs.

702 {
703 if (!messageHeader.IsValid)
704 {
705 throw new ArgumentException(System.SR.Argument_InvalidMessageHeader, "messageHeader");
706 }
707 if (source == null && consumeToAccept)
708 {
710 }
712 {
714 {
716 return DataflowMessageStatus.DecliningPermanently;
717 }
718 if (_boundingState == null || (_boundingState.CountIsLessThanBound && _boundingState.PostponedMessages.Count == 0 && _boundingState.TaskForInputProcessing == null))
719 {
720 if (consumeToAccept)
721 {
722 messageValue = source.ConsumeMessage(messageHeader, this, out var messageConsumed);
723 if (!messageConsumed)
724 {
725 return DataflowMessageStatus.NotAvailable;
726 }
727 }
729 if (_boundingState != null)
730 {
731 _boundingState.CurrentCount++;
732 }
733 return DataflowMessageStatus.Accepted;
734 }
735 if (source != null)
736 {
737 _boundingState.PostponedMessages.Push(source, messageHeader);
738 return DataflowMessageStatus.Postponed;
739 }
740 return DataflowMessageStatus.Declined;
741 }
742 }
static string Argument_InvalidMessageHeader
Definition SR.cs:24
static string Argument_CantConsumeFromANullSource
Definition SR.cs:22
Definition SR.cs:7
readonly BroadcastingSourceCore< T > _source
readonly BoundingStateWithPostponedAndTask< T > _boundingState

References System.Threading.Tasks.Dataflow.BroadcastBlock< T >._boundingState, System.Threading.Tasks.Dataflow.BroadcastBlock< T >._decliningPermanently, System.Threading.Tasks.Dataflow.BroadcastBlock< T >._source, System.Threading.Tasks.Dataflow.BroadcastBlock< T >.BroadcastingSourceCore< TOutput >.AddMessage(), System.SR.Argument_CantConsumeFromANullSource, System.SR.Argument_InvalidMessageHeader, System.Threading.Tasks.Dataflow.BroadcastBlock< T >.CompleteTargetIfPossible(), System.Threading.Tasks.Dataflow.BroadcastBlock< T >.IncomingLock, System.source, and System.Threading.Tasks.Dataflow.Internal.BoundingStateWithPostponedAndTask< TInput >.TaskForInputProcessing.