Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

fixes for ManagedWebSocket server mode#10510

Merged
mellinoe merged 2 commits into
dotnet:masterfrom
analogrelay:anurse/10490-websocket-send-payload-when-server
Aug 2, 2016
Merged

fixes for ManagedWebSocket server mode#10510
mellinoe merged 2 commits into
dotnet:masterfrom
analogrelay:anurse/10490-websocket-send-payload-when-server

Conversation

@analogrelay
Copy link
Copy Markdown

@analogrelay analogrelay commented Aug 1, 2016

Updates to ManagedWebSocket to fix issues in server mode. There isn't really a place to put tests in corefx since no public API exercises this code path (we copy this class as raw source code into ASP.NET right now, as a stop-gap to a proper public API existing). I do have got tests for these changes in my copy of the WebSocket code, currently in PR at aspnet/WebSockets#105.

As far as breaking corefx, the only real concern is if the existing tests pass, since the new code path is not ever used by a public corefx API (I just want to keep our copy and the copy in corefx in sync).

/cc @Petermarcu (since @stephentoub is OOF, can you suggest someone to take a look at this?)
/cc @Tratcher

Fixes #10490

int maskOffset = WriteHeader(opcode, _sendBuffer, payloadBuffer, endOfMessage, useMask: true);
headerLength = maskOffset + MaskLength;
maskOffset = WriteHeader(opcode, _sendBuffer, payloadBuffer, endOfMessage, useMask: true);
headerLength = maskOffset.Value + MaskLength;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Slightly cheaper as GetValueOrDefault; we know it has a value s we just assigned one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It seems mildly odd that is the case, but looking at the code for Nullable<T> I can see why :). Will do!

@stephentoub
Copy link
Copy Markdown
Member

One nit, otherwise LGTM

@stephentoub
Copy link
Copy Markdown
Member

There isn't really a place to put tests in corefx since no public API exercises this code path

We can add some unit tests around this with a minimal test-only server that pulls this file into the tests. I can look at that when I'm actually back online (pretend I'm not here :-)

@analogrelay
Copy link
Copy Markdown
Author

That's basically what I was thinking but I wasn't familiar enough with the repo structure to get much progress on that. Thanks for hopping online quick for this @stephentoub !

analogrelay added a commit to aspnet/WebSockets that referenced this pull request Aug 2, 2016
@analogrelay
Copy link
Copy Markdown
Author

@dotnet-bot test Innerloop CentOS7.1 Debug Build and Test please

@analogrelay
Copy link
Copy Markdown
Author

Looks like this is passing tests. I'm not sure exactly what the merge procedure is though. Can someone help merge this in?

@mellinoe
Copy link
Copy Markdown
Contributor

mellinoe commented Aug 2, 2016

LGTM. We can add the tests that @stephentoub mentioned if/when we start using this in public corefx API.

@mellinoe mellinoe merged commit 745c2f6 into dotnet:master Aug 2, 2016
analogrelay added a commit to aspnet/WebSockets that referenced this pull request Aug 2, 2016
analogrelay added a commit to aspnet/WebSockets that referenced this pull request Aug 3, 2016
* import WebSockets code from CoreFX

* sync pr feedback from dotnet/corefx#10510
@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ManagedWebSocket doesn't send payloads if _isServer is true

5 participants