* Few more tweaks to event queue server to improve performance and thread safety

[Simian]
* Made default assets for map water overlay and HyperGrid portals
* Fixed asset store loading regression
* Start synchronization after RegionHandshakeReply instead of CompleteAgentMovement (allows the sync function to be called for child agents as well)
* Start informing clients of neighbor regions when AgentThrottle is received (prevents client crashes, and this will become necessary data in the future)
* Minor fixes in map handling

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2488 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-03-17 00:17:07 +00:00
parent cb4e07b6c1
commit d4e07b8c4d
11 changed files with 212 additions and 149 deletions

View File

@@ -70,8 +70,8 @@ namespace OpenMetaverse.Http
HttpListener server;
BlockingQueue<EventQueueEvent> eventQueue;
int currentID;
bool running;
bool threadRunning;
volatile bool running;
volatile bool threadRunning;
IHttpClientContext context;
IHttpRequest request;
IHttpResponse response;
@@ -141,8 +141,11 @@ namespace OpenMetaverse.Http
if (threadRunning)
{
Logger.Log.Info("[EventQueue] New connection opened to the event queue while a previous connection is open. Closing old connection");
// Kill the previous handler thread before starting a new one
SendEvent(null);
// If the old connection is still open, queue a signal to close it. Otherwise, just wait for the closed
// connection to be detected by the handler thread
if (context.Stream != null && context.Stream.CanWrite)
SendEvent(null);
while (threadRunning && running)
Thread.Sleep(50);
@@ -188,7 +191,7 @@ namespace OpenMetaverse.Http
EventQueueEvent eventQueueEvent = null;
int totalMsPassed = 0;
while (running)
while (running && context.Stream != null && context.Stream.CanWrite)
{
if (eventQueue.Dequeue(BATCH_WAIT_INTERVAL, ref eventQueueEvent))
{