library/src/network/BP-Network.cc
// Destroys a network handle and all of its allocations.
Destroys a network handle and all of its allocations.
Destroys a network handle and all of its allocations .
BP_ERROR_T BP_DestroyNetworkHandle(P_BP_NETWORK_HANDLE net_handle)
{
	if(!net_handle)
		return ERR_FAILURE;
	if(!net_handle->sslOpts)
		return ERR_FAILURE;
	if(net_handle->sslOpts->context)
		SSL_CTX_free(net_handle->sslOpts->context);
	if(net_handle->sslOpts->ssl)
		SSL_free(net_handle->sslOpts->ssl);
	if(net_handle->sock)
	{
		shutdown(net_handle->sock, 2);
	}
	BP_DestroyLinkL(net_handle->tq, BP_TRUE);
	bpfree(net_handle);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_DestroyNetworkHandle ( P_BP_NETWORK_HANDLE net_handle ) { if ( ! net_handle ) return ERR_FAILURE ; if ( ! net_handle -> sslOpts ) return ERR_FAILURE ; if ( net_handle -> sslOpts -> context ) SSL_CTX_free ( net_handle -> sslOpts -> context ) ; if ( net_handle -> sslOpts -> ssl ) SSL_free ( net_handle -> sslOpts -> ssl ) ; if ( net_handle -> sock ) { shutdown ( net_handle -> sock , 2 ) ; } BP_DestroyLinkL ( net_handle -> tq , BP_TRUE ) ; bpfree ( net_handle ) ; return ERR_SUCCESS ; }
Destroys a network handle and all of its allocations.
Destroys a network handle and all of its allocations .
// ensure we have a handle // ensure we have ssl options (should always be allocated, and thus set) // destroy the ssl context here // destroy ssl object // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Shutdown Socket %%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // if we have a socket, shut it down (don't use close, as close can get stuck // waiting for data transmission to finish). // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Destroy the LinkL and Exit %%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // destroy the tail queue // destroy the net handle // return