void DisconnectServer(AgentConnection *conn) { if (conn) { if (conn->sd >= 0) /* Not INVALID or OFFLINE */ { cf_closesocket(conn->sd); conn->sd = SOCKET_INVALID; } DeleteAgentConn(conn); } }
void DisconnectServer(AgentConnection *conn) { /* Socket needs to be closed even after SSL_shutdown. */ if (conn->conn_info->sd >= 0) /* Not INVALID or OFFLINE */ { if (conn->conn_info->protocol >= CF_PROTOCOL_TLS && conn->conn_info->ssl != NULL) { SSL_shutdown(conn->conn_info->ssl); } cf_closesocket(conn->conn_info->sd); conn->conn_info->sd = SOCKET_INVALID; Log(LOG_LEVEL_VERBOSE, "Connection to %s is closed", conn->remoteip); } DeleteAgentConn(conn); }