sryanyuan commented on code in PR #2662:
URL: https://github.com/apache/kvrocks/pull/2662#discussion_r1842008161


##########
src/cluster/replication.cc:
##########
@@ -874,6 +876,12 @@ Status ReplicationThread::fetchFile(int sock_fd, evbuffer 
*evbuf, const std::str
     UniqueEvbufReadln line(evbuf, EVBUFFER_EOL_CRLF_STRICT);
     if (!line) {
       if (auto s = util::EvbufferRead(evbuf, sock_fd, -1, ssl); !s) {
+        if (errno == EAGAIN || errno == EWOULDBLOCK) {
+          if (stop_flag_) {
+            return {Status::NotOK, "replication thread was stopped"};
+          }
+          continue;
+        }

Review Comment:
   The other errors (not timeout), just returned as before
   
   From man page:
   
   SO_RCVTIMEO and SO_SNDTIMEO
   Specify the receiving or sending timeouts until reporting an error. The 
argument is a struct timeval. If an input or output function blocks for this 
period of time, and data has been sent or received, the return value of that 
function will be the amount of data transferred; if no data has been 
transferred and the timeout has been reached then -1 is returned with errno set 
to EAGAIN or EWOULDBLOCK, or EINPROGRESS (for 
[connect](https://linux.die.net/man/2/connect)(2)) just as if the socket was 
specified to be nonblocking. If the timeout is set to zero (the default) then 
the operation will never timeout. Timeouts only have effect for system calls 
that perform socket I/O (e.g., [read](https://linux.die.net/man/2/read)(2), 
[recvmsg](https://linux.die.net/man/2/recvmsg)(2), 
[send](https://linux.die.net/man/2/send)(2), 
[sendmsg](https://linux.die.net/man/2/sendmsg)(2)); timeouts have no effect for 
[select](https://linux.die.net/man/2/select)(2), 
[poll](https://linux.die.net/man/2/poll)(
 2), [epoll_wait](https://linux.die.net/man/2/epoll_wait)(2), and so on.



-- 
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: issues-unsubscr...@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to