Add a comment to shutdown() in ncclSocketClose

이 커밋은 다음에 포함됨:
Kaiming Ouyang가 2023-04-13 09:13:44 -07:00를 커밋했습니다
1 부모 367e9b61c3
커밋 006b6bc7dc
1 파일이 변경됨
+4
+4
파일 보기
@@ -819,6 +819,10 @@ ncclResult_t ncclSocketTryRecv(struct ncclSocket* sock, void* ptr, int size, int
ncclResult_t ncclSocketClose(struct ncclSocket* sock) {
if (sock != NULL) {
if (sock->fd >= 0) {
/* shutdown() is needed to send FIN packet to proxy thread; shutdown() is not affected
* by refcount of fd, but close() is. close() won't close a fd and send FIN packet if
* the fd is duplicated (e.g. fork()). So shutdown() guarantees the correct and graceful
* connection close here. */
shutdown(sock->fd, SHUT_RDWR);
close(sock->fd);
}