diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-08-15 22:47:44 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-08-15 22:47:44 +0000 |
commit | 4458bf17916973aeb9e99e9166070f645fb3295e (patch) | |
tree | 26dee42145e176b7ec3c3f233c79afc7b3270557 /lib/backupstore/BackupStoreFileCmbIdx.cpp | |
parent | 06960c6241f6209b6dd19b4c204c27f1395cda7d (diff) |
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.
Diffstat (limited to 'lib/backupstore/BackupStoreFileCmbIdx.cpp')
-rw-r--r-- | lib/backupstore/BackupStoreFileCmbIdx.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/backupstore/BackupStoreFileCmbIdx.cpp b/lib/backupstore/BackupStoreFileCmbIdx.cpp index c8bcc3b9..0eec3872 100644 --- a/lib/backupstore/BackupStoreFileCmbIdx.cpp +++ b/lib/backupstore/BackupStoreFileCmbIdx.cpp @@ -32,7 +32,8 @@ public: ~BSFCombinedIndexStream(); virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite); - virtual void Write(const void *pBuffer, int NBytes); + virtual void Write(const void *pBuffer, int NBytes, + int Timeout = IOStream::TimeOutInfinite); virtual bool StreamDataLeft(); virtual bool StreamClosed(); virtual void Initialise(IOStream &rFrom); @@ -289,7 +290,8 @@ int BSFCombinedIndexStream::Read(void *pBuffer, int NBytes, int Timeout) // Created: 8/7/04 // // -------------------------------------------------------------------------- -void BSFCombinedIndexStream::Write(const void *pBuffer, int NBytes) +void BSFCombinedIndexStream::Write(const void *pBuffer, int NBytes, + int Timeout) { THROW_EXCEPTION(BackupStoreException, StreamDoesntHaveRequiredFeatures) } |