Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
7c2f65af
Commit
7c2f65af
authored
Aug 21, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AsStream() should probably be read-only
parent
76f19a0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ExtensionMethods.cs
src/StackExchange.Redis/ExtensionMethods.cs
+3
-3
No files found.
src/StackExchange.Redis/ExtensionMethods.cs
View file @
7c2f65af
...
@@ -166,7 +166,7 @@ private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, str
...
@@ -166,7 +166,7 @@ private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, str
}
}
/// <summary>
/// <summary>
/// Represent a byte-Lease as a Stream
/// Represent a byte-Lease as a
read-only
Stream
/// </summary>
/// </summary>
/// <param name="bytes">The lease upon which to base the stream</param>
/// <param name="bytes">The lease upon which to base the stream</param>
/// <param name="ownsLease">If true, disposing the stream also disposes the lease</param>
/// <param name="ownsLease">If true, disposing the stream also disposes the lease</param>
...
@@ -175,7 +175,7 @@ public static MemoryStream AsStream(this Lease<byte> bytes, bool ownsLease = tru
...
@@ -175,7 +175,7 @@ public static MemoryStream AsStream(this Lease<byte> bytes, bool ownsLease = tru
if
(
bytes
==
null
)
return
null
;
// GIGO
if
(
bytes
==
null
)
return
null
;
// GIGO
var
segment
=
bytes
.
ArraySegment
;
var
segment
=
bytes
.
ArraySegment
;
if
(
ownsLease
)
return
new
LeaseMemoryStream
(
segment
,
bytes
);
if
(
ownsLease
)
return
new
LeaseMemoryStream
(
segment
,
bytes
);
return
new
MemoryStream
(
segment
.
Array
,
segment
.
Offset
,
segment
.
Count
,
tru
e
,
true
);
return
new
MemoryStream
(
segment
.
Array
,
segment
.
Offset
,
segment
.
Count
,
fals
e
,
true
);
}
}
/// <summary>
/// <summary>
...
@@ -215,7 +215,7 @@ private sealed class LeaseMemoryStream : MemoryStream
...
@@ -215,7 +215,7 @@ private sealed class LeaseMemoryStream : MemoryStream
{
{
private
readonly
IDisposable
_parent
;
private
readonly
IDisposable
_parent
;
public
LeaseMemoryStream
(
ArraySegment
<
byte
>
segment
,
IDisposable
parent
)
public
LeaseMemoryStream
(
ArraySegment
<
byte
>
segment
,
IDisposable
parent
)
:
base
(
segment
.
Array
,
segment
.
Offset
,
segment
.
Count
,
tru
e
,
true
)
:
base
(
segment
.
Array
,
segment
.
Offset
,
segment
.
Count
,
fals
e
,
true
)
=>
_parent
=
parent
;
=>
_parent
=
parent
;
protected
override
void
Dispose
(
bool
disposing
)
protected
override
void
Dispose
(
bool
disposing
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment