aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-10-25Changing Scene.ForEachClient to use the synchronous for loop instead of ↵John Hurliman1-2/+2
Parallel. This is quite possibly the source of some deadlocking, and at the very least the synchronous version gives better stack traces * Lock the LLUDPClient RTO math * Add a helper function for backing off the RTO, and follow the optional advice in RFC 2988 to clear existing SRTT and RTTVAR values during a backoff * Removing the unused PrimitiveBaseShape.SculptImage parameter * Improved performance of SceneObjectPart instantiation * ZeroMesher now drops SculptData bytes like Meshmerizer, to allow the texture data to be GCed * Improved typecasting speed in MySQLLegacyRegionData.BuildShape() * Improved the instantiation of PrimitiveBaseShape
2009-10-23* Unregister Mono.Addins event handlers in PluginLoader.Dispose() and always ↵John Hurliman1-1/+5
handle PluginLoader with the using pattern. This freed up 121,634,796 bytes on my system * Avoid allocating an Action<IClientAPI> object every round of the OutgoingPacketHandler * Removed unnecessary semi-colon endings from OpenSim.ini.example [InterestManagement] section
2009-10-23Cleaning up OpenSim.ini.example for LLUDP. The [LLClient] section has been ↵John Hurliman1-0/+24
removed and several new parameters have been added to [ClientStack.LindenUDP]
2009-10-23Uncommented the resend log line so the previous commit can be seen in actionJohn Hurliman1-1/+1
2009-10-23* Changed the max RTO value to 60 seconds to comply with RFC 2988John Hurliman1-0/+3
* Implemented section 5.5, exponential backoff of the RTO after a resend
2009-10-23Commented out noisy debugging about resent packets (normal) and agents ↵John Hurliman1-1/+1
setting throttles (normal)
2009-10-22Implemented a Watchdog class. Do not manually create Thread objects anymore, ↵John Hurliman1-8/+11
use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
2009-10-21* Change the OnQueueEmpty signature to send the flags of the queues that are ↵John Hurliman1-4/+0
empty instead of firing once per empty queue * Change the OnQueueEmpty firing to use a minimum time until next fire instead of a sleep * Set OutgoingPacket.TickCount = 0 earlier to avoid extra resends when things are running slowly (inside a profiler, for example)
2009-10-21* Clarified what FireQueueEmpty is doing with a MIN_CALLBACK_MS constant and ↵John Hurliman1-4/+0
upped it to 30ms * Removed the unused PacketSent() function * Switched UnackedPacketCollection from a SortedDictionary to a Dictionary now that the sorting is no longer needed. Big performance improvement for ResendUnacked()
2009-10-21* Changed the timing calculations for sending resends/acks/pings from ↵John Hurliman1-26/+59
per-client back to per-scene * Testing a fix from Jim to make the cpu usage fix cleaner
2009-10-21Removing the Sleep(0) call from the OutgoingPacketHandlerJohn Hurliman1-6/+3
2009-10-21* Handle UseCircuitCode packets asynchronously. Adding an agent to a scene ↵John Hurliman1-8/+39
can take several seconds, and was blocking up packet handling in the meantime * Clamp retransmission timeout values between three and 10 seconds * Log outgoing time for a packet right after it is sent instead of well before * Loop through the entire UnackedPacketCollection when looking for expired packets
2009-10-21* Replaced the UnackedPacketCollection with a lockless implementation. The ↵John Hurliman1-98/+45
tiny amount of time spent in the locks turned into a lot of time when the rest of the LLUDP implementation went lockless * Changed the timer tracking numbers for each client to not have "memory". It will no longer queue up calls to functions like ResendUnacked * Reverted Jim's WaitHandle code. Although it was technically more correct, it exhibited the exact same behavior as the old code but spent more cycles. The 20ms has been replaced with the minimum amount of time before a token bucket could receive a drip, and an else { sleep(0); } was added to make sure the outgoing packet handler always yields at least a minimum amount
2009-10-21Committing Jim's optimization to replace the 20ms sleep in outgoing packet ↵John Hurliman1-28/+70
handling with an interruptible wait handle
2009-10-20* Added a sanity check to GetScriptAssemblies() and GetScriptStates() for ↵John Hurliman1-0/+2
the case where no scripting engine is enabled * Added TokenBucket.cs to OpenSim, with some fixes for setting a more accurate MaxBurst value and getting a more accurate Content value (by Drip()ing each get)
2009-10-20* Removed the throttle speed optimizations to see if it brings stability backJohn Hurliman1-63/+53
* Changed the outgoing packet handler to use a real function instead of a closure and to track time on a per-client basis instead of a global basis
2009-10-20Added try/catches in the outgoing packet handler to match the one in the ↵John Hurliman1-45/+59
incoming packet handler
2009-10-19* Optimized sending of terrain dataJohn Hurliman1-9/+14
* Send terrain data in a spiral pattern instead of a typewriter pattern (placeholder until terrain data becomes part of the interest list management) * Added a debug line when resent packets are being sent
2009-10-19* Change Util.FireAndForget to use ThreadPool.UnsafeQueueUserWorkItem(). ↵John Hurliman1-7/+12
This avoids .NET remoting and a managed->unmanaged->managed jump. Overall, a night and day performance difference * Initialize the LLClientView prim full update queue to the number of prims in the scene for a big performance boost * Reordered some comparisons on hot code paths for a minor speed boost * Removed an unnecessary call to the expensive DateTime.Now function (if you *have* to get the current time as opposed to Environment.TickCount, always use DateTime.UtcNow) * Don't fire the queue empty callback for the Resend category * Run the outgoing packet handler thread loop for each client synchronously. It seems like more time was being spent doing the execution asynchronously, and it made deadlocks very difficult to track down * Rewrote some expensive math in LandObject.cs * Optimized EntityManager to only lock on operations that need locking, and use TryGetValue() where possible * Only update the attachment database when an object is attached or detached * Other small misc. performance improvements
2009-10-18* Rewrote the methods that build ObjectUpdate and ImprovedTerseObjectUpdate ↵John Hurliman1-2/+2
packets to fill in the data more accurately and avoid allocating memory that is immediately thrown away * Changed the Send*Data structs in IClientAPI to use public readonly members instead of private members and getters * Made Parallel.ProcessorCount public * Started switching over packet building methods in LLClientView to use Util.StringToBytes[256/1024]() instead of Utils.StringToBytes() * More cleanup of the ScenePresences vs. ClientManager nightmare * ScenePresence.HandleAgentUpdate() will now time out and drop incoming AgentUpdate packets after three seconds. This fixes a deadlock on m_AgentUpdates that was blocking up the LLUDP server
2009-10-18* Big performance increase in loading prims from the region database with MySQLJohn Hurliman1-15/+36
* Handle the AgentFOV packet * Bypass queuing and throttles for ping checks to make ping times more closely match network latency * Only track reliable bytes in LLUDPCLient.BytesSinceLastACK
2009-10-17Wrapped the contents of the IncomingPacketHandler loop in a try/catch statementJohn Hurliman1-2/+9
2009-10-16Prevent oversized packets from crashing the LLUDP server. It will now print ↵John Hurliman1-5/+20
a friendly error message and drop the packet
2009-10-16* Simplified the prioritization packet creation code to reduce CPU usage and ↵John Hurliman1-3/+6
increase throughput. Apologies to Jim for hacking on your code while it's only halfway done, I'll take responsibility for the manual merge * Changed LLUDP to use its own MTU value of 1400 instead of the 1200 value pulled from the currently shipped libomv
2009-10-16* Changing the "clean dropped attachments" MySQL command to a using ↵John Hurliman1-1/+2
statement inside a try/catch. This statement times out for me very frequently * More verbose logging when zerocoding fails on an outbound packet
2009-10-16* Change appearance packets from State to Task. This will hopefully fix the ↵John Hurliman1-1/+1
cloud issues * Changed the throttling logic to obey the requested client bandwidth limit but also share bandwidth between some of the categories to improve throughput on high prim or heavily trafficked regions
2009-10-14Allow the LLUDP server to run in either synchronous or asynchronous mode ↵John Hurliman1-1/+6
with a config setting, defaulting to synchronous mode
2009-10-14* Clean up the SetThrottle() code and add a maxBurstRate parameter to allow ↵John Hurliman1-1/+0
more tweaking in the future
2009-10-14* Switched to a plain lock for the ClientManager collections and protected ↵John Hurliman1-1/+3
the TryGetValues with try/catch instead of a lock * Added ClientManager.ForEachSync() for operations that need to run synchronously, such as "show connections"
2009-10-14* Read scene_throttle_bps from the config file and use itJohn Hurliman1-1/+3
* Minor formatting cleanup
2009-10-14* Minimized the number of times textures are pulled off the priority queueJohn Hurliman1-1/+11
* OnQueueEmpty is still called async, but will not be called for a given category if the previous callback for that category is still running. This is the most balanced behavior I could find, and seems to work well * Added support for the old [ClientStack.LindenUDP] settings (including setting the receive buffer size) and added the new token bucket and global throttle settings * Added the AssetLoaderEnabled config variable to optionally disable loading assets from XML every startup. This gives a dramatic improvement in startup times for those who don't need the functionality every startup
2009-10-13* Copied LocklessQueue.cs into OpenSim.Framework and added the .Count ↵John Hurliman1-59/+48
property and .Clear() method * Changed the way the QueueEmpty callback is fired. It will be fired asynchronously as soon as an empty queue is detected (this can happen immediately following a dequeue), and will not be fired again until at least one packet is dequeued from that queue. This will give callbacks advanced notice of an empty queue and prevent callbacks from stacking up while the queue is empty * Added LLUDPClient.IsConnected checks in several places to prevent unwanted network activity after a client disconnects * Prevent LLClientView.Close() from being called twice every disconnect * Removed the packet resend limit and improved the client timeout check
2009-10-13* Consolidated adding / removing ClientManager IClientAPIs to two places in ↵John Hurliman1-10/+3
Scene * Added some missing implementations of IClientAPI.RemoteEndPoint * Added a ClientManager.Remove(UUID) overload * Removed a reference to a missing project from prebuild.xml
2009-10-13* Fixed a bug where clients were being added to ClientManager twiceJohn Hurliman1-5/+4
* Changed the ClientManager interface to reduce potential errors with duplicate or mismatched keys * Added IClientAPI.RemoteEndPoint, which can (hopefully) eventually replace IClientAPI.CircuitCode * Changed the order of operations during client shutdown
2009-10-13* Rewrote ClientManager to remove Lindenisms from OpenSim core, improve ↵John Hurliman1-79/+84
performance by removing locks, and replace LLUDPClientCollection * Removed the confusing (and LL-specific) shutdowncircuit parameter from IClientAPI.Close() * Updated the LLUDP code to only use ClientManager instead of trying to synchronize ClientManager and m_clients * Remove clients asynchronously since it is a very slow operation (including a 2000ms sleep)
2009-10-13* Unregister event handlers in LLUDPServer when a client logs out and ↵John Hurliman1-5/+13
disconnects * Move ViewerEffect handling to Scene.PacketHandlers * Removing the unused CloseAllAgents function * Trimming ClientManager down. This class needs to be reworked to keep LLUDP circuit codes from intruding into the abstract OpenSim core code
2009-10-13Avoid checking m_clients collection twice when a UseCircuitCode packet is ↵John Hurliman1-27/+29
received
2009-10-13* Broke the circular reference between LLClientView and LLUDPClient. This ↵John Hurliman1-57/+77
should speed up garbage collection on the large LLClientView objects, and also prevents handling packets for disconnected clients * Renamed local LLUDPClient variables to udpClient to avoid naming confusion between LLUDPClient and LLClientView
2009-10-13* Eliminated unnecessary parameters from LLUDPServer.SendPacketData()John Hurliman1-5/+8
* Changed PrimMesher's Quat.Identity to return <0,0,0,1> instead of <0,0,0,1.1>
2009-10-11* Changed logic of enabling LLProxyLoginModule to follow the new style -- ↵Diva Canto1-2/+4
true/false on the name, rather than gridmode=true. * Better error messages on Add/Remove clients.
2009-10-09* Changed the "Packet exceeded buffer size" log line to debug and include ↵John Hurliman1-1/+1
the packet type. This message is normal, but could be evidence of a message marked for zerocoding that probably shouldn't be * Changing OpenSimUDPBase back to high concurrency. High concurrency mode seems to make other problems happen faster, so it's helpful for working out other bugs and will probably
2009-10-09This is to *try* to avoid the exception we are seeing repeatedly:Diva Canto1-0/+4
#13:53:03 - [LLUDPSERVER]: Packet exceeded buffer size during zerocoding. Removing MSG_ZEROCODED flag #13:53:03 - [Scene]: Failed with exception System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. # at System.Buffer.BlockCopy (System.Array src, Int32 srcOffset, System.Array dst, Int32 dstOffset, Int32 count) [0x000b7] in /home/grid/install/mono24/mono-2.4.2.3/mcs/class/corlib/System/Buffer.cs:116 # at OpenSim.Region.ClientStack.LindenUDP.LLUDPServer.SendPacketData (OpenSim.Region.ClientStack.LindenUDP.LLUDPClient client, System.Byte[] data, Int32 dataLength, PacketType type, Boolean doZerocode, ThrottleOutPacketType category) [0x00060] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs:290 # at OpenSim.Region.ClientStack.LindenUDP.LLUDPServer.SendPacket (OpenSim.Region.ClientStack.LindenUDP.LLUDPClient client, OpenMetaverse.Packets.Packet packet, ThrottleOutPacketType category, Boolean allowSplitting) [0x00077] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs:265 # at OpenSim.Region.ClientStack.LindenUDP.LLClientView.OutPacket (OpenMetaverse.Packets.Packet packet, ThrottleOutPacketType throttlePacketType) [0x00000] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs:5244 # at OpenSim.Region.ClientStack.LindenUDP.LLClientView.SendCoarseLocationUpdate (System.Collections.Generic.List`1 users, System.Collections.Generic.List`1 CoarseLocations) [0x0012a] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs:3424 # at OpenSim.Region.Framework.Scenes.ScenePresence.SendCoarseLocationsDefault (UUID sceneId, OpenSim.Region.Framework.Scenes.ScenePresence p) [0x000fa] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/Framework/Scenes/ScenePresence.cs:2536 # at OpenSim.Region.Framework.Scenes.ScenePresence.SendCoarseLocations () [0x0000d] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/Framework/Scenes/ScenePresence.cs:2491 # at OpenSim.Region.Framework.Scenes.ScenePresence.Update () [0x00011] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/Framework/Scenes/ScenePresence.cs:2404 # at OpenSim.Region.Framework.Scenes.SceneGraph.UpdateEntities () [0x0001b] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/Framework/Scenes/SceneGraph.cs:164 # at OpenSim.Region.Framework.Scenes.Scene.Update () [0x000dc] in /home/grid/PLAZA/wrightplaza/opensim/OpenSim/Region/Framework/Scenes/Scene.cs:1031 On Region: Wright Plaza
2009-10-09Added more debugging output to the "unrecognized source" warningJohn Hurliman1-1/+2
2009-10-09* Added a lock object for the write functions in LLUDPClientCollection ↵John Hurliman1-10/+10
(immutable != concurrent write safety) * Allow the UDP server to bind to a user-specified port again * Updated to a newer version of OpenSimUDPBase that streamlines the code even more. This also reintroduces the highly concurrent packet handling which needs more testing
2009-10-08Simplified LLUDPClientCollection from three collections down to one. This ↵John Hurliman1-30/+16
will prevent any potential problems from inconsistency between the internal collections
2009-10-08Fork UDPBase from libOMV into opensimMelanie1-1/+1
2009-10-06Commented noisy debugging about packet splittingJohn Hurliman1-4/+4
2009-10-06* Added missing references to prebuild.xml and commented out the LindenUDP ↵John Hurliman1-60/+43
tests until a new test harness is written * Clients are no longer disconnected when a packet handler crashes. We'll see how this works out in practice * Added documentation and cleanup, getting ready for the first public push * Deleted an old LLUDP file
2009-10-06* Try/catch around EndInvoke() when Util.FireAndForget() returns to catch ↵John Hurliman1-66/+81
exceptions thrown in the async method * Added packet stats handling to the new LLUDP implementation * Attempting to avoid a race condition when creating a new LLUDPClient
2009-10-06* Continued work on the new LLUDP implementation. Appears to be functioning, ↵John Hurliman1-42/+96
although not everything is reimplemented yet * Replaced logic in ThreadTracker with a call to System.Diagnostics that does the same thing * Added Util.StringToBytes256() and Util.StringToBytes1024() to clamp output at byte[256] and byte[1024], respectively * Fixed formatting for a MySQLAssetData error logging line