MCPcopy Create free account
hub / github.com/SFML/SFML / disconnect

Method disconnect

src/SFML/Network/TcpSocket.cpp:946–966  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

944
945////////////////////////////////////////////////////////////
946void TcpSocket::disconnect()
947{
948 if (m_impl->tlsState)
949 {
950 if (m_impl->tlsState->handshakeComplete)
951 {
952 if (auto result = mbedtls_ssl_close_notify(&m_impl->tlsState->sslContext);
953 (result != 0 && result != MBEDTLS_ERR_SSL_WANT_READ && result != MBEDTLS_ERR_SSL_WANT_WRITE &&
954 result != MBEDTLS_ERR_NET_CONN_RESET))
955 err() << "Failed to notify TLS peer connection is being closed: " << tlsErrorString(result) << std::endl;
956 }
957
958 m_impl->tlsState.reset();
959 }
960
961 // Close the socket
962 close();
963
964 // Reset the pending packet data
965 m_pendingPacket = PendingPacket();
966}
967
968
969////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 4

tlsErrorStringFunction · 0.85
closeFunction · 0.85
PendingPacketClass · 0.85
resetMethod · 0.80

Tested by

no test coverage detected