Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Check if can write/read before setting timeout. (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
kasobol-msft authored Aug 18, 2020
1 parent 81cb4ae commit 25e73e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/ClassLibraryCommon/Core/TimeoutStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ private void StopTimeout(CancellationTokenSource source, bool dispose)

private void UpdateReadTimeout()
{
if (this.wrappedStream.CanTimeout)
if (this.wrappedStream.CanTimeout && this.wrappedStream.CanRead)
{
try
{
Expand All @@ -283,7 +283,7 @@ private void UpdateReadTimeout()

private void UpdateWriteTimeout()
{
if (this.wrappedStream.CanTimeout)
if (this.wrappedStream.CanTimeout && this.wrappedStream.CanWrite)
{
try
{
Expand Down

0 comments on commit 25e73e3

Please sign in to comment.