Browse Source

fix SocketStream::flush() covariant

Cary Sandvig 3 years ago
parent
commit
b10b49bd6b

+ 2 - 1
direct/src/distributed/cConnectionRepository.cxx

@@ -580,7 +580,8 @@ flush() {
 
 
   #ifdef HAVE_OPENSSL
   #ifdef HAVE_OPENSSL
   if (_http_conn) {
   if (_http_conn) {
-    return _http_conn->flush();
+    _http_conn->flush();
+    return !_http_conn->is_closed();
   }
   }
   #endif  // HAVE_OPENSSL
   #endif  // HAVE_OPENSSL
 
 

+ 9 - 9
panda/src/downloader/socketStream.I

@@ -131,15 +131,16 @@ get_tcp_header_size() const {
 INLINE bool SSWriter::
 INLINE bool SSWriter::
 consider_flush() {
 consider_flush() {
   if (!_collect_tcp) {
   if (!_collect_tcp) {
-    return flush();
-
+    flush();
+    return !is_closed();
   } else {
   } else {
     double elapsed =
     double elapsed =
       TrueClock::get_global_ptr()->get_short_time() - _queued_data_start;
       TrueClock::get_global_ptr()->get_short_time() - _queued_data_start;
     // If the elapsed time is negative, someone must have reset the clock
     // If the elapsed time is negative, someone must have reset the clock
     // back, so just go ahead and flush.
     // back, so just go ahead and flush.
     if (elapsed < 0.0 || elapsed >= _collect_tcp_interval) {
     if (elapsed < 0.0 || elapsed >= _collect_tcp_interval) {
-      return flush();
+      flush();
+      return !is_closed();
     }
     }
   }
   }
 
 
@@ -150,11 +151,10 @@ consider_flush() {
  * Sends the most recently queued data now.  This only has meaning if
  * Sends the most recently queued data now.  This only has meaning if
  * set_collect_tcp() has been set to true.
  * set_collect_tcp() has been set to true.
  */
  */
-INLINE bool SSWriter::
+INLINE void SSWriter::
 flush() {
 flush() {
   _ostream->flush();
   _ostream->flush();
   _queued_data_start = TrueClock::get_global_ptr()->get_short_time();
   _queued_data_start = TrueClock::get_global_ptr()->get_short_time();
-  return !is_closed();
 }
 }
 
 
 /**
 /**
@@ -176,9 +176,9 @@ OSocketStream(std::streambuf *buf) : std::ostream(buf), SSWriter(this) {
  * Sends the most recently queued data now.  This only has meaning if
  * Sends the most recently queued data now.  This only has meaning if
  * set_collect_tcp() has been set to true.
  * set_collect_tcp() has been set to true.
  */
  */
-INLINE bool OSocketStream::
+INLINE void OSocketStream::
 flush() {
 flush() {
-  return SSWriter::flush();
+  SSWriter::flush();
 }
 }
 
 
 /**
 /**
@@ -212,7 +212,7 @@ get_tcp_header_size() const {
  * Sends the most recently queued data now.  This only has meaning if
  * Sends the most recently queued data now.  This only has meaning if
  * set_collect_tcp() has been set to true.
  * set_collect_tcp() has been set to true.
  */
  */
-INLINE bool SocketStream::
+INLINE void SocketStream::
 flush() {
 flush() {
-  return SSWriter::flush();
+  SSWriter::flush();
 }
 }

+ 3 - 3
panda/src/downloader/socketStream.h

@@ -106,7 +106,7 @@ PUBLISHED:
   INLINE int get_tcp_header_size() const;
   INLINE int get_tcp_header_size() const;
 
 
   INLINE bool consider_flush();
   INLINE bool consider_flush();
-  INLINE bool flush();
+  INLINE void flush();
 
 
 private:
 private:
   std::ostream *_ostream;
   std::ostream *_ostream;
@@ -168,7 +168,7 @@ PUBLISHED:
   virtual bool is_closed() = 0;
   virtual bool is_closed() = 0;
   virtual void close() = 0;
   virtual void close() = 0;
 
 
-  INLINE bool flush();
+  INLINE void flush();
 };
 };
 
 
 /**
 /**
@@ -190,7 +190,7 @@ PUBLISHED:
   INLINE void set_tcp_header_size(int tcp_header_size);
   INLINE void set_tcp_header_size(int tcp_header_size);
   INLINE int get_tcp_header_size() const;
   INLINE int get_tcp_header_size() const;
 
 
-  INLINE bool flush();
+  INLINE void flush();
 };
 };
 
 
 
 

+ 2 - 1
panda/src/recorder/socketStreamRecorder.I

@@ -135,7 +135,8 @@ consider_flush() {
 INLINE bool SocketStreamRecorder::
 INLINE bool SocketStreamRecorder::
 flush() {
 flush() {
   if (_stream != nullptr) {
   if (_stream != nullptr) {
-    return _stream->flush();
+    _stream->flush();
+    return !_stream->is_closed();
   }
   }
   return true;
   return true;
 }
 }