/** * @brief initialize * * Initialize the sync debugger. Pass true for a server (this requires approx. * 144 megabytes on 32 bit systems and 240 megabytes on 64 bit systems) and * false for a client (requires only 16 megabytes extra). */ void CSyncDebugger::Initialize(bool useBacktrace) { delete[] history; history = 0; delete[] historybt; historybt = 0; #ifdef HAVE_BACKTRACE if (useBacktrace) { historybt = new HistItemWithBacktrace[HISTORY_SIZE * BLOCK_SIZE]; memset(historybt, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItemWithBacktrace)); } else #endif { history = new HistItem[HISTORY_SIZE * BLOCK_SIZE]; memset(history, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItem)); } //cleanup historyIndex = 0; disable_history = false; may_enable_history = false; flop = 0; for (int j = 0; j < MAX_PLAYERS; ++j) { checksumResponses[j].clear(); remoteHistory[j].clear(); remoteFlop[j] = 0; } pendingBlocksToRequest.clear(); waitingForBlockResponse = false; // init logger logger.SetFilename(useBacktrace ? LOGFILE_SERVER : LOGFILE_CLIENT); }
void CSyncDebugger::Initialize(bool useBacktrace, unsigned numPlayers) { delete[] history; history = NULL; delete[] historybt; historybt = NULL; #ifdef HAVE_BACKTRACE if (useBacktrace) { historybt = new HistItemWithBacktrace[HISTORY_SIZE * BLOCK_SIZE]; memset(historybt, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItemWithBacktrace)); } else #endif { history = new HistItem[HISTORY_SIZE * BLOCK_SIZE]; memset(history, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItem)); } //cleanup historyIndex = 0; disable_history = false; may_enable_history = false; flop = 0; players.clear(); players.resize(numPlayers); pendingBlocksToRequest.clear(); waitingForBlockResponse = false; // init logger logger.SetFilename(useBacktrace ? LOGFILE_SERVER : LOGFILE_CLIENT); logger.AddLine("SyncDebugger initialized"); logger.FlushBuffer(); }
/** * @brief initialize * * Initialize the sync debugger. Pass true for a server (this requires approx. * 144 megabytes on 32 bit systems and 240 megabytes on 64 bit systems) and * false for a client (requires only 16 megabytes extra). * FIXME update this comment to reflect new values */ void CSyncDebugger::Initialize(bool useBacktrace, unsigned numPlayers) { delete[] history; history = 0; delete[] historybt; historybt = 0; #ifdef HAVE_BACKTRACE if (useBacktrace) { historybt = new HistItemWithBacktrace[HISTORY_SIZE * BLOCK_SIZE]; memset(historybt, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItemWithBacktrace)); } else #endif { history = new HistItem[HISTORY_SIZE * BLOCK_SIZE]; memset(history, 0, HISTORY_SIZE * BLOCK_SIZE * sizeof(HistItem)); } //cleanup historyIndex = 0; disable_history = false; may_enable_history = false; flop = 0; for (unsigned j = 0; j < numPlayers; ++j) { PlayerStruct buf; buf.checksumResponses.clear(); buf.remoteHistory.clear(); buf.remoteFlop = 0; players.push_back(buf); } pendingBlocksToRequest.clear(); waitingForBlockResponse = false; // init logger logger.SetFilename(useBacktrace ? LOGFILE_SERVER : LOGFILE_CLIENT); logger.AddLine("Syncdebugger initialised"); logger.FlushBuffer(); }