Esempio n. 1
0
LLSocket::LLSocket(apr_socket_t* socket, apr_pool_t* pool) :
	mSocket(socket),
	mPool(pool),
	mPort(PORT_INVALID)
{
	ll_debug_socket("Constructing wholely formed socket", mSocket);
}
Esempio n. 2
0
LLSocket::LLSocket(apr_socket_t* socket, apr_pool_t* pool) :
	mSocket(socket),
	mPool(pool),
	mPort(PORT_INVALID)
{
	ll_debug_socket("Constructing wholely formed socket", mSocket);
	LLMemType m1(LLMemType::MTYPE_IO_TCP);
}
LLSocket::~LLSocket()
{
	// *FIX: clean up memory we are holding.
	if(mSocket)
	{
		ll_debug_socket("Destroying socket", mSocket);
		apr_socket_close(mSocket);
		mSocket = NULL;
	}
}
Esempio n. 4
0
LLSocket::~LLSocket()
{
	LLMemType m1(LLMemType::MTYPE_IO_TCP);
	// *FIX: clean up memory we are holding.
	if(mSocket)
	{
		ll_debug_socket("Destroying socket", mSocket);
		apr_socket_close(mSocket);
	}
}
bool LLSocket::blockingConnect(const LLHost& host)
{
	if(!mSocket) return false;
	apr_sockaddr_t* sa = NULL;
	std::string ip_address;
	ip_address = host.getIPString();
	if(ll_apr_warn_status(apr_sockaddr_info_get(
		&sa,
		ip_address.c_str(),
		APR_UNSPEC,
		host.getPort(),
		0,
		mPool())))
	{
		return false;
	}
	setBlocking(1000);
	ll_debug_socket("Blocking connect", mSocket);
	if(ll_apr_warn_status(apr_socket_connect(mSocket, sa))) return false;
	setNonBlocking();
	return true;
}