- Does this fix choppy network play? Please test and let me know
This commit is contained in:
parent
2def669678
commit
bd29260fef
|
@ -112,6 +112,9 @@ void ClientInterface::reset() {
|
|||
}
|
||||
|
||||
void ClientInterface::update() {
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
NetworkMessageCommandList networkMessageCommandList(currentFrameCount);
|
||||
|
||||
//send as many commands as we can
|
||||
|
@ -127,6 +130,8 @@ void ClientInterface::update() {
|
|||
double lastSendElapsed = difftime(time(NULL),lastNetworkCommandListSendTime);
|
||||
//if(lastSendElapsed > 0) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] lastSendElapsed = %f, networkMessageCommandList.getCommandCount() = %d, requestedCommands.empty() = %d\n",__FILE__,__FUNCTION__,__LINE__,lastSendElapsed,networkMessageCommandList.getCommandCount(),requestedCommands.empty());
|
||||
|
||||
if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(networkMessageCommandList.getCommandCount() > 0 ||
|
||||
(lastNetworkCommandListSendTime > 0 && lastSendElapsed >= ClientInterface::maxNetworkCommandListSendTimeWait)) {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -134,6 +139,7 @@ void ClientInterface::update() {
|
|||
lastNetworkCommandListSendTime = time(NULL);
|
||||
sendMessage(&networkMessageCommandList);
|
||||
|
||||
if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
|
@ -145,7 +151,11 @@ void ClientInterface::update() {
|
|||
|
||||
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
|
||||
sendTextMessage(sMsg,-1, true);
|
||||
|
||||
if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
std::string ClientInterface::getServerIpAddress() {
|
||||
|
@ -508,6 +518,9 @@ void ClientInterface::updateLobby() {
|
|||
void ClientInterface::updateKeyframe(int frameCount) {
|
||||
currentFrameCount = frameCount;
|
||||
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
int simulateLag = Config::getInstance().getInt("SimulateClientLag","0");
|
||||
bool done= false;
|
||||
while(done == false) {
|
||||
|
@ -532,8 +545,6 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
|||
{
|
||||
case nmtCommandList:
|
||||
{
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
int waitCount = 0;
|
||||
//make sure we read the message
|
||||
|
@ -582,6 +593,8 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
|||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
lastPingInfo = networkMessagePing;
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -607,8 +620,12 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
|||
difftime(time(NULL),receiveTimeElapsed) <= (messageWaitTimeout / 1000)) {
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
|
||||
this->addChatInfo(msg);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
break;
|
||||
case nmtInvalid:
|
||||
|
@ -630,6 +647,7 @@ void ClientInterface::updateKeyframe(int frameCount) {
|
|||
done = true;
|
||||
}
|
||||
}
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
void ClientInterface::waitUntilReady(Checksum* checksum) {
|
||||
|
|
|
@ -325,13 +325,14 @@ void ServerInterface::slotUpdateTask(ConnectionSlotEvent *event) {
|
|||
|
||||
void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
if(event != NULL) {
|
||||
bool &socketTriggered = event->socketTriggered;
|
||||
bool checkForNewClients = true;
|
||||
|
||||
// Safety check since we can experience a disconnect and the slot is NULL
|
||||
//Chrono chrono;
|
||||
//chrono.start();
|
||||
ConnectionSlot *connectionSlot = NULL;
|
||||
MutexSafeWrapper safeMutexSlot(NULL);
|
||||
if(event->triggerId >= 0 && event->triggerId < GameConstants::maxPlayers) {
|
||||
|
@ -343,6 +344,8 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR CONDITION, event->triggerId = %d\n",__FILE__,__FUNCTION__,__LINE__,event->triggerId);
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
if(connectionSlot != NULL &&
|
||||
|
@ -354,6 +357,8 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
//safeMutexSlot.ReleaseLock(true);
|
||||
connectionSlot->update(checkForNewClients,event->triggerId);
|
||||
|
||||
if(chrono.getMillis() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
//chrono.start();
|
||||
//safeMutexSlot.Lock();
|
||||
connectionSlot = slots[event->triggerId];
|
||||
|
@ -370,9 +375,13 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
|||
safeMutexSlot.ReleaseLock();
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionSlot, bool skipNetworkBroadCast) {
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
std::pair<bool,bool> clientLagExceededOrWarned = std::make_pair(false, false);
|
||||
static bool alreadyInLagCheck = false;
|
||||
if(alreadyInLagCheck == true) {
|
||||
|
@ -390,6 +399,8 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
|
||||
double clientLagTime = difftime(time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(this->getCurrentFrameCount() > 0) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] playerIndex = %d, clientLag = %f, clientLagCount = %f, this->getCurrentFrameCount() = %d, connectionSlot->getCurrentFrameCount() = %d, clientLagTime = %f\n",
|
||||
__FILE__,__FUNCTION__,__LINE__,
|
||||
|
@ -432,6 +443,8 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
#endif
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(skipNetworkBroadCast == false) {
|
||||
string sMsg = szBuf;
|
||||
sendTextMessage(sMsg,-1, true, connectionSlot->getPlayerIndex());
|
||||
|
@ -441,6 +454,8 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
(maxFrameCountLagAllowedEver > 0 && clientLagCount > maxFrameCountLagAllowedEver)) {
|
||||
connectionSlot->close();
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
// New lag check warning
|
||||
else if((maxFrameCountLagAllowed > 0 && warnFrameCountLagPercent > 0 &&
|
||||
|
@ -462,6 +477,8 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
#endif
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(skipNetworkBroadCast == false) {
|
||||
string sMsg = szBuf;
|
||||
sendTextMessage(sMsg,-1, true, connectionSlot->getPlayerIndex());
|
||||
|
@ -470,6 +487,8 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
}
|
||||
else if(connectionSlot->getLagCountWarning() == true) {
|
||||
connectionSlot->setLagCountWarning(false);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -481,6 +500,9 @@ std::pair<bool,bool> ServerInterface::clientLagCheck(ConnectionSlot *connectionS
|
|||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
throw runtime_error(ex.what());
|
||||
}
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
alreadyInLagCheck = false;
|
||||
return clientLagExceededOrWarned;
|
||||
}
|
||||
|
@ -742,8 +764,8 @@ void ServerInterface::dispatchPendingChatMessages(std::vector <string> &errorMsg
|
|||
}
|
||||
|
||||
void ServerInterface::update() {
|
||||
//Chrono chrono;
|
||||
//chrono.start();
|
||||
Chrono chrono;
|
||||
chrono.start();
|
||||
|
||||
std::vector <string> errorMsgList;
|
||||
try {
|
||||
|
@ -751,18 +773,18 @@ void ServerInterface::update() {
|
|||
// properly identified themselves within the alloted time period
|
||||
validateConnectedClients();
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
processTextMessageQueue();
|
||||
processBroadCastMessageQueue();
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
std::map<PLATFORM_SOCKET,bool> socketTriggeredList;
|
||||
//update all slots
|
||||
updateSocketTriggeredList(socketTriggeredList);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(gameHasBeenInitiated == false || socketTriggeredList.size() > 0) {
|
||||
std::map<int,ConnectionSlotEvent> eventList;
|
||||
|
@ -770,6 +792,8 @@ void ServerInterface::update() {
|
|||
|
||||
if(hasData) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] hasData == true\n",__FILE__,__FUNCTION__);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(gameHasBeenInitiated == false || hasData == true) {
|
||||
std::map<int,bool> mapSlotSignalledList;
|
||||
|
||||
|
@ -777,34 +801,34 @@ void ServerInterface::update() {
|
|||
signalClientsToRecieveData(socketTriggeredList, eventList, mapSlotSignalledList);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #2\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
// Step #2 check all connection slot worker threads for completed status
|
||||
checkForCompletedClients(mapSlotSignalledList,errorMsgList, eventList);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #3\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
// Step #3 check clients for any lagging scenarios and try to deal with them
|
||||
checForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #4\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
// Step #4 dispatch network commands to the pending list so that they are done in proper order
|
||||
executeNetworkCommandsFromClients();
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #5\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
// Step #5 dispatch pending chat messages
|
||||
dispatchPendingChatMessages(errorMsgList);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
|
@ -821,7 +845,7 @@ void ServerInterface::update() {
|
|||
}
|
||||
}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] method running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
}
|
||||
|
||||
void ServerInterface::updateKeyframe(int frameCount) {
|
||||
|
|
|
@ -149,7 +149,8 @@ void UnitUpdater::updateUnit(Unit *unit) {
|
|||
unit->cancelCommand();
|
||||
}
|
||||
if(unit->getCurrSkill() != NULL && unit->getCurrSkill()->getClass() != scAttack) {
|
||||
unit->computeHp();
|
||||
// !!! Is this causing choppy network play somehow?
|
||||
//unit->computeHp();
|
||||
}
|
||||
else if(unit->getCommandSize() > 0) {
|
||||
Command *command= unit->getCurrCommand();
|
||||
|
@ -1689,7 +1690,8 @@ void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attac
|
|||
}
|
||||
scriptManager->onUnitDied(attacked);
|
||||
}
|
||||
attacker->computeHp();
|
||||
// !!! Is this causing choppy network play somehow?
|
||||
//attacker->computeHp();
|
||||
}
|
||||
|
||||
void UnitUpdater::startAttackParticleSystem(Unit *unit){
|
||||
|
|
|
@ -1043,8 +1043,7 @@ int Socket::send(const void *data, int dataSize) {
|
|||
#ifdef __APPLE__
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE);
|
||||
#else
|
||||
//bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL);
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
safeMutex.ReleaseLock();
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -1077,8 +1076,7 @@ int Socket::send(const void *data, int dataSize) {
|
|||
#ifdef __APPLE__
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE);
|
||||
#else
|
||||
//bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL);
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
break;
|
||||
|
@ -1120,8 +1118,7 @@ int Socket::send(const void *data, int dataSize) {
|
|||
#ifdef __APPLE__
|
||||
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, SO_NOSIGPIPE);
|
||||
#else
|
||||
//bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL);
|
||||
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
if(bytesSent > 0) {
|
||||
totalBytesSent += bytesSent;
|
||||
|
@ -1278,7 +1275,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData) {
|
|||
}
|
||||
}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
@ -1337,7 +1334,7 @@ bool Socket::isReadable() {
|
|||
|
||||
int i = 0;
|
||||
{
|
||||
//MutexSafeWrapper safeMutex(&dataSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
MutexSafeWrapper safeMutex(&dataSynchAccessorRead,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
i= select((int)sock + 1, &set, NULL, NULL, &tv);
|
||||
}
|
||||
if(i < 0) {
|
||||
|
@ -1351,8 +1348,8 @@ bool Socket::isWritable() {
|
|||
|
||||
struct timeval tv;
|
||||
tv.tv_sec= 0;
|
||||
//tv.tv_usec= 1;
|
||||
tv.tv_usec= 0;
|
||||
tv.tv_usec= 1;
|
||||
//tv.tv_usec= 0;
|
||||
|
||||
fd_set set;
|
||||
FD_ZERO(&set);
|
||||
|
@ -1360,7 +1357,7 @@ bool Socket::isWritable() {
|
|||
|
||||
int i = 0;
|
||||
{
|
||||
//MutexSafeWrapper safeMutex(&dataSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
MutexSafeWrapper safeMutex(&dataSynchAccessorWrite,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
i = select((int)sock + 1, NULL, &set, NULL, &tv);
|
||||
}
|
||||
bool result = false;
|
||||
|
@ -1526,7 +1523,7 @@ void ClientSocket::connect(const Ip &ip, int port)
|
|||
FD_SET(sock, &myset);
|
||||
|
||||
{
|
||||
//MutexSafeWrapper safeMutex(&dataSynchAccessor,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
MutexSafeWrapper safeMutex(&dataSynchAccessorRead,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
err = select((int)sock + 1, NULL, &myset, NULL, &tv);
|
||||
//safeMutex.ReleaseLock();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue