astitcher commented on code in PR #402:
URL: https://github.com/apache/qpid-proton/pull/402#discussion_r1304458209


##########
c/src/proactor/epoll_raw_connection.c:
##########
@@ -408,32 +415,41 @@ pn_event_batch_t *pni_raw_connection_process(task_t *t, 
uint32_t io_events, bool
   }
   unlock(&rc->task.mutex);
 
-  if (events & EPOLLIN) pni_raw_read(&rc->raw_connection, fd, rcv, set_error);
-  if (events & EPOLLOUT) pni_raw_write(&rc->raw_connection, fd, snd, 
set_error);
-  rc->batch_empty = false;
+  if (rc->connected) {
+    if (events & EPOLLERR) {
+      // Read and write sides closed via RST.  Tear down immediately.
+      int soerr;
+      socklen_t soerrlen = sizeof(soerr);
+      int ec = getsockopt(fd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen);
+      if (ec == 0 && soerr) {
+        psocket_error(rc, soerr, "async disconnect");
+      }
+      pni_raw_async_disconnect(&rc->raw_connection);
+    } else if (events & EPOLLHUP) {
+      rc->hup_detected = true;
+    }
+
+    if (events & (EPOLLIN || EPOLLRDHUP) || rc->read_check) {

Review Comment:
   This line fails to compile (at least with the gcc 12 version I'm using)!!
   EPOLLIN || EPOLLRDHUP is not what you mean to say!
   This looks to me like it would render the test completely invalid anyway as 
the result would always be 1



-- 
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: dev-unsubscr...@qpid.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to