Skip to content

.NET Core port - DO NOT MERGE#175

Closed
darkl wants to merge 5 commits into
statianzo:masterfrom
darkl:netcore
Closed

.NET Core port - DO NOT MERGE#175
darkl wants to merge 5 commits into
statianzo:masterfrom
darkl:netcore

Conversation

@darkl

@darkl darkl commented May 2, 2016

Copy link
Copy Markdown
Collaborator

Hi,

I tried for fun to make this library be .NET Core compatible.

I made a project.json file and made it compile, note that I changed some things: there is no such thing "InvariantCultureIgnoreCase", so I replaced it with "OrdinalIgnoreCase",
there are no more "Close" methods for streams and sockets, so I replaced it with "Dispose".

I also didn't reimplement QueuedStream since I'm not sure if this hack is needed for .NET Core. I also didn't covert the tests.

I didn't try this, I don't know if it works.

I'm opening this pull request, just for the case that anyone wants to continue this work on the port. Please don't merge it until tests are converted, pass, and until this is actually tested.

Best regards,
Elad

@statianzo

Copy link
Copy Markdown
Owner

Slick work.

@AdrianBathurst

Copy link
Copy Markdown

Thanks!! I'll be needing this port soon, so thank you very much!

@NVentimiglia

Copy link
Copy Markdown

+1

DotNetCore/Kestral version of my server dropped to 5k RPS... from an easy 50k.

@NVentimiglia

Copy link
Copy Markdown

The dependency NETStandard.Library >= 1.6.0 could not be resolved. Fleck G:\Drive\Avarice\SignalMQ\Fleck-master\core\Fleck\project.json 5

@NVentimiglia

Copy link
Copy Markdown

After some fiddling, I got the project down to 4 errors with the following

`
{
"title": "Fleck",
"version": "1.0.0-*",

"dependencies": {
"NETStandard.Library": "1.6.0"
},

"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
},

"buildOptions": {
"allowUnsafe": true, "define": [ "NETCORE" ]
}
}
`

The errors being the removal of the BeginAsync/EndAsync and missing System.Security.SSLStream

Do we have an ETA when this will be ready for testing. I recently got the microsoft websocket up to 800,000 OPS would like to test out fleck again. @darkl

@darkl

darkl commented Jul 9, 2016

Copy link
Copy Markdown
Collaborator Author

@NVentimiglia, I worked on this a bit today.

This works fine on my machine with .NET Core RTM:

dotnet restore
dotnet build src\Fleck src\Samples\ConsoleApp
cd src\Samples\ConsoleApp
dotnet run

Tests don't compile since a .NET Core compatible Moq isn't available yet.

I'm not sure if I'll finish this, but you're welcome to continue from where I've stopped.

Elad

@NVentimiglia

Copy link
Copy Markdown

7/9/2016 12:31:43 PM [Info] Server started at ws://0.0.0.0:5000 (actual port 5000)
One or more errors occurred. (Attempt by method 'Fleck.SocketWrapper.Accept(System.Action1<Fleck.ISocket>, System.Action1<System.Exception>)' to access method 'System.Net.Sockets.Socket.BeginAccept(System.AsyncCallback, System.Object)' failed.)
Terminating

@darkl

darkl commented Jul 9, 2016

Copy link
Copy Markdown
Collaborator Author

Are you using the latest version? (netcore branch)
The latest version doesn't call BeginAccept at all.

Elad

Comment thread src/Fleck/QueuedStream.cs

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
return _stream.WriteAsync(buffer, offset, count, cancellationToken);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be awaited ?

Comment thread src/Fleck/QueuedStream.cs

public override Task FlushAsync(CancellationToken cancellationToken)
{
return _stream.FlushAsync(cancellationToken);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be awaited ?

Comment thread src/Fleck/QueuedStream.cs

public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
{
return _stream.CopyToAsync(destination, bufferSize, cancellationToken);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be awaited ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awaiting would just wrap the CopyToAsync task with another task that does nothing but return the original result. Why do you think it should be wrapped?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never really thought of it that way. You are right.

@darkl

darkl commented Apr 27, 2018

Copy link
Copy Markdown
Collaborator Author

Not needed anymore.

@darkl darkl closed this Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants