-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Updates and fixes for Akka.IO UDP support #3005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@Horusiath some UDP specs on Mono failing following this change |
Because you also refactored to use new patterns and stuff. Its hard to review. Could you point out what you changed to fix the problem ? |
Essentially the problem was that I didn't updated the UDP handler code in line to the changes I was making in
I've extracted logic responsible for recognizing which method to use ( I'll take a look at issue on Mono later today. |
@Horusiath you made a lot of API changes, it will be impossible to ship it in 1.3.x. Is it possible to bring back some constructors and properties and make them obsoleted? |
@alexvaluyskiy 90% of API changes is about sealing message classes (which should be sealed). There's a one change in the I guess it's not a big deal, as it's more to be used by us than users, and we can ask for forgiveness the 1-2 people, whos project will broke by that. |
364a835
to
d4012aa
Compare
The reason of failure on Mono found: Mono doesn't support using BufferList at this point. This probably means, that the same problem concerns TCP, we just didn't have tests to detect that. As I definitely don't want to fallback the whole ability to send multiple buffers at once or build a separate (and very complex) buffer send awaiting logic just to cover Mono, my proposal is: If we detect, that we're on Mono, we use Are we fine with that? /cc @akkadotnet/core |
// Mono doesn't support BufferList - falback to compacting ByteString | ||
var compacted = data.Compact(); | ||
var buffer = compacted.Buffers[0]; | ||
args.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we detect a Mono runtime, we'll try to fallback and compact multiple byte buffers into one (this operations copies buffers onto newly allocated array).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Fine with me. Not our job to implement the missing parts of the Mono runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
@@ -61,6 +62,20 @@ public void The_UDP_Fire_and_Forget_implementation_must_be_able_to_send_without_ | |||
} | |||
|
|||
[Fact] | |||
public void The_UDP_Fire_and_Forget_implementation_must_be_able_to_send_multipart_ByteString_without_binding() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
// Mono doesn't support BufferList - falback to compacting ByteString | ||
var compacted = data.Compact(); | ||
var buffer = compacted.Buffers[0]; | ||
args.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
@@ -152,44 +152,48 @@ public NoAck(object token) | |||
/// </summary> | |||
public sealed class Send : Command | |||
{ | |||
[Obsolete("Akka.IO.Udp.Send public constructors are obsolete. Use `Send.Create` or `Send(ByteString, EndPoint, Event)` instead.")] | |||
public Send(IEnumerator<ByteBuffer> payload, Event ack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@@ -35,6 +35,16 @@ public sealed class ByteString : IEquatable<ByteString>, IEnumerable<byte> | |||
#region creation methods | |||
|
|||
/// <summary> | |||
/// INTERNAL API: remove this method once <see cref="Udp.Send"/> public constructor will be removed. | |||
/// </summary> | |||
internal static ByteString FromBuffers(IEnumerator<ByteBuffer> buffers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
This should fix the issue reported in #2995 (PR contains tests which reproduced the issue). It also upgrades the codebase to C# 7.