Skip to content

Commit 05efd11

Browse files
committed
[obsolete][CS0618][CS0672] Disassociate #pragma warning disable
1 parent f92c609 commit 05efd11

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

src/core/Akka.Remote/EndpointManager.cs

+4
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,9 @@ bool MatchesQuarantine(AkkaProtocolHandle handle)
791791
// Side-effecting here
792792
if (drop)
793793
{
794+
#pragma warning disable CS0618
794795
x.Value.Disassociate();
796+
#pragma warning restore CS0618
795797
Context.Stop(x.Key);
796798
}
797799
return !drop;
@@ -805,7 +807,9 @@ bool MatchesQuarantine(AkkaProtocolHandle handle)
805807
var handle = assoc.Association.AsInstanceOf<AkkaProtocolHandle>();
806808
var drop = MatchesQuarantine(handle);
807809
if (drop)
810+
#pragma warning disable CS0618
808811
handle.Disassociate();
812+
#pragma warning restore CS0618
809813
return !drop;
810814
}).ToList();
811815
return new KeyValuePair<IActorRef, List<InboundAssociation>>(x.Key, associations);

src/core/Akka.Remote/Transport/DotNetty/TcpTransport.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ private static IByteBuffer ToByteBuffer(IChannel channel, ByteString payload)
184184
var buffer = Unpooled.WrappedBuffer(payload.ToByteArray());
185185
return buffer;
186186
}
187-
187+
#pragma warning disable CS0672
188188
public override void Disassociate()
189+
#pragma warning restore CS0672
189190
{
190191
_channel.CloseAsync();
191192
}

src/core/Akka.Remote/Transport/FailureInjectorTransportAdapter.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,17 @@ public override bool Write(ByteString payload)
438438
/// <summary>
439439
/// TBD
440440
/// </summary>
441+
442+
#pragma warning disable CS0672
441443
public override void Disassociate()
444+
#pragma warning restore CS0672
442445
{
446+
#pragma warning disable CS0618
443447
WrappedHandle.Disassociate();
448+
#pragma warning restore CS0618
444449
}
445450

446-
#region IHandleEventListener members
451+
#region IHandleEventListener members
447452

448453
/// <summary>
449454
/// TBD

src/core/Akka.Remote/Transport/TestTransport.cs

+2
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,9 @@ public override bool Write(ByteString payload)
821821
/// <summary>
822822
/// TBD
823823
/// </summary>
824+
#pragma warning disable CS0672
824825
public override void Disassociate()
826+
#pragma warning restore CS0672
825827
{
826828
_transport.Disassociate(this);
827829
}

src/core/Akka.Remote/Transport/ThrottleTransportAdapter.cs

+25-19
Original file line numberDiff line numberDiff line change
@@ -432,26 +432,28 @@ protected override void Ready(object message)
432432
foreach (var handle in _handleTable)
433433
{
434434
if (handle.Item1 == naked)
435-
handle.Item2.Disassociate();
436-
}
435+
#pragma warning disable CS0618
436+
handle.Item2.Disassociate();
437+
#pragma warning restore CS0618
438+
}
437439

438-
/*
439-
* NOTE: Important difference between Akka.NET and Akka here.
440-
* In canonical Akka, ThrottleHandlers are never removed from
441-
* the _handleTable. The reason is because Ask-ing a terminated ActorRef
442-
* doesn't cause any exceptions to be thrown upstream - it just times out
443-
* and propagates a failed Future.
444-
*
445-
* In the CLR, a CancellationException gets thrown and causes all
446-
* parent tasks chaining back to the EndPointManager to fail due
447-
* to an Ask timeout.
448-
*
449-
* So in order to avoid this problem, we remove any disassociated handles
450-
* from the _handleTable.
451-
*
452-
* Questions? Ask @Aaronontheweb
453-
*/
454-
_handleTable.RemoveAll(tuple => tuple.Item1 == naked);
440+
/*
441+
* NOTE: Important difference between Akka.NET and Akka here.
442+
* In canonical Akka, ThrottleHandlers are never removed from
443+
* the _handleTable. The reason is because Ask-ing a terminated ActorRef
444+
* doesn't cause any exceptions to be thrown upstream - it just times out
445+
* and propagates a failed Future.
446+
*
447+
* In the CLR, a CancellationException gets thrown and causes all
448+
* parent tasks chaining back to the EndPointManager to fail due
449+
* to an Ask timeout.
450+
*
451+
* So in order to avoid this problem, we remove any disassociated handles
452+
* from the _handleTable.
453+
*
454+
* Questions? Ask @Aaronontheweb
455+
*/
456+
_handleTable.RemoveAll(tuple => tuple.Item1 == naked);
455457
Sender.Tell(ForceDisassociateAck.Instance);
456458
return;
457459
}
@@ -927,7 +929,9 @@ bool TryConsume(ThrottleMode currentBucket)
927929
}
928930

929931
/// <inheritdoc/>
932+
#pragma warning disable CS0672
930933
public override void Disassociate()
934+
#pragma warning restore CS0672
931935
{
932936
ThrottlerActor.Tell(PoisonPill.Instance);
933937
}
@@ -1162,7 +1166,9 @@ private void InitializeFSM()
11621166
if (mode is Blackhole)
11631167
{
11641168
ThrottledMessages = new Queue<ByteString>();
1169+
#pragma warning disable CS0618
11651170
exposedHandle.Disassociate();
1171+
#pragma warning restore CS0618
11661172
return Stop();
11671173
}
11681174
else

0 commit comments

Comments
 (0)