Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
Arthur Britto
2013-02-04 15:40:54 -08:00
5 changed files with 22 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ void SqliteDatabase::connect()
int rc = sqlite3_open(mHost.c_str(), &mConnection);
if (rc)
{
cLog(lsFATAL) << "Can't open database: " << mHost << " " << rc;
cLog(lsFATAL) << "Can't open " << mHost << " " << rc;
sqlite3_close(mConnection);
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
}
@@ -51,7 +51,7 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
if (!fail_ok)
{
#ifdef DEBUG
cLog(lsWARNING) << "SQL Perror:" << rc;
cLog(lsWARNING) << "Perror:" << mHost << ": " << rc;
cLog(lsWARNING) << "Statement: " << sql;
cLog(lsWARNING) << "Error: " << sqlite3_errmsg(mConnection);
#endif
@@ -69,13 +69,17 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
}
else
{
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
if ((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED))
{
cLog(lsFATAL) << mHost << " returns error " << rc << ": " << sqlite3_errmsg(mConnection);
assert(false);
}
mMoreRows = false;
if (!fail_ok)
{
#ifdef DEBUG
cLog(lsWARNING) << "SQL Serror:" << rc;
cLog(lsWARNING) << "SQL Serror:" << mHost << ": " << rc;
cLog(lsWARNING) << "Statement: " << sql;
cLog(lsWARNING) << "Error: " << sqlite3_errmsg(mConnection);
#endif
@@ -135,7 +139,7 @@ bool SqliteDatabase::getNextRow()
else
{
assert((rc != SQLITE_BUSY) && (rc != SQLITE_LOCKED));
cLog(lsWARNING) << "SQL Rerror:" << rc;
cLog(lsWARNING) << "Rerror: " << mHost << ": " << rc;
return(false);
}
}
@@ -244,8 +248,8 @@ void SqliteDatabase::runWal()
int ret = sqlite3_wal_checkpoint_v2(mConnection, db.c_str(), SQLITE_CHECKPOINT_PASSIVE, &log, &ckpt);
if (ret != SQLITE_OK)
{
cLog((ret == SQLITE_LOCKED) ? lsDEBUG : lsWARNING) << "WAL "
<< sqlite3_db_filename(mConnection, "main") << " / " << db << " errror " << ret;
cLog((ret == SQLITE_LOCKED) ? lsDEBUG : lsWARNING) << "WAL " << mHost << ":"
<< db << " errror " << ret;
}
}
walSet.clear();

View File

@@ -166,7 +166,7 @@ void Application::setup()
//
// Allow peer connections.
//
if (!theConfig.RUN_STANDALONE && !theConfig.PEER_IP.empty() && theConfig.PEER_PORT)
if (!theConfig.RUN_STANDALONE)
{
try
{

View File

@@ -694,7 +694,7 @@ int commandLineRPC(const std::vector<std::string>& vCmd)
return nRet;
}
#define RPC_NOTIFY_MAX_BYTES 8192
#define RPC_REPLY_MAX_BYTES (128*1024*1024)
#define RPC_NOTIFY_SECONDS 10
bool responseRPC(
@@ -787,7 +787,7 @@ void callRPC(
jvParams,
mapRequestHeaders,
"/", _1, _2),
RPC_NOTIFY_MAX_BYTES,
RPC_REPLY_MAX_BYTES,
boost::posix_time::seconds(RPC_NOTIFY_SECONDS),
boost::bind(&responseRPC, callbackFuncP, _1, _2, _3));
}

View File

@@ -35,9 +35,12 @@ PeerDoor::PeerDoor(boost::asio::io_service& io_service) :
if (1 != SSL_CTX_set_cipher_list(mCtx.native_handle(), theConfig.PEER_SSL_CIPHER_LIST.c_str()))
std::runtime_error("Error setting cipher list (no valid ciphers).");
Log(lsINFO) << "Peer port: " << theConfig.PEER_IP << " " << theConfig.PEER_PORT;
startListening();
if (!theConfig.PEER_IP.empty() && theConfig.PEER_PORT)
{
Log(lsINFO) << "Peer port: " << theConfig.PEER_IP << " " << theConfig.PEER_PORT;
startListening();
}
}
void PeerDoor::startListening()