All pastes #955341 Raw Edit

Anonymous

public text v1 · immutable
#955341 ·published 2008-03-24 15:42 UTC
rendered paste body
Index: WorldSocket.cpp
===================================================================
--- WorldSocket.cpp	(revision 5477)
+++ WorldSocket.cpp	(working copy)
@@ -74,7 +74,10 @@
     m_OverSpeedPings = 0;
 
     if (sWorld.getConfig(CONFIG_TCP_NO_DELAY))
-        SetTcpNodelay(true);
+	{
+        SetTcpNodelay(false);
+		tcp_enabled=false;
+	}
 }
 
 /// WorldSocket destructor
@@ -496,6 +499,25 @@
         else
             m_OverSpeedPings = 0;
 
+	// If we have latency more than 200 (high) and disable Naglle - enable it.
+	// work only at EnableTcpNoDelay in .conf files
+	if (sWorld.getConfig(CONFIG_TCP_NO_DELAY)) 
+	{ 
+	 if(latency >= 200)
+	  {
+		 if(!tcp_enabled)
+		 {
+		 SetTcpNodelay(true);
+		 tcp_enabled=true;
+		 }
+	  }
+	  // if Naggle enabled but latency is low - disable it
+	  else  if (tcp_enabled)
+	  {
+	   SetTcpNodelay(false);
+	   tcp_enabled=false;
+	  }
+	 }
     }
 
     ///- And put the pong answer in the to-be-sent queue
Index: WorldSocket.h
===================================================================
--- WorldSocket.h	(revision 5477)
+++ WorldSocket.h	(working copy)
@@ -166,6 +166,7 @@
 
         uint32 m_LastPingMSTime;
         uint32 m_OverSpeedPings;
+		bool tcp_enabled;
 
         // internal checks
         void SizeError(WorldPacket const& packet, uint32 size) const;