Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use File.OpenHandle in Socket.SendFile directly#56777

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
stephentoub merged 4 commits intodotnet:mainfromhuoyaoyuan:socket-filehandle
Aug 3, 2021

Conversation

@huoyaoyuan
Copy link
Member

Saves a FileStream allocation.

@ghostghost added community-contributionIndicates that the PR has been added by a community member area-System.Net.Sockets labelsAug 3, 2021
@ghost
Copy link

Tagging subscribers to this area: @dotnet/ncl
See info inarea-owners.md if you want to be subscribed.

Issue Details

Saves a FileStream allocation.

Author:huoyaoyuan
Assignees:-
Labels:

area-System.Net.Sockets,community-contribution

Milestone:-


// Send the file, if any
if(fileHandle!=null)
using(fileHandle)
Copy link
Member

@stephentoubstephentoubAug 3, 2021
edited
Loading

Choose a reason for hiding this comment

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

This should be done earlier. The preBuffer sending above should be a part of this so that the fileHandle will be disposed if that Send throws.

Comment on lines 401 to 408
SafeFileHandle?fileHandle=OpenFileHandle(fileName);

SocketErrorerrorCode;
// This can throw ObjectDisposedException.
errorCode=SocketPal.SendFile(_handle,fileHandle,preBuffer,postBuffer,flags);

using(fileHandle)
{
// This can throw ObjectDisposedException.
errorCode=SocketPal.SendFile(_handle,fileHandle,preBuffer,postBuffer,flags);
}
Copy link
Member

Choose a reason for hiding this comment

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

This can be:

SocketErrorerrorCode;using(SafeFileHandle?fileHandle=OpenFileHandle(fileName)){// This can throw ObjectDisposedException.errorCode=SocketPal.SendFile(_handle,fileHandle,preBuffer,postBuffer,flags);}

Copy link
Member

@stephentoubstephentoub left a comment

Choose a reason for hiding this comment

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

Thanks!

@stephentoubstephentoub merged commit4b3db59 intodotnet:mainAug 3, 2021
thaystg added a commit to thaystg/runtime that referenced this pull requestAug 3, 2021
# By Camillo Toselli (1) and others# Via GitHub* origin/main:  add RID for Debian 11 (dotnet#56789)  [wasm] [debugger] Skip thread static field (dotnet#56749)  Fix timeouts in coreroot_determinism test in GC stress mode (dotnet#56770)  Use File.OpenHandle in Socket.SendFile directly (dotnet#56777)  accept empty realm for digest auth (dotnet#56369) (dotnet#56455)# Conflicts:#src/mono/wasm/debugger/DebuggerTestSuite/BreakpointTests.cs#src/mono/wasm/debugger/DebuggerTestSuite/GetPropertiesTests.cs
thaystg added a commit to thaystg/runtime that referenced this pull requestAug 4, 2021
…ger_proxy_attribute* origin/main: (340 commits)  add RID for Debian 11 (dotnet#56789)  [wasm] [debugger] Skip thread static field (dotnet#56749)  Fix timeouts in coreroot_determinism test in GC stress mode (dotnet#56770)  Use File.OpenHandle in Socket.SendFile directly (dotnet#56777)  accept empty realm for digest auth (dotnet#56369) (dotnet#56455)  [wasm][debugger] Create test Inherited Properties (dotnet#56754)  Mark new test as incompatible with GC Mark4781_1GcStressIncompatible (dotnet#56739)  Ensure MetadataEnumResult is sufficiently updated by MetaDataImport::Enum (dotnet#56756)  [mono] Remove gdb xdebug and binary writer support, it hasn't worked in a while. (dotnet#56759)  Update windows-requirements.md (dotnet#56476)  Update doc and generic parameter name for JsonValue.GetValue (dotnet#56639)  [wasm][debugger] Inspect static class (dotnet#56740)  Fix stack overflow handling issue in GC stress (dotnet#56733)  Use ReflectionOnly as serialization mode in case dynamic code runtime feature is not supported (dotnet#56604)  Move Windows Compat pack to NuGet pack task (dotnet#56686)  Fix build error when building some packages (dotnet#56767)  Simplify JIT shutdown logic in crossgen2 (dotnet#56687)  Fix race in crossdac publishing with PGO (dotnet#56762)  Add DictionaryKeyPolicy support for EnumConverter [dotnet#47765] (dotnet#54429)  Use ComWrappers in some Marshal unit-tests and update platform metadata  (dotnet#56595)  ...
@huoyaoyuanhuoyaoyuan deleted the socket-filehandle branchAugust 4, 2021 03:35
@karelzkarelz added this to the6.0.0 milestoneAug 17, 2021
@ghostghost locked asresolvedand limited conversation to collaboratorsSep 16, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@stephentoubstephentoubstephentoub approved these changes

Assignees

No one assigned

Labels

area-System.Net.Socketscommunity-contributionIndicates that the PR has been added by a community member

Projects

None yet

Milestone

6.0.0

Development

Successfully merging this pull request may close these issues.

3 participants

@huoyaoyuan@stephentoub@karelz

[8]ページ先頭

©2009-2025 Movatter.jp