MCPcopy Create free account
hub / github.com/catboost/catboost / Close

Method Close

util/network/socket.cpp:561–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559#endif
560
561void TSocketHolder::Close() noexcept {
562 if (Fd_ != INVALID_SOCKET) {
563 bool ok = (closesocket(Fd_) == 0);
564 if (!ok) {
565// Do not quietly close bad descriptor,
566// because often it means double close
567// that is disasterous
568#ifdef _win_
569 Y_ABORT_UNLESS(WSAGetLastError() != WSAENOTSOCK, "must not quietly close bad socket descriptor");
570#elif defined(_unix_)
571 Y_ABORT_UNLESS(errno != EBADF, "must not quietly close bad descriptor: fd=%d", int(Fd_));
572#else
573 #error unsupported platform
574#endif
575 }
576
577 Fd_ = INVALID_SOCKET;
578 }
579}
580
581class TSocket::TImpl: public TAtomicRefCount<TImpl> {
582 using TOps = TSocket::TOps;

Callers 2

TestCloseMethod · 0.45
CloseMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestCloseMethod · 0.36