Skip to content
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

Support TransferMode.Streamed. #209

Merged
merged 1 commit into from
Jul 24, 2015
Merged

Support TransferMode.Streamed. #209

merged 1 commit into from
Jul 24, 2015

Conversation

shmao
Copy link
Contributor

@shmao shmao commented Jul 21, 2015

The fix is to enable Streamed transfer mode.

Fixes #7, #37, and #199.

@dnfclas
Copy link

dnfclas commented Jul 21, 2015

Hi @shmao, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@dnfclas
Copy link

dnfclas commented Jul 21, 2015

@shmao, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

@shmao
Copy link
Contributor Author

shmao commented Jul 21, 2015

@roncain @iamjasonp

await xmlWriter.FlushAsync();

// The underlying type of xmlWriter, XmlUTF8TextWriter, has not implemented FlushAsync() yet.
xmlWriter.Flush();
Copy link
Member

Choose a reason for hiding this comment

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

This is really crappy if we suddenly go sync while in a supposedly async path. Can you please open up a bug to track this implementation in the corefx repo?

Copy link
Contributor

Choose a reason for hiding this comment

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

Question for @mconnew -- would it be better to await a Task.Run invoking the xmlWriter.Flush()?

Copy link
Member

Choose a reason for hiding this comment

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

@roncain, I would prefer to keep the call to xmlWriter.FlushAsync and let the xmlWriter decide what to do. If the xmlWriter is doing nothing right now, then that's a bug that needs to be fixed. But the fix could simply be for xmlWriter to either directly call the synchronous Flush method or to call Task.Run(). xmlWriter is the correct place to decide what to do as it is likely easy to check if there's anything to flush and if there isn't, return, otherwise call Task.Run to invoke Flush(). This wouldn't require converting everything to async and would allow a fast path for the no-op situation avoiding starting a new task on another thread just to no-op on that thread and mark the Task complete.

Copy link
Member

Choose a reason for hiding this comment

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

👍 can we get this calling FlushAsync() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't at this point as the API is not implemented yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

The api is not exposed by the XmlWriter contract?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The API is in the contract, but it’s not implemented yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case lets open a bug and give a dummy sync implementation which just returns
Task.FromResult();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #222 for tracking this.

@iamjasonp
Copy link
Member

Also, please revise your commit comment prior to merging the PR - omit the "To"

@shmao shmao changed the title To Support TransferMode.Streamed. Support TransferMode.Streamed. Jul 24, 2015
@shmao
Copy link
Contributor Author

shmao commented Jul 24, 2015

Hi Folks, I've updated the PR. Can you please have a look? Thanks!

@shmao shmao closed this Jul 24, 2015
@shmao shmao reopened this Jul 24, 2015
@dnfclas
Copy link

dnfclas commented Jul 24, 2015

Hi @shmao, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

<ProjectReference Include='$(WcfSourceProj)'>
<Project>{9e50e7bf-cd6e-4269-a6dd-59fd0bd6c0fd}</Project>
<Name>System.Private.ServiceModel</Name>
</ProjectReference>
Copy link
Member

Choose a reason for hiding this comment

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

Should read:

    <!-- Compile tests against the contract, but copy our local-built implementation for testing -->
    <ProjectReference Include='$(WcfSourceProj)'>
      <Project>{9e50e7bf-cd6e-4269-a6dd-59fd0bd6c0fd}</Project>
      <Name>System.Private.ServiceModel</Name>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
      <OutputItemType>Content</OutputItemType>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Targets>Build;DebugSymbolsProjectOutputGroup</Targets>
    </ProjectReference>

unless there's a really good reason for using the P2P references. Using the above ensures that the tests are testing only the surface area that is available in the public contract.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Added this.

@iamjasonp
Copy link
Member

:shipit: says: LGTM

@StephenBonikowsky
Copy link
Member

:shipit:

@@ -80,6 +81,11 @@ internal BodyWriter OnCreateBufferedCopy(int maxBufferSize, XmlDictionaryReaderQ
}

protected abstract void OnWriteBodyContents(XmlDictionaryWriter writer);
protected virtual Task OnWriteBodyContentsAsync(XmlDictionaryWriter writer)
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: new line

@roncain
Copy link
Contributor

roncain commented Jul 24, 2015

LGTM

shmao added a commit that referenced this pull request Jul 24, 2015
Support TransferMode.Streamed.
@shmao shmao merged commit 3534d5c into dotnet:master Jul 24, 2015
@shmao shmao deleted the issue37 branch July 24, 2015 21:18
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.

Support TransferMode.Streamed in Http and Tcp
7 participants