Random stab in the dark coming right up!

This commit is contained in:
Siana Gearz
2012-07-21 05:36:45 +02:00
parent 1e81966b89
commit 15086833a3
13 changed files with 141 additions and 166 deletions

View File

@@ -50,7 +50,6 @@
#include "llstring.h"
#include "lluuid.h"
#include "net.h"
#include "llaprpool.h"
//
// constants
@@ -58,7 +57,7 @@
const size_t LL_MAX_KNOWN_GOOD_MAIL_SIZE = 4096;
static bool gMailEnabled = true;
static LLAPRPool gMailPool;
static apr_pool_t* gMailPool;
static apr_sockaddr_t* gSockAddr;
static apr_socket_t* gMailSocket;
@@ -83,7 +82,7 @@ bool connect_smtp()
gSockAddr->sa.sin.sin_family,
SOCK_STREAM,
APR_PROTO_TCP,
gMailPool());
gMailPool);
if(ll_apr_warn_status(status)) return false;
status = apr_socket_connect(gMailSocket, gSockAddr);
if(ll_apr_warn_status(status))
@@ -140,19 +139,19 @@ BOOL LLMail::send(
}
// static
void LLMail::init(const std::string& hostname)
void LLMail::init(const std::string& hostname, apr_pool_t* pool)
{
gMailSocket = NULL;
if (hostname.empty())
if(hostname.empty() || !pool)
{
gMailPool = NULL;
gSockAddr = NULL;
gMailPool.destroy();
}
else
{
gMailPool.create();
gMailPool = pool;
// Collect all the information into a sockaddr structure. the
// collect all the information into a socaddr sturcture. the
// documentation is a bit unclear, but I either have to
// specify APR_UNSPEC or not specify any flags. I am not sure
// which option is better.
@@ -162,7 +161,7 @@ void LLMail::init(const std::string& hostname)
APR_UNSPEC,
25,
APR_IPV4_ADDR_OK,
gMailPool());
gMailPool);
ll_apr_warn_status(status);
}
}