ShemShadrack commented on code in PR #3399:
URL: https://github.com/apache/thrift/pull/3399#discussion_r3140635822


##########
lib/rs/src/transport/socket.rs:
##########
@@ -82,9 +89,42 @@ impl TTcpChannel {
     pub fn with_stream(stream: TcpStream) -> TTcpChannel {
         TTcpChannel {
             stream: Some(stream),
+            read_timeout: None,
+            write_timeout: None,
         }
     }
 
+    /// Set the read timeout for this channel.
+    pub fn set_read_timeout(&mut self, timeout: Option<Duration>) -> 
crate::Result<()> {
+        if let Some(ref stream) = self.stream {
+            stream.set_read_timeout(timeout)?;
+        }
+
+        self.read_timeout = timeout;
+        Ok(())
+    }
+
+    /// Set the write timeout for this channel.
+    pub fn set_write_timeout(&mut self, timeout: Option<Duration>) -> 
crate::Result<()> {
+        if let Some(ref stream) = self.stream {
+            stream.set_write_timeout(timeout)?;
+        }
+
+        self.write_timeout = timeout;
+        Ok(())
+    }
+
+    /// Set the read and write timeouts for this channel.
+    pub fn set_timeouts(
+        &mut self,

Review Comment:
   Good point. I’ll add read_timeout() and write_timeout() getters so callers 
can inspect the configured values.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to