From 4458bf17916973aeb9e99e9166070f645fb3295e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 15 Aug 2014 22:47:44 +0000 Subject: Fix deadlock waiting for read or write on closed connection. If the system is suspended then it may not realise that a TCP connection has been closed, while waiting for data to arrive on it. We didn't used to apply a timeout to this read operation. Now we use the connection's default timeout on all read and write operations. Network operations that don't pass a timeout will be logged with a backtrace, so that they can be fixed. --- lib/common/CollectInBufferStream.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/common/CollectInBufferStream.h') diff --git a/lib/common/CollectInBufferStream.h b/lib/common/CollectInBufferStream.h index d73af8db..03cb5da8 100644 --- a/lib/common/CollectInBufferStream.h +++ b/lib/common/CollectInBufferStream.h @@ -34,7 +34,8 @@ public: virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); virtual pos_type BytesLeftToRead(); - virtual void Write(const void *pBuffer, int NBytes); + virtual void Write(const void *pBuffer, int NBytes, + int Timeout = IOStream::TimeOutInfinite); virtual pos_type GetPosition() const; virtual void Seek(pos_type Offset, int SeekType); virtual bool StreamDataLeft(); -- cgit v1.2.3