- added more debug code and fixed a server bug where client connecting at the same time a server opens a slot would result in a crash sometimes.
This commit is contained in:
parent
e8cc925a8b
commit
0069fbf4f0
|
@ -233,9 +233,9 @@ CommandResult Commander::pushNetworkCommand(const NetworkCommand* networkCommand
|
||||||
CommandResult cr= crSuccess;
|
CommandResult cr= crSuccess;
|
||||||
|
|
||||||
//validate unit
|
//validate unit
|
||||||
if(unit==NULL){
|
if(unit == NULL) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
sprintf(szBuf,"In [%s::%s - %d] Command refers to non existant unit id = %d. Game out of synch.",
|
sprintf(szBuf,"In [%s::%s - %d] Command refers to non existent unit id = %d. Game out of synch.",
|
||||||
__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ CommandResult Commander::pushNetworkCommand(const NetworkCommand* networkCommand
|
||||||
gameNetworkInterface->requestCommand(networkCommand);
|
gameNetworkInterface->requestCommand(networkCommand);
|
||||||
|
|
||||||
//calculate the result of the command
|
//calculate the result of the command
|
||||||
if(networkCommand->getNetworkCommandType()==nctGiveCommand){
|
if(networkCommand->getNetworkCommandType() == nctGiveCommand) {
|
||||||
Command* command= buildCommand(networkCommand);
|
Command* command= buildCommand(networkCommand);
|
||||||
cr= unit->checkCommand(command);
|
cr= unit->checkCommand(command);
|
||||||
delete command;
|
delete command;
|
||||||
|
|
|
@ -509,7 +509,7 @@ void MenuStateConnectedGame::update()
|
||||||
hasFactions = loadFactions(gameSettings);
|
hasFactions = loadFactions(gameSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] hasFactions = %d\n",__FILE__,__FUNCTION__,__LINE__,hasFactions);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] hasFactions = %d\n",__FILE__,__FUNCTION__,__LINE__,hasFactions);
|
||||||
|
|
||||||
// map
|
// map
|
||||||
maps.push_back(formatString(gameSettings->getMap()));
|
maps.push_back(formatString(gameSettings->getMap()));
|
||||||
|
@ -519,7 +519,7 @@ void MenuStateConnectedGame::update()
|
||||||
currentMap = gameSettings->getMap();
|
currentMap = gameSettings->getMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// FogOfWar
|
// FogOfWar
|
||||||
if(gameSettings->getFogOfWar()){
|
if(gameSettings->getFogOfWar()){
|
||||||
|
@ -530,7 +530,7 @@ void MenuStateConnectedGame::update()
|
||||||
listBoxFogOfWar.setSelectedItemIndex(1);
|
listBoxFogOfWar.setSelectedItemIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||||
|
@ -539,10 +539,10 @@ void MenuStateConnectedGame::update()
|
||||||
listBoxTeams[i].setEditable(false);
|
listBoxTeams[i].setEditable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(hasFactions == true) {
|
if(hasFactions == true) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
for(int i=0; i<gameSettings->getFactionCount(); ++i){
|
for(int i=0; i<gameSettings->getFactionCount(); ++i){
|
||||||
int slot=gameSettings->getStartLocationIndex(i);
|
int slot=gameSettings->getStartLocationIndex(i);
|
||||||
|
|
|
@ -221,6 +221,13 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
updateControlers();
|
updateControlers();
|
||||||
updateNetworkSlots();
|
updateNetworkSlots();
|
||||||
|
|
||||||
|
// Esnure we have set the gamesettings at least once
|
||||||
|
GameSettings gameSettings;
|
||||||
|
loadGameSettings(&gameSettings);
|
||||||
|
|
||||||
|
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
|
||||||
|
serverInterface->setGameSettings(&gameSettings,true);
|
||||||
|
|
||||||
//chatManager.init(&console, world.getThisTeamIndex());
|
//chatManager.init(&console, world.getThisTeamIndex());
|
||||||
chatManager.init(&console, -1);
|
chatManager.init(&console, -1);
|
||||||
|
|
||||||
|
|
|
@ -243,17 +243,17 @@ bool NetworkMessageCommandList::addCommand(const NetworkCommand* networkCommand)
|
||||||
bool NetworkMessageCommandList::receive(Socket* socket){
|
bool NetworkMessageCommandList::receive(Socket* socket){
|
||||||
// _peek_ type, commandCount & frame num first.
|
// _peek_ type, commandCount & frame num first.
|
||||||
if (!NetworkMessage::peek(socket, &data, commandListHeaderSize)) {
|
if (!NetworkMessage::peek(socket, &data, commandListHeaderSize)) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] WARNING!!! NetworkMessage::peek failed!\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING!!! NetworkMessage::peek failed!\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] messageType = %d, frameCount = %d, data.commandCount = %d\n",
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] messageType = %d, frameCount = %d, data.commandCount = %d\n",
|
||||||
__FILE__,__FUNCTION__,__LINE__,data.messageType,data.frameCount,data.commandCount);
|
__FILE__,__FUNCTION__,__LINE__,data.messageType,data.frameCount,data.commandCount);
|
||||||
|
|
||||||
// read header + data.commandCount commands.
|
// read header + data.commandCount commands.
|
||||||
int totalMsgSize = commandListHeaderSize + sizeof(NetworkCommand) * data.commandCount;
|
int totalMsgSize = commandListHeaderSize + sizeof(NetworkCommand) * data.commandCount;
|
||||||
if (socket->getDataToRead() < totalMsgSize) {
|
if (socket->getDataToRead() < totalMsgSize) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] WARNING!!! Insufficient data to read entire command list [need %d bytes, only %d available].\n",
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING!!! Insufficient data to read entire command list [need %d bytes, only %d available].\n",
|
||||||
__FILE__,__FUNCTION__,__LINE__, totalMsgSize, socket->getDataToRead());
|
__FILE__,__FUNCTION__,__LINE__, totalMsgSize, socket->getDataToRead());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ bool NetworkMessageCommandList::receive(Socket* socket){
|
||||||
for(int idx = 0 ; idx < data.commandCount; ++idx) {
|
for(int idx = 0 ; idx < data.commandCount; ++idx) {
|
||||||
const NetworkCommand &cmd = data.commands[idx];
|
const NetworkCommand &cmd = data.commands[idx];
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] index = %d, received networkCommand [%s]\n",
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] index = %d, received networkCommand [%s]\n",
|
||||||
__FILE__,__FUNCTION__,__LINE__,idx, cmd.toString().c_str());
|
__FILE__,__FUNCTION__,__LINE__,idx, cmd.toString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,14 +274,14 @@ void NetworkMessageCommandList::send(Socket* socket) const{
|
||||||
NetworkMessage::send(socket, &data, commandListHeaderSize + sizeof(NetworkCommand) * data.commandCount);
|
NetworkMessage::send(socket, &data, commandListHeaderSize + sizeof(NetworkCommand) * data.commandCount);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled == true) {
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled == true) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] messageType = %d, frameCount = %d, data.commandCount = %d\n",
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] messageType = %d, frameCount = %d, data.commandCount = %d\n",
|
||||||
__FILE__,__FUNCTION__,__LINE__,data.messageType,data.frameCount,data.commandCount);
|
__FILE__,__FUNCTION__,__LINE__,data.messageType,data.frameCount,data.commandCount);
|
||||||
|
|
||||||
if (data.commandCount) {
|
if (data.commandCount > 0) {
|
||||||
for(int idx = 0 ; idx < data.commandCount; ++idx) {
|
for(int idx = 0 ; idx < data.commandCount; ++idx) {
|
||||||
const NetworkCommand &cmd = data.commands[idx];
|
const NetworkCommand &cmd = data.commands[idx];
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s %d] index = %d, sent networkCommand [%s]\n",
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] index = %d, sent networkCommand [%s]\n",
|
||||||
__FILE__,__FUNCTION__,__LINE__,idx, cmd.toString().c_str());
|
__FILE__,__FUNCTION__,__LINE__,idx, cmd.toString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,14 @@ void Command::setUnit(Unit *unit){
|
||||||
|
|
||||||
std::string Command::toString() const {
|
std::string Command::toString() const {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
result = "commandType = " + commandType->toString() + " pos = " + pos.getString() + " facing = " + intToStr(facing.asInt());
|
result = "commandType id = " + intToStr(commandType->getId()) + ", desc = " + commandType->toString() + ", pos = " + pos.getString() + ", facing = " + intToStr(facing.asInt());
|
||||||
|
|
||||||
|
if(unitRef.getUnit() != NULL) {
|
||||||
|
result += ", unitRef.getUnit() = " + unitRef.getUnit()->toString();
|
||||||
|
}
|
||||||
|
|
||||||
if(unitType != NULL) {
|
if(unitType != NULL) {
|
||||||
result += " unitTypeId = " + intToStr(unitType->getId()) + " unitTypeDesc = " + unitType->getReqDesc();
|
result += ", unitTypeId = " + intToStr(unitType->getId()) + ", unitTypeDesc = " + unitType->getReqDesc();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Command{
|
||||||
private:
|
private:
|
||||||
const CommandType *commandType;
|
const CommandType *commandType;
|
||||||
Vec2i pos;
|
Vec2i pos;
|
||||||
UnitReference unitRef; //target unit, used to move and attack optinally
|
UnitReference unitRef; //target unit, used to move and attack optionally
|
||||||
CardinalDir facing; // facing, for build command
|
CardinalDir facing; // facing, for build command
|
||||||
const UnitType *unitType; //used for build
|
const UnitType *unitType; //used for build
|
||||||
|
|
||||||
|
|
|
@ -506,19 +506,15 @@ unsigned int Unit::getCommandSize() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
//give one command (clear, and push back)
|
//give one command (clear, and push back)
|
||||||
CommandResult Unit::giveCommand(Command *command, bool tryQueue){
|
CommandResult Unit::giveCommand(Command *command, bool tryQueue) {
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit id = %d name = %s, Command [%s] tryQueue = %d\n",__FILE__,__FUNCTION__, __LINE__,this->id,this->type->getName().c_str(), command->toString().c_str(),tryQueue);
|
||||||
|
|
||||||
assert(command != NULL);
|
assert(command != NULL);
|
||||||
|
|
||||||
assert(command->getCommandType() != NULL);
|
assert(command->getCommandType() != NULL);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] [%d]\n",__FILE__,__FUNCTION__,__LINE__,command->getCommandType()->getId());
|
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
const int command_priority = command->getCommandType()->getPriority();
|
const int command_priority = command->getCommandType()->getPriority();
|
||||||
|
|
||||||
|
@ -528,7 +524,8 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue){
|
||||||
if ((*i)->getCommandType()->getPriority() < command_priority) {
|
if ((*i)->getCommandType()->getPriority() < command_priority) {
|
||||||
deleteSingleCommand(*i);
|
deleteSingleCommand(*i);
|
||||||
i = commands.erase(i);
|
i = commands.erase(i);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +537,7 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue){
|
||||||
cancelCommand();
|
cancelCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
//empty command queue
|
//empty command queue
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
clearCommands();
|
clearCommands();
|
||||||
|
@ -552,7 +549,7 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue){
|
||||||
//check command
|
//check command
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
CommandResult result= checkCommand(command);
|
CommandResult result= checkCommand(command);
|
||||||
if(result==crSuccess){
|
if(result == crSuccess) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
applyCommand(command);
|
applyCommand(command);
|
||||||
}
|
}
|
||||||
|
@ -560,16 +557,16 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue){
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] B\n",__FILE__,__FUNCTION__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] B\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
//push back command
|
//push back command
|
||||||
if(result== crSuccess){
|
if(result == crSuccess) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
commands.push_back(command);
|
commands.push_back(command);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
delete command;
|
delete command;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] result = %d\n",__FILE__,__FUNCTION__,__LINE__,result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1277,7 @@ std::string Unit::toString() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->faction != NULL) {
|
if(this->faction != NULL) {
|
||||||
result = "FactionIndex = " + intToStr(this->faction->getIndex()) + "\n";
|
result += "\nFactionIndex = " + intToStr(this->faction->getIndex()) + "\n";
|
||||||
result += "teamIndex = " + intToStr(this->faction->getTeam()) + "\n";
|
result += "teamIndex = " + intToStr(this->faction->getTeam()) + "\n";
|
||||||
result += "startLocationIndex = " + intToStr(this->faction->getStartLocationIndex()) + "\n";
|
result += "startLocationIndex = " + intToStr(this->faction->getStartLocationIndex()) + "\n";
|
||||||
result += "thisFaction = " + intToStr(this->faction->getThisFaction()) + "\n";
|
result += "thisFaction = " + intToStr(this->faction->getThisFaction()) + "\n";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of Glest Shared Library (www.glest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2001-2008 Martio Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -28,12 +28,9 @@ namespace Shared{ namespace Graphics{ namespace Gl{
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
void ContextGl::init(){
|
void ContextGl::init(){
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
|
|
||||||
pcgl.init(colorBits, depthBits, stencilBits);
|
pcgl.init(colorBits, depthBits, stencilBits);
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextGl::end(){
|
void ContextGl::end(){
|
||||||
|
@ -41,11 +38,9 @@ void ContextGl::end(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextGl::makeCurrent(){
|
void ContextGl::makeCurrent(){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
pcgl.makeCurrent();
|
pcgl.makeCurrent();
|
||||||
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextGl::swapBuffers(){
|
void ContextGl::swapBuffers(){
|
||||||
|
|
|
@ -286,7 +286,7 @@ bool EndsWith(const string &str, const string& key)
|
||||||
//finds all filenames like path and gets their checksum of all files combined
|
//finds all filenames like path and gets their checksum of all files combined
|
||||||
int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string pathSearchString, const string filterFileExt, Checksum *recursiveChecksum) {
|
int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string pathSearchString, const string filterFileExt, Checksum *recursiveChecksum) {
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
// !!! OLD local CACHE
|
// !!! OLD local CACHE
|
||||||
//static std::map<string,int32> crcTreeCache;
|
//static std::map<string,int32> crcTreeCache;
|
||||||
|
@ -309,7 +309,7 @@ int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string path
|
||||||
for(size_t idx = 0; idx < count; ++idx) {
|
for(size_t idx = 0; idx < count; ++idx) {
|
||||||
string path = paths[idx] + pathSearchString;
|
string path = paths[idx] + pathSearchString;
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s], filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s], filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
||||||
|
|
||||||
getFolderTreeContentsCheckSumRecursively(path, filterFileExt, &checksum);
|
getFolderTreeContentsCheckSumRecursively(path, filterFileExt, &checksum);
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string path
|
||||||
|
|
||||||
//finds all filenames like path and gets their checksum of all files combined
|
//finds all filenames like path and gets their checksum of all files combined
|
||||||
int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum) {
|
int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
||||||
|
|
||||||
// !!! OLD local CACHE
|
// !!! OLD local CACHE
|
||||||
//static std::map<string,int32> crcTreeCache;
|
//static std::map<string,int32> crcTreeCache;
|
||||||
|
@ -377,7 +377,7 @@ int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addFile) {
|
if(addFile) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] adding file [%s]\n",__FILE__,__FUNCTION__,p);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] adding file [%s]\n",__FILE__,__FUNCTION__,p);
|
||||||
|
|
||||||
checksum.addFile(p);
|
checksum.addFile(p);
|
||||||
fileMatchCount++;
|
fileMatchCount++;
|
||||||
|
@ -445,7 +445,7 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(ve
|
||||||
getFolderTreeContentsCheckSumListRecursively(path, filterFileExt, &checksumFiles);
|
getFolderTreeContentsCheckSumListRecursively(path, filterFileExt, &checksumFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
crcTreeCache[cacheKey] = checksumFiles;
|
crcTreeCache[cacheKey] = checksumFiles;
|
||||||
return crcTreeCache[cacheKey];
|
return crcTreeCache[cacheKey];
|
||||||
|
@ -453,7 +453,7 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(ve
|
||||||
|
|
||||||
//finds all filenames like path and gets the checksum of each file
|
//finds all filenames like path and gets the checksum of each file
|
||||||
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap) {
|
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s] filterFileExt = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),filterFileExt.c_str());
|
||||||
|
|
||||||
//static std::map<string,vector<std::pair<string,int32> > > crcTreeCache;
|
//static std::map<string,vector<std::pair<string,int32> > > crcTreeCache;
|
||||||
string cacheLookupId = string(__FILE__) + intToStr(__LINE__);
|
string cacheLookupId = string(__FILE__) + intToStr(__LINE__);
|
||||||
|
@ -467,7 +467,7 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(co
|
||||||
|
|
||||||
vector<std::pair<string,int32> > checksumFiles = (recursiveMap == NULL ? vector<std::pair<string,int32> >() : *recursiveMap);
|
vector<std::pair<string,int32> > checksumFiles = (recursiveMap == NULL ? vector<std::pair<string,int32> >() : *recursiveMap);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] scanning [%s]\n",__FILE__,__FUNCTION__,path.c_str());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] scanning [%s]\n",__FILE__,__FUNCTION__,path.c_str());
|
||||||
|
|
||||||
std::string mypath = path;
|
std::string mypath = path;
|
||||||
/** Stupid win32 is searching for all files without extension when *. is
|
/** Stupid win32 is searching for all files without extension when *. is
|
||||||
|
|
|
@ -872,32 +872,26 @@ int Socket::getDataToRead(){
|
||||||
|
|
||||||
int Socket::send(const void *data, int dataSize) {
|
int Socket::send(const void *data, int dataSize) {
|
||||||
ssize_t bytesSent= 0;
|
ssize_t bytesSent= 0;
|
||||||
if(isSocketValid() == true)
|
if(isSocketValid() == true) {
|
||||||
{
|
|
||||||
bytesSent = ::send(sock, reinterpret_cast<const char*>(data), dataSize, 0);
|
bytesSent = ::send(sock, reinterpret_cast<const char*>(data), dataSize, 0);
|
||||||
}
|
}
|
||||||
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN)
|
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText().c_str());
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,bytesSent,getLastSocketErrorFormattedText().c_str());
|
|
||||||
//throwException(szBuf);
|
//throwException(szBuf);
|
||||||
}
|
}
|
||||||
else if(bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)
|
else if(bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__);
|
|
||||||
|
|
||||||
time_t tStartTimer = time(NULL);
|
time_t tStartTimer = time(NULL);
|
||||||
while((bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5))
|
while((bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5)) {
|
||||||
{
|
if(Socket::isWritable(true) == true) {
|
||||||
if(Socket::isWritable(true) == true)
|
|
||||||
{
|
|
||||||
bytesSent = ::send(sock, reinterpret_cast<const char*>(data), dataSize, 0);
|
bytesSent = ::send(sock, reinterpret_cast<const char*>(data), dataSize, 0);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during send, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesSent);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during send, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesSent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bytesSent <= 0)
|
if(bytesSent <= 0) {
|
||||||
{
|
|
||||||
int iErr = getLastSocketError();
|
int iErr = getLastSocketError();
|
||||||
disconnectSocket();
|
disconnectSocket();
|
||||||
|
|
||||||
|
@ -914,24 +908,19 @@ int Socket::receive(void *data, int dataSize)
|
||||||
{
|
{
|
||||||
ssize_t bytesReceived = 0;
|
ssize_t bytesReceived = 0;
|
||||||
|
|
||||||
if(isSocketValid() == true)
|
if(isSocketValid() == true) {
|
||||||
{
|
|
||||||
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
||||||
}
|
}
|
||||||
if(bytesReceived < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN)
|
if(bytesReceived < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived,getLastSocketErrorFormattedText().c_str());
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,bytesReceived,getLastSocketErrorFormattedText().c_str());
|
|
||||||
//throwException(szBuf);
|
//throwException(szBuf);
|
||||||
}
|
}
|
||||||
else if(bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)
|
else if(bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during receive, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #1 EAGAIN during receive, trying again...\n",__FILE__,__FUNCTION__);
|
|
||||||
|
|
||||||
time_t tStartTimer = time(NULL);
|
time_t tStartTimer = time(NULL);
|
||||||
while((bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5))
|
while((bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5)) {
|
||||||
{
|
if(Socket::isReadable() == true) {
|
||||||
if(Socket::isReadable() == true)
|
|
||||||
{
|
|
||||||
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during receive, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesReceived);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during receive, trying again returned: %d\n",__FILE__,__FUNCTION__,bytesReceived);
|
||||||
|
@ -939,8 +928,7 @@ int Socket::receive(void *data, int dataSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bytesReceived <= 0)
|
if(bytesReceived <= 0) {
|
||||||
{
|
|
||||||
int iErr = getLastSocketError();
|
int iErr = getLastSocketError();
|
||||||
disconnectSocket();
|
disconnectSocket();
|
||||||
|
|
||||||
|
@ -952,26 +940,21 @@ int Socket::receive(void *data, int dataSize)
|
||||||
|
|
||||||
int Socket::peek(void *data, int dataSize){
|
int Socket::peek(void *data, int dataSize){
|
||||||
ssize_t err = 0;
|
ssize_t err = 0;
|
||||||
if(isSocketValid() == true)
|
if(isSocketValid() == true) {
|
||||||
{
|
|
||||||
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
||||||
}
|
}
|
||||||
if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN)
|
if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR PEEKING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText().c_str());
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] ERROR PEEKING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,err,getLastSocketErrorFormattedText().c_str());
|
|
||||||
//throwException(szBuf);
|
//throwException(szBuf);
|
||||||
|
|
||||||
disconnectSocket();
|
disconnectSocket();
|
||||||
}
|
}
|
||||||
else if(err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)
|
else if(err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
{
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during peek, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #1 EAGAIN during peek, trying again...\n",__FILE__,__FUNCTION__);
|
|
||||||
|
|
||||||
time_t tStartTimer = time(NULL);
|
time_t tStartTimer = time(NULL);
|
||||||
while((err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5))
|
while((err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) && (difftime(time(NULL),tStartTimer) <= 5)) {
|
||||||
{
|
if(Socket::isReadable() == true) {
|
||||||
if(Socket::isReadable() == true)
|
|
||||||
{
|
|
||||||
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during peek, trying again returned: %d\n",__FILE__,__FUNCTION__,err);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #2 EAGAIN during peek, trying again returned: %d\n",__FILE__,__FUNCTION__,err);
|
||||||
|
@ -979,8 +962,7 @@ int Socket::peek(void *data, int dataSize){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(err <= 0)
|
if(err <= 0) {
|
||||||
{
|
|
||||||
int iErr = getLastSocketError();
|
int iErr = getLastSocketError();
|
||||||
disconnectSocket();
|
disconnectSocket();
|
||||||
|
|
||||||
|
@ -1007,8 +989,7 @@ void Socket::setBlock(bool block, PLATFORM_SOCKET socket){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Socket::isReadable()
|
bool Socket::isReadable() {
|
||||||
{
|
|
||||||
if(isSocketValid() == false) return false;
|
if(isSocketValid() == false) return false;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -1023,10 +1004,8 @@ bool Socket::isReadable()
|
||||||
FD_SET(sock, &set);
|
FD_SET(sock, &set);
|
||||||
|
|
||||||
int i= select(sock+1, &set, NULL, NULL, &tv);
|
int i= select(sock+1, &set, NULL, NULL, &tv);
|
||||||
if(i < 0)
|
if(i < 0) {
|
||||||
{
|
if(difftime(time(NULL),lastDebugEvent) >= 1) {
|
||||||
if(difftime(time(NULL),lastDebugEvent) >= 1)
|
|
||||||
{
|
|
||||||
lastDebugEvent = time(NULL);
|
lastDebugEvent = time(NULL);
|
||||||
|
|
||||||
//throwException("Error selecting socket");
|
//throwException("Error selecting socket");
|
||||||
|
@ -1037,8 +1016,7 @@ bool Socket::isReadable()
|
||||||
return (i == 1);
|
return (i == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Socket::isWritable(bool waitOnDelayedResponse)
|
bool Socket::isWritable(bool waitOnDelayedResponse) {
|
||||||
{
|
|
||||||
if(isSocketValid() == false) return false;
|
if(isSocketValid() == false) return false;
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -1057,10 +1035,8 @@ bool Socket::isWritable(bool waitOnDelayedResponse)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int i = select(sock+1, NULL, &set, NULL, &tv);
|
int i = select(sock+1, NULL, &set, NULL, &tv);
|
||||||
if(i < 0 )
|
if(i < 0 ) {
|
||||||
{
|
if(difftime(time(NULL),lastDebugEvent) >= 1) {
|
||||||
if(difftime(time(NULL),lastDebugEvent) >= 1)
|
|
||||||
{
|
|
||||||
lastDebugEvent = time(NULL);
|
lastDebugEvent = time(NULL);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] error while selecting socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,i,getLastSocketErrorFormattedText().c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] error while selecting socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,i,getLastSocketErrorFormattedText().c_str());
|
||||||
|
@ -1069,21 +1045,17 @@ bool Socket::isWritable(bool waitOnDelayedResponse)
|
||||||
|
|
||||||
//throwException("Error selecting socket");
|
//throwException("Error selecting socket");
|
||||||
}
|
}
|
||||||
else if(i == 0)
|
else if(i == 0) {
|
||||||
{
|
if(difftime(time(NULL),lastDebugEvent) >= 1) {
|
||||||
if(difftime(time(NULL),lastDebugEvent) >= 1)
|
|
||||||
{
|
|
||||||
lastDebugEvent = time(NULL);
|
lastDebugEvent = time(NULL);
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] TIMEOUT while selecting socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,i,getLastSocketErrorFormattedText().c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s] TIMEOUT while selecting socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,i,getLastSocketErrorFormattedText().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(waitOnDelayedResponse == false)
|
if(waitOnDelayedResponse == false) {
|
||||||
{
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} while(waitOnDelayedResponse == true && result == false);
|
} while(waitOnDelayedResponse == true && result == false);
|
||||||
|
@ -1092,17 +1064,14 @@ bool Socket::isWritable(bool waitOnDelayedResponse)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Socket::isConnected()
|
bool Socket::isConnected() {
|
||||||
{
|
|
||||||
//if the socket is not writable then it is not conencted
|
//if the socket is not writable then it is not conencted
|
||||||
if(isWritable(false) == false)
|
if(isWritable(false) == false) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the socket is readable it is connected if we can read a byte from it
|
//if the socket is readable it is connected if we can read a byte from it
|
||||||
if(isReadable())
|
if(isReadable()) {
|
||||||
{
|
|
||||||
char tmp;
|
char tmp;
|
||||||
int err = peek(&tmp, sizeof(tmp));
|
int err = peek(&tmp, sizeof(tmp));
|
||||||
return (err > 0);
|
return (err > 0);
|
||||||
|
|
|
@ -103,7 +103,9 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
if(display == 0) {
|
if(display == 0) {
|
||||||
throw std::runtime_error("Couldn't create font: display is 0");
|
throw std::runtime_error("Couldn't create font: display is 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] trying to load font %s\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] trying to load font %s\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
|
||||||
|
|
||||||
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
|
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
|
||||||
if(!fontInfo) {
|
if(!fontInfo) {
|
||||||
fontInfo = XLoadQueryFont(display, "fixed");
|
fontInfo = XLoadQueryFont(display, "fixed");
|
||||||
|
@ -121,7 +123,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
}
|
}
|
||||||
metrics.setHeight(height);
|
metrics.setHeight(height);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] height = %f\n",__FILE__,__FUNCTION__,__LINE__,height);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] height = %f\n",__FILE__,__FUNCTION__,__LINE__,height);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@ -171,15 +173,15 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
glXUseXFont(fontInfo->fid, 0, charCount, base);
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
GLenum glerror = ::glGetError();
|
GLenum glerror = ::glGetError();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] glerror = %d\n",__FILE__,__FUNCTION__,__LINE__,glerror);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] glerror = %d\n",__FILE__,__FUNCTION__,__LINE__,glerror);
|
||||||
|
|
||||||
XFreeFont(display, fontInfo);
|
XFreeFont(display, fontInfo);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ int32 Checksum::getSum() {
|
||||||
fileResult.addFileToSum(iterMap->first);
|
fileResult.addFileToSum(iterMap->first);
|
||||||
Checksum::fileListCache[iterMap->first] = fileResult.getSum();
|
Checksum::fileListCache[iterMap->first] = fileResult.getSum();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] iterMap->first [%s] has CRC [%d]\n",__FILE__,__FUNCTION__,__LINE__,iterMap->first.c_str(),Checksum::fileListCache[iterMap->first]);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] iterMap->first [%s] has CRC [%d]\n",__FILE__,__FUNCTION__,__LINE__,iterMap->first.c_str(),Checksum::fileListCache[iterMap->first]);
|
||||||
}
|
}
|
||||||
newResult.addSum(Checksum::fileListCache[iterMap->first]);
|
newResult.addSum(Checksum::fileListCache[iterMap->first]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue