You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2023/06/14 05:19:03 UTC

[GitHub] [pulsar-client-cpp] BewareMyPower commented on pull request #284: Close the socket gracefully on Windows

BewareMyPower commented on PR #284:
URL: https://github.com/apache/pulsar-client-cpp/pull/284#issuecomment-1590485990

   Here are some tests results with debug logs based on this patch.
   
   Without calling `shutdown`, the error log is always:
   
   ```
   # error code: connection_aborted ("The network connection was aborted by the local system")
   2023-06-14 13:14:15.190 DEBUG [11468] ..\..\..\lib\ClientConnection:615 | [[::1]:10740 -> [::1]:6650] Server closed the connection:  由本地系统中止网络连接。
   ```
   
   With calling `shutdown`, the error log will be:
   
   ```
   # error code: operation_aborted ("Operation cancelled")
   2023-06-14 13:15:08.607 DEBUG [21080] ..\..\..\lib\ClientConnection:613 | [[::1]:10745 -> [::1]:6650] Read operation was canceled: 由于线程退出或应用程序请求,已中止 I/O 操作。
   ```
   
   There is a little chance that the error code could be `eof` (`value()` is 2 on Windows) when I debugged it in my IDE so I handled the EOF error the same way with `bytesTransferred == 0` because they both mean the socket client calls `recv` while the socket server has already closed.
   
   ![image](https://github.com/apache/pulsar-client-cpp/assets/18204803/eafbc7e0-775f-497d-bb2a-12458269dcac)
   


-- 
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: commits-unsubscribe@pulsar.apache.org

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