Added region name to RegionSync debug messages for cases when there are multiple regions being synced by a single simulator.

dsg
Dan Lake 2011-01-02 18:27:45 -08:00
parent 0a9a8cc680
commit a5c321a548
3 changed files with 105 additions and 99 deletions

View File

@ -345,7 +345,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_startPos = startPos; m_startPos = startPos;
m_clientView = view; m_clientView = view;
m_log.Debug("[REGION SYNC AVATAR] instance: uuid={0}, first={1}, last={2}, startPos={3}, RSCV", agentID, first, last, startPos.ToString()); m_log.DebugFormat("[REGION SYNC AVATAR] instance: uuid={0}, first={1}, last={2}, startPos={3}, RSCV", agentID, first, last, startPos.ToString());
//m_scene.EventManager.OnFrame += Update; //m_scene.EventManager.OnFrame += Update;
} }

View File

@ -60,7 +60,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// The logfile // The logfile
private ILog m_log; private ILog m_log;
private string LogHeader = "[REGION SYNC CLIENT]"; private string LogHeader()
{
return String.Format("[REGION SYNC CLIENT ({0})]", m_scene.RegionInfo.RegionName);
}
// The listener and the thread which listens for connections from client managers // The listener and the thread which listens for connections from client managers
private Thread m_rcvLoop; private Thread m_rcvLoop;
@ -99,17 +102,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("{0} [Start] Could not connect to RegionSyncServer at {1}:{2}", LogHeader, m_addr, m_port); m_log.WarnFormat("{0} [Start] Could not connect to RegionSyncServer at {1}:{2}", LogHeader(), m_addr, m_port);
m_log.Warn(e.Message); m_log.Warn(e.Message);
} }
m_log.WarnFormat("{0} Connected to RegionSyncServer at {1}:{2}", LogHeader, m_addr, m_port); m_log.WarnFormat("{0} Connected to RegionSyncServer at {1}:{2}", LogHeader(), m_addr, m_port);
m_rcvLoop = new Thread(new ThreadStart(ReceiveLoop)); m_rcvLoop = new Thread(new ThreadStart(ReceiveLoop));
m_rcvLoop.Name = "RegionSyncClient ReceiveLoop"; m_rcvLoop.Name = "RegionSyncClient ReceiveLoop";
m_log.WarnFormat("{0} Starting {1} thread", LogHeader, m_rcvLoop.Name); m_log.WarnFormat("{0} Starting {1} thread", LogHeader(), m_rcvLoop.Name);
m_rcvLoop.Start(); m_rcvLoop.Start();
//m_log.WarnFormat("{0} Started", LogHeader); //m_log.WarnFormat("{0} Started", LogHeader());
DoInitialSync(); DoInitialSync();
m_statsTimer.Start(); m_statsTimer.Start();
} }
@ -127,29 +130,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Dictionary<UUID, IClientAPI> locals = LocalAvatars; Dictionary<UUID, IClientAPI> locals = LocalAvatars;
Dictionary<UUID, RegionSyncAvatar> remotes = RemoteAvatars; Dictionary<UUID, RegionSyncAvatar> remotes = RemoteAvatars;
m_log.WarnFormat("{0}: {1,4} Local avatars", LogHeader, locals.Count); m_log.WarnFormat("{0}: {1,4} Local avatars", LogHeader(), locals.Count);
foreach (KeyValuePair<UUID, IClientAPI> kvp in locals) foreach (KeyValuePair<UUID, IClientAPI> kvp in locals)
{ {
ScenePresence sp; ScenePresence sp;
bool inScene = m_scene.TryGetScenePresence(kvp.Value.AgentId, out sp); bool inScene = m_scene.TryGetScenePresence(kvp.Value.AgentId, out sp);
m_log.WarnFormat("{0}: {1} {2} {3}", LogHeader, kvp.Value.AgentId, kvp.Value.Name, inScene ? "" : "(NOT IN SCENE)"); m_log.WarnFormat("{0}: {1} {2} {3}", LogHeader(), kvp.Value.AgentId, kvp.Value.Name, inScene ? "" : "(NOT IN SCENE)");
} }
m_log.WarnFormat("{0}: {1,4} Remote avatars", LogHeader, remotes.Count); m_log.WarnFormat("{0}: {1,4} Remote avatars", LogHeader(), remotes.Count);
foreach (KeyValuePair<UUID, RegionSyncAvatar> kvp in remotes) foreach (KeyValuePair<UUID, RegionSyncAvatar> kvp in remotes)
{ {
ScenePresence sp; ScenePresence sp;
bool inScene = m_scene.TryGetScenePresence(kvp.Value.AgentId, out sp); bool inScene = m_scene.TryGetScenePresence(kvp.Value.AgentId, out sp);
m_log.WarnFormat("{0}: {1} {2} {3}", LogHeader, kvp.Value.AgentId, kvp.Value.Name, inScene ? "" : "(NOT IN SCENE)"); m_log.WarnFormat("{0}: {1} {2} {3}", LogHeader(), kvp.Value.AgentId, kvp.Value.Name, inScene ? "" : "(NOT IN SCENE)");
} }
m_log.WarnFormat("{0}: ===================================================", LogHeader); m_log.WarnFormat("{0}: ===================================================", LogHeader());
m_log.WarnFormat("{0} Synchronized to RegionSyncServer at {1}:{2}", LogHeader, m_addr, m_port); m_log.WarnFormat("{0} Synchronized to RegionSyncServer at {1}:{2}", LogHeader(), m_addr, m_port);
m_log.WarnFormat("{0}: {1,4} Local avatars", LogHeader, locals.Count); m_log.WarnFormat("{0}: {1,4} Local avatars", LogHeader(), locals.Count);
m_log.WarnFormat("{0}: {1,4} Remote avatars", LogHeader, remotes.Count); m_log.WarnFormat("{0}: {1,4} Remote avatars", LogHeader(), remotes.Count);
} }
private void ShutdownClient() private void ShutdownClient()
{ {
m_log.WarnFormat("{0} Disconnected from RegionSyncServer. Shutting down.", LogHeader); m_log.WarnFormat("{0} Disconnected from RegionSyncServer. Shutting down.", LogHeader());
// Remove remote avatars from local scene // Remove remote avatars from local scene
try try
@ -192,7 +195,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// *** This is the main thread loop for each connected client // *** This is the main thread loop for each connected client
private void ReceiveLoop() private void ReceiveLoop()
{ {
m_log.WarnFormat("{0} Thread running: {1}", LogHeader, m_rcvLoop.Name); m_log.WarnFormat("{0} Thread running: {1}", LogHeader(), m_rcvLoop.Name);
while (true && m_client.Connected) while (true && m_client.Connected)
{ {
RegionSyncMessage msg; RegionSyncMessage msg;
@ -200,7 +203,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
try try
{ {
msg = new RegionSyncMessage(m_client.GetStream()); msg = new RegionSyncMessage(m_client.GetStream());
//m_log.WarnFormat("{0} Received: {1}", LogHeader, msg.ToString()); //m_log.WarnFormat("{0} Received: {1}", LogHeader(), msg.ToString());
} }
// If there is a problem reading from the client, shut 'er down. // If there is a problem reading from the client, shut 'er down.
catch catch
@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("{0} Encountered an exception: {1} (MSGTYPE = {2})", LogHeader, e.Message, msg.ToString()); m_log.WarnFormat("{0} Encountered an exception: {1} (MSGTYPE = {2})", LogHeader(), e.Message, msg.ToString());
} }
} }
} }
@ -231,7 +234,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void Send(RegionSyncMessage msg) private void Send(RegionSyncMessage msg)
{ {
Send(msg.ToBytes()); Send(msg.ToBytes());
//m_log.WarnFormat("{0} Sent {1}", LogHeader, msg.ToString()); //m_log.WarnFormat("{0} Sent {1}", LogHeader(), msg.ToString());
} }
private void Send(byte[] data) private void Send(byte[] data)
@ -283,13 +286,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case RegionSyncMessage.MsgType.RegionName: case RegionSyncMessage.MsgType.RegionName:
{ {
m_regionName = Encoding.ASCII.GetString(msg.Data, 0, msg.Length); m_regionName = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Syncing to region \"{0}\"", m_regionName)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Syncing to region \"{0}\"", m_regionName));
return; return;
} }
case RegionSyncMessage.MsgType.Terrain: case RegionSyncMessage.MsgType.Terrain:
{ {
m_scene.Heightmap.LoadFromXmlString(Encoding.ASCII.GetString(msg.Data, 0, msg.Length)); m_scene.Heightmap.LoadFromXmlString(Encoding.ASCII.GetString(msg.Data, 0, msg.Length));
RegionSyncMessage.HandleSuccess(LogHeader, msg, "Synchronized terrain"); RegionSyncMessage.HandleSuccess(LogHeader(), msg, "Synchronized terrain");
return; return;
} }
case RegionSyncMessage.MsgType.NewObject: case RegionSyncMessage.MsgType.NewObject:
@ -298,22 +301,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(Encoding.ASCII.GetString(msg.Data, 0, msg.Length)); SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(Encoding.ASCII.GetString(msg.Data, 0, msg.Length));
if (sog.IsDeleted) if (sog.IsDeleted)
{ {
RegionSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted LocalId {0}.", sog.LocalId.ToString())); RegionSyncMessage.HandleTrivial(LogHeader(), msg, String.Format("Ignoring update on deleted LocalId {0}.", sog.LocalId.ToString()));
return; return;
} }
/* /*
m_log.DebugFormat("{0} NewObject '{1}'", LogHeader, sog.Name); m_log.DebugFormat("{0} NewObject '{1}'", LogHeader(), sog.Name);
sog.ForEachPart(delegate(SceneObjectPart part) sog.ForEachPart(delegate(SceneObjectPart part)
{ {
m_log.DebugFormat("{0} Part {1}, lf={2} f={3}", LogHeader, part.Name, m_log.DebugFormat("{0} Part {1}, lf={2} f={3}", LogHeader(), part.Name,
part.LocalFlags.ToString(), part.Flags.ToString()); part.LocalFlags.ToString(), part.Flags.ToString());
}); });
*/ */
if (m_scene.AddNewSceneObject(sog, true)); if (m_scene.AddNewSceneObject(sog, true));
//RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Object \"{0}\" ({1}) ({1}) updated.", sog.Name, sog.UUID.ToString(), sog.LocalId.ToString())); //RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Object \"{0}\" ({1}) ({1}) updated.", sog.Name, sog.UUID.ToString(), sog.LocalId.ToString()));
//else //else
//RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Object \"{0}\" ({1}) ({1}) added.", sog.Name, sog.UUID.ToString(), sog.LocalId.ToString())); //RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Object \"{0}\" ({1}) ({1}) added.", sog.Name, sog.UUID.ToString(), sog.LocalId.ToString()));
sog.ScheduleGroupForFullUpdate(); sog.ScheduleGroupForFullUpdate();
return; return;
} }
@ -323,7 +326,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
@ -335,13 +338,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(localID); SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(localID);
if (sog == null) if (sog == null)
{ {
//RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("localID {0} not found.", localID.ToString())); //RegionSyncMessage.HandleWarning(LogHeader(), msg, String.Format("localID {0} not found.", localID.ToString()));
return; return;
} }
// Delete the object from the scene // Delete the object from the scene
m_scene.DeleteSceneObject(sog, false); m_scene.DeleteSceneObject(sog, false);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("localID {0} deleted.", localID.ToString())); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("localID {0} deleted.", localID.ToString()));
return; return;
} }
case RegionSyncMessage.MsgType.NewAvatar: case RegionSyncMessage.MsgType.NewAvatar:
@ -350,7 +353,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
@ -361,22 +364,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Vector3 startPos = data["startPos"].AsVector3(); Vector3 startPos = data["startPos"].AsVector3();
if (agentID == null || agentID == UUID.Zero || first == null || last == null || startPos == null) if (agentID == null || agentID == UUID.Zero || first == null || last == null || startPos == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Missing or invalid JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Missing or invalid JSON data.");
return; return;
} }
m_log.DebugFormat("{0} Handle NewAvater for \"{1} {2}\"", LogHeader, first, last); m_log.DebugFormat("{0} Handle NewAvater for \"{1} {2}\"", LogHeader(), first, last);
if (m_remoteAvatars.ContainsKey(agentID)) if (m_remoteAvatars.ContainsKey(agentID))
{ {
RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Attempted to add duplicate avatar \"{0} {1}\" ({2})", first, last, agentID.ToString())); RegionSyncMessage.HandleWarning(LogHeader(), msg, String.Format("Attempted to add duplicate avatar \"{0} {1}\" ({2})", first, last, agentID.ToString()));
return; return;
} }
ScenePresence sp; ScenePresence sp;
if (m_scene.TryGetScenePresence(agentID, out sp)) if (m_scene.TryGetScenePresence(agentID, out sp))
{ {
//RegionSyncMessage.HandlerDebug(LogHeader, msg, String.Format("Confirmation of new avatar \"{0}\" ({1})", sp.Name, sp.UUID.ToString())); //RegionSyncMessage.HandlerDebug(LogHeader(), msg, String.Format("Confirmation of new avatar \"{0}\" ({1})", sp.Name, sp.UUID.ToString()));
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Confirmation of new avatar \"{0}\" ({1})", sp.Name, sp.UUID.ToString())); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Confirmation of new avatar \"{0}\" ({1})", sp.Name, sp.UUID.ToString()));
return; return;
} }
@ -386,14 +389,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.TryGetScenePresence(agentID, out sp); m_scene.TryGetScenePresence(agentID, out sp);
if (sp == null) if (sp == null)
{ {
m_log.ErrorFormat("{0} Could not get newly added scene presence.", LogHeader); m_log.ErrorFormat("{0} Could not get newly added scene presence.", LogHeader());
} }
else else
{ {
sp.IsSyncedAvatar = true; sp.IsSyncedAvatar = true;
} }
//RegionSyncMessage.HandlerDebug(LogHeader, msg, String.Format("Added new remote avatar \"{0}\" ({1})", first + " " + last, agentID)); //RegionSyncMessage.HandlerDebug(LogHeader(), msg, String.Format("Added new remote avatar \"{0}\" ({1})", first + " " + last, agentID));
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Added new remote avatar \"{0}\" ({1})", first + " " + last, agentID)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Added new remote avatar \"{0}\" ({1})", first + " " + last, agentID));
return; return;
} }
@ -403,7 +406,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
@ -442,11 +445,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (Decoding JSON): {1}", LogHeader, e.Message); m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (Decoding JSON): {1}", LogHeader(), e.Message);
} }
if (agentID == null || agentID == UUID.Zero ) if (agentID == null || agentID == UUID.Zero )
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Missing or invalid JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Missing or invalid JSON data.");
return; return;
} }
@ -455,7 +458,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.TryGetScenePresence(agentID, out presence); m_scene.TryGetScenePresence(agentID, out presence);
if (presence == null) if (presence == null)
{ {
//RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("agentID {0} not found.", agentID.ToString())); //RegionSyncMessage.HandleWarning(LogHeader(), msg, String.Format("agentID {0} not found.", agentID.ToString()));
return; return;
} }
@ -469,7 +472,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
m_log.WarnFormat("{0} Received update for balancing avatar not in local avatar list. \"{1}\"", LogHeader, presence.Name); m_log.WarnFormat("{0} Received update for balancing avatar not in local avatar list. \"{1}\"", LogHeader(), presence.Name);
return; return;
} }
} }
@ -506,7 +509,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch(Exception e) catch(Exception e)
{ {
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (setting presence values) for {1}: {2}", LogHeader, presence.Name, e.Message); m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (setting presence values) for {1}: {2}", LogHeader(), presence.Name, e.Message);
} }
try try
{ {
@ -521,7 +524,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (SendTerseUpdateToAllClients): {1}", LogHeader, e.Message); m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (SendTerseUpdateToAllClients): {1}", LogHeader(), e.Message);
} }
/* /*
foreach (KeyValuePair<UUID, IClientAPI> kvp in LocalAvatars) foreach (KeyValuePair<UUID, IClientAPI> kvp in LocalAvatars)
@ -537,7 +540,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (TrySetMovementAnimation): {1}", LogHeader, e.Message); m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (TrySetMovementAnimation): {1}", LogHeader(), e.Message);
} }
/* /*
* result = String.Format("Avatar \"{0}\" ({1}) ({2}) updated (pos:{3}, vel:{4}, rot:{5}, fly:{6})", * result = String.Format("Avatar \"{0}\" ({1}) ({2}) updated (pos:{3}, vel:{4}, rot:{5}, fly:{6})",
@ -554,7 +557,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
@ -562,7 +565,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
if (agentID == UUID.Zero) if (agentID == UUID.Zero)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Missing or invalid JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Missing or invalid JSON data.");
return; return;
} }
@ -589,11 +592,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// local scene so we should find it there. // local scene so we should find it there.
if (presence == null) if (presence == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, String.Format("Couldn't remove remote avatar \"{0}\" because it's not in local scene", name)); RegionSyncMessage.HandleError(LogHeader(), msg, String.Format("Couldn't remove remote avatar \"{0}\" because it's not in local scene", name));
return; return;
} }
m_scene.RemoveClient(agentID); m_scene.RemoveClient(agentID);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Remote avatar \"{0}\" removed from scene", name)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Remote avatar \"{0}\" removed from scene", name));
return; return;
} }
else if (LocalAvatars.ContainsKey(agentID)) else if (LocalAvatars.ContainsKey(agentID))
@ -608,19 +611,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// and the presence should not be in our scene at this time. // and the presence should not be in our scene at this time.
if (presence != null) if (presence != null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, String.Format("Remove avatar confirmation received for \"{0}\" still in the local scene.", name)); RegionSyncMessage.HandleError(LogHeader(), msg, String.Format("Remove avatar confirmation received for \"{0}\" still in the local scene.", name));
return; return;
} }
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Received confirmation of removed avatar \"{0}\"", name)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Received confirmation of removed avatar \"{0}\"", name));
return; return;
} }
} }
// Getting here is always an error because we have been asked to remove and avatar // Getting here is always an error because we have been asked to remove and avatar
// so it should have been in either the local or remote collections // so it should have been in either the local or remote collections
if (presence == null) if (presence == null)
RegionSyncMessage.HandleError(LogHeader, msg, String.Format("Avatar is not local OR remote and was not found in scene: \"{0}\" {1}", presence.Name, agentID.ToString())); RegionSyncMessage.HandleError(LogHeader(), msg, String.Format("Avatar is not local OR remote and was not found in scene: \"{0}\" {1}", presence.Name, agentID.ToString()));
else else
RegionSyncMessage.HandleError(LogHeader, msg, String.Format("Avatar is not local OR remote but was found in scene: {1}", agentID.ToString())); RegionSyncMessage.HandleError(LogHeader(), msg, String.Format("Avatar is not local OR remote but was found in scene: {1}", agentID.ToString()));
return; return;
} }
case RegionSyncMessage.MsgType.ChatFromClient: case RegionSyncMessage.MsgType.ChatFromClient:
@ -629,7 +632,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
OSChatMessage args = new OSChatMessage(); OSChatMessage args = new OSChatMessage();
@ -638,7 +641,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
args.Position = data["pos"].AsVector3(); args.Position = data["pos"].AsVector3();
args.From = data["name"].AsString(); args.From = data["name"].AsString();
UUID id = data["id"].AsUUID(); UUID id = data["id"].AsUUID();
// m_log.DebugFormat("{0} chat. chan={1}, from='{2}', msg='{3}'", LogHeader, args.Channel, args.From, args.Message); // m_log.DebugFormat("{0} chat. chan={1}, from='{2}', msg='{3}'", LogHeader(), args.Channel, args.From, args.Message);
args.Scene = m_scene; args.Scene = m_scene;
args.Type = ChatTypeEnum.Say; args.Type = ChatTypeEnum.Say;
ScenePresence sp; ScenePresence sp;
@ -655,18 +658,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.EventManager.TriggerOnChatFromWorld(null, args); m_scene.EventManager.TriggerOnChatFromWorld(null, args);
} }
//RegionSyncMessage.HandlerDebug(LogHeader, msg, String.Format("Received chat from \"{0}\"", args.From)); //RegionSyncMessage.HandlerDebug(LogHeader(), msg, String.Format("Received chat from \"{0}\"", args.From));
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Received chat from \"{0}\"", args.From)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Received chat from \"{0}\"", args.From));
return; return;
} }
case RegionSyncMessage.MsgType.AvatarAppearance: case RegionSyncMessage.MsgType.AvatarAppearance:
{ {
m_log.DebugFormat("{0} START of AvatarAppearance handler", LogHeader); m_log.DebugFormat("{0} START of AvatarAppearance handler", LogHeader());
// Get the data from message and error check // Get the data from message and error check
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
@ -674,14 +677,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID agentID = data["id"].AsUUID(); UUID agentID = data["id"].AsUUID();
if (agentID == null || agentID == UUID.Zero) if (agentID == null || agentID == UUID.Zero)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Missing or invalid JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Missing or invalid JSON data.");
return; return;
} }
// Tells the avatar factory to pull an updated appearance from the avatar service // Tells the avatar factory to pull an updated appearance from the avatar service
m_scene.AvatarFactory.RefreshAppearance(agentID); m_scene.AvatarFactory.RefreshAppearance(agentID);
m_log.DebugFormat("{0} END of AvatarAppearance handler", LogHeader); m_log.DebugFormat("{0} END of AvatarAppearance handler", LogHeader());
return; return;
} }
case RegionSyncMessage.MsgType.SitResponse: case RegionSyncMessage.MsgType.SitResponse:
@ -689,11 +692,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
m_log.DebugFormat("{0} SitResponse for {1}", LogHeader, agentID); m_log.DebugFormat("{0} SitResponse for {1}", LogHeader(), agentID);
UUID targetID = data["targetID"].AsUUID(); UUID targetID = data["targetID"].AsUUID();
Vector3 offsetPos = data["offsetPos"].AsVector3(); Vector3 offsetPos = data["offsetPos"].AsVector3();
Quaternion sitOrientation = data["sitOrientation"].AsQuaternion(); Quaternion sitOrientation = data["sitOrientation"].AsQuaternion();
@ -709,7 +712,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
RegionSyncMessage.HandleWarning(LogHeader, msg, RegionSyncMessage.HandleWarning(LogHeader(), msg,
String.Format("Agent {0} not found in the scene for SitResponse.", agentID)); String.Format("Agent {0} not found in the scene for SitResponse.", agentID));
} }
@ -720,12 +723,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
// m_log.DebugFormat("{0} SendAnimations for {1}", LogHeader, agentID.ToString()); // m_log.DebugFormat("{0} SendAnimations for {1}", LogHeader(), agentID.ToString());
OSDArray animatA = (OSDArray)data["animations"]; OSDArray animatA = (OSDArray)data["animations"];
UUID[] animIDs = new UUID[animatA.Count]; UUID[] animIDs = new UUID[animatA.Count];
@ -757,7 +760,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
else else
{ {
m_log.WarnFormat("{0} Could not send animation for {1} because scene presence not found", m_log.WarnFormat("{0} Could not send animation for {1} because scene presence not found",
LogHeader, agentID.ToString()); LogHeader(), agentID.ToString());
} }
return; return;
} }
@ -767,18 +770,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
{ {
RegionSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
return; return;
} }
int targetLoad = data["endCount"].AsInteger(); int targetLoad = data["endCount"].AsInteger();
string destinationRegion = data["toRegion"].AsString(); string destinationRegion = data["toRegion"].AsString();
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Balancing load from {0} to {1} via region \"{2}\"", m_localAvatars.Count, targetLoad, destinationRegion)); RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Balancing load from {0} to {1} via region \"{2}\"", m_localAvatars.Count, targetLoad, destinationRegion));
BalanceClientLoad(targetLoad, destinationRegion); BalanceClientLoad(targetLoad, destinationRegion);
return; return;
} }
default: default:
{ {
RegionSyncMessage.HandleError(LogHeader, msg, String.Format("{0} Unsupported message type: {1}", LogHeader, ((int)msg.Type).ToString())); RegionSyncMessage.HandleError(LogHeader(), msg, String.Format("{0} Unsupported message type: {1}", LogHeader(), ((int)msg.Type).ToString()));
return; return;
} }
} }
@ -798,7 +801,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
lock (exceptions) lock (exceptions)
// If this is a new message, then print the underlying data that caused it // If this is a new message, then print the underlying data that caused it
if (!exceptions.Contains(e.Message)) if (!exceptions.Contains(e.Message))
m_log.Error(LogHeader + " " + Encoding.ASCII.GetString(msg.Data, 0, msg.Length)); m_log.Error(LogHeader() + " " + Encoding.ASCII.GetString(msg.Data, 0, msg.Length));
data = null; data = null;
} }
return data; return data;
@ -849,8 +852,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_localAvatars = newlocals; m_localAvatars = newlocals;
} }
m_log.WarnFormat("{0} New local client \"{1}\" ({2}) being added to remote scene.", m_log.WarnFormat("{0} New local client \"{1}\" ({2}) being added to remote scene.",
LogHeader, client.Name, client.AgentId.ToString()); LogHeader(), client.Name, client.AgentId.ToString());
// Let the auth sim know that a new agent has connected // Let the auth sim know that a new agent has connected
OSDMap data = new OSDMap(4); OSDMap data = new OSDMap(4);
data["agentID"] = OSD.FromUUID(client.AgentId); data["agentID"] = OSD.FromUUID(client.AgentId);
@ -877,8 +880,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void EventManager_OnMakeChildAgent(ScenePresence scenep) public void EventManager_OnMakeChildAgent(ScenePresence scenep)
{ {
// if demoting from root, tell the server not to track our child // if demoting from root, tell the server not to track our child
m_log.DebugFormat("{0} Demotion to child. Sending remove for {1}/{2}", m_log.DebugFormat("{0} Demotion to child. Sending remove for {1}/{2}",
LogHeader, scenep.ControllingClient.Name, scenep.ControllingClient.AgentId); LogHeader(), scenep.ControllingClient.Name, scenep.ControllingClient.AgentId);
OSDMap data = new OSDMap(1); OSDMap data = new OSDMap(1);
data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId); data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data)));
@ -921,14 +924,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// If we are still connected, let the auth sim know that an agent has disconnected // If we are still connected, let the auth sim know that an agent has disconnected
if (m_client.Connected) if (m_client.Connected)
{ {
m_log.WarnFormat("{0} Local client ({1}) has left the scene. Notifying remote scene.", LogHeader, clientID.ToString()); m_log.WarnFormat("{0} Local client ({1}) has left the scene. Notifying remote scene.", LogHeader(), clientID.ToString());
OSDMap data = new OSDMap(1); OSDMap data = new OSDMap(1);
data["agentID"] = OSD.FromUUID(clientID); data["agentID"] = OSD.FromUUID(clientID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data)));
} }
else else
{ {
m_log.WarnFormat("{0} Local client ({1}) has left the scene.", LogHeader, clientID.ToString()); m_log.WarnFormat("{0} Local client ({1}) has left the scene.", LogHeader(), clientID.ToString());
// Remove it from our list of local avatars (we will never receive a confirmation since we are disconnected) // Remove it from our list of local avatars (we will never receive a confirmation since we are disconnected)
Dictionary<UUID, IClientAPI> newlocals = new Dictionary<UUID, IClientAPI>(LocalAvatars); Dictionary<UUID, IClientAPI> newlocals = new Dictionary<UUID, IClientAPI>(LocalAvatars);
newlocals.Remove(clientID); newlocals.Remove(clientID);
@ -953,21 +956,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
string name = "NOT FOUND"; string name = "NOT FOUND";
if (m_scene.TryGetScenePresence(agentID, out sp)) if (m_scene.TryGetScenePresence(agentID, out sp))
name = sp.Name; name = sp.Name;
m_log.WarnFormat("{0} Received LLClientView.SetAppearance ({1,3},{2,2}) for {3} (\"{4}\")", LogHeader, vp.Length.ToString(), (te == null) ? "" : "te", agentID.ToString(), sp.Name); m_log.WarnFormat("{0} Received LLClientView.SetAppearance ({1,3},{2,2}) for {3} (\"{4}\")", LogHeader(), vp.Length.ToString(), (te == null) ? "" : "te", agentID.ToString(), sp.Name);
if (sp == null) if (sp == null)
{ {
m_log.WarnFormat("{0} Scene presence could not be found to set appearance.", LogHeader); m_log.WarnFormat("{0} Scene presence could not be found to set appearance.", LogHeader());
return; return;
} }
// Set the appearance on the presence. This will generate the needed exchange with the client if rebakes need to take place. // Set the appearance on the presence. This will generate the needed exchange with the client if rebakes need to take place.
m_log.WarnFormat("{0} Setting appearance on ScenePresence {1} \"{2}\"", LogHeader, sp.UUID, sp.Name); m_log.WarnFormat("{0} Setting appearance on ScenePresence {1} \"{2}\"", LogHeader(), sp.UUID, sp.Name);
m_scene.AvatarFactory.SetAppearance(sp.ControllingClient, te, vp); m_scene.AvatarFactory.SetAppearance(sp.ControllingClient, te, vp);
} }
public void HandleAgentRequestSit(object sender, UUID agentID, UUID targetID, Vector3 offset) public void HandleAgentRequestSit(object sender, UUID agentID, UUID targetID, Vector3 offset)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleAgentRequestSit for {0}", agentID.ToString()); m_log.DebugFormat("{0} HandleAgentRequestSit for {1}", LogHeader(), agentID.ToString());
OSDMap data = new OSDMap(3); OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(agentID); data["agentID"] = OSD.FromUUID(agentID);
data["targetID"] = OSD.FromUUID(targetID); data["targetID"] = OSD.FromUUID(targetID);
@ -977,7 +980,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleAgentSit for {0}", agentID.ToString()); m_log.DebugFormat("{0} HandleAgentSit for {1}", LogHeader(), agentID.ToString());
OSDMap data = new OSDMap(1); OSDMap data = new OSDMap(1);
data["agentID"] = OSD.FromUUID(agentID); data["agentID"] = OSD.FromUUID(agentID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentSit, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentSit, OSDParser.SerializeJsonString(data)));
@ -985,7 +988,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void HandleGrabObject(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public void HandleGrabObject(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleGrabObject for {0}", remoteClient.AgentId.ToString()); m_log.DebugFormat("{0} HandleGrabObject for {1}", LogHeader(), remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(4); OSDMap data = new OSDMap(4);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId); data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["localID"] = OSD.FromUInteger(localID); data["localID"] = OSD.FromUInteger(localID);
@ -996,7 +999,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void HandleGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public void HandleGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleGrabUpdate for {0}", remoteClient.AgentId.ToString()); m_log.DebugFormat("{0} HandleGrabUpdate for {1}", LogHeader(), remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(5); OSDMap data = new OSDMap(5);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId); data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["objectID"] = OSD.FromUUID(objectID); data["objectID"] = OSD.FromUUID(objectID);
@ -1008,7 +1011,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void HandleDeGrabObject(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) public void HandleDeGrabObject(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{ {
m_log.DebugFormat("[REGION SYNC CLIENT] HandleDeGrabObject for {0}", remoteClient.AgentId.ToString()); m_log.DebugFormat("{0} HandleDeGrabObject for {1}", LogHeader(), remoteClient.AgentId.ToString());
OSDMap data = new OSDMap(3); OSDMap data = new OSDMap(3);
data["agentID"] = OSD.FromUUID(remoteClient.AgentId); data["agentID"] = OSD.FromUUID(remoteClient.AgentId);
data["localID"] = OSD.FromUInteger(localID); data["localID"] = OSD.FromUInteger(localID);
@ -1100,7 +1103,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["total"] = OSD.FromInteger(t); data["total"] = OSD.FromInteger(t);
data["local"] = OSD.FromInteger(l); data["local"] = OSD.FromInteger(l);
data["remote"] = OSD.FromInteger(r); data["remote"] = OSD.FromInteger(r);
//m_log.WarnFormat("{0}: Sent stats: {1},{2},{3}", LogHeader, t, l, r); //m_log.WarnFormat("{0}: Sent stats: {1},{2},{3}", LogHeader(), t, l, r);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionStatus, OSDParser.SerializeJsonString(data))); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionStatus, OSDParser.SerializeJsonString(data)));
} }
@ -1121,7 +1124,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.TryGetScenePresence(kvp.Key, out sp); m_scene.TryGetScenePresence(kvp.Key, out sp);
if (sp == null) if (sp == null)
{ {
m_log.ErrorFormat("{0} Could not find scene presence {1} to teleport", LogHeader, kvp.Value.Name); m_log.ErrorFormat("{0} Could not find scene presence {1} to teleport", LogHeader(), kvp.Value.Name);
continue; continue;
} }
@ -1144,7 +1147,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// Here we will subscribe to interesting client events // Here we will subscribe to interesting client events
public void IncomingLoadBalanceConnection(ScenePresence presence) public void IncomingLoadBalanceConnection(ScenePresence presence)
{ {
m_log.WarnFormat("{0} IncomingLoadBalanceConnection", LogHeader); m_log.WarnFormat("{0} IncomingLoadBalanceConnection", LogHeader());
IClientAPI client = presence.ControllingClient; IClientAPI client = presence.ControllingClient;
// Let the auth sim know we just picked up responsibility for this client // Let the auth sim know we just picked up responsibility for this client

View File

@ -43,10 +43,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
private string LogHeader()
{
return String.Format("[REGION SYNC SERVER ({0})]", m_scene.RegionInfo.RegionName);
}
public void ReportStats(System.IO.TextWriter tw) public void ReportStats(System.IO.TextWriter tw)
{ {
tw.WriteLine("{0}: [REGION SYNC SERVER] TOTAL LOCAL REMOTE TO_SCENE FROM_SCENE", DateTime.Now.ToLongTimeString()); tw.WriteLine("{0}: {1} TOTAL LOCAL REMOTE TO_SCENE FROM_SCENE", DateTime.Now.ToLongTimeString(), LogHeader());
tw.WriteLine("{0}: [REGION SYNC SERVER] MSGS ( /s ) BYTES ( Mbps ) MSGS ( /s ) BYTES ( Mbps ) QUEUE", DateTime.Now.ToLongTimeString()); tw.WriteLine("{0}: {1} MSGS ( /s ) BYTES ( Mbps ) MSGS ( /s ) BYTES ( Mbps ) QUEUE", DateTime.Now.ToLongTimeString(), LogHeader());
m_ClientBalancer.ForEachClientManager(delegate(RegionSyncClientView rscv) { m_ClientBalancer.ForEachClientManager(delegate(RegionSyncClientView rscv) {
{ {
tw.WriteLine("{0}: [{1}] {2}", DateTime.Now.ToLongTimeString(), rscv.Description, rscv.GetStats()); tw.WriteLine("{0}: [{1}] {2}", DateTime.Now.ToLongTimeString(), rscv.Description, rscv.GetStats());
@ -58,8 +63,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void ReportStatus() public void ReportStatus()
{ {
int cvcount = m_ClientBalancer.Count; int cvcount = m_ClientBalancer.Count;
m_log.ErrorFormat("[REGION SYNC SERVER] Connected to {0} remote client managers", cvcount); m_log.ErrorFormat("{0} Connected to {1} remote client managers", LogHeader(), cvcount);
m_log.ErrorFormat("[REGION SYNC SERVER] Local scene contains {0} presences", m_scene.SceneGraph.GetRootAgentCount()); m_log.ErrorFormat("{0} Local scene contains {1} presences", LogHeader(), m_scene.SceneGraph.GetRootAgentCount());
m_ClientBalancer.ForEachClientManager(delegate(RegionSyncClientView rscv){rscv.ReportStatus();}); m_ClientBalancer.ForEachClientManager(delegate(RegionSyncClientView rscv){rscv.ReportStatus();});
} }
@ -70,7 +75,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public RegionSyncServer(Scene scene, string addr, int port, int maxClientsPerManager) public RegionSyncServer(Scene scene, string addr, int port, int maxClientsPerManager)
{ {
m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//m_log.Warn("[REGION SYNC SERVER] Constructed");
m_scene = scene; m_scene = scene;
m_addr = IPAddress.Parse(addr); m_addr = IPAddress.Parse(addr);
m_port = port; m_port = port;
@ -82,9 +86,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_listenerThread = new Thread(new ThreadStart(Listen)); m_listenerThread = new Thread(new ThreadStart(Listen));
m_listenerThread.Name = "RegionSyncServer Listener"; m_listenerThread.Name = "RegionSyncServer Listener";
m_log.WarnFormat("[REGION SYNC SERVER] Starting {0} thread", m_listenerThread.Name); m_log.WarnFormat("{0} Starting {1} thread", LogHeader(), m_listenerThread.Name);
m_listenerThread.Start(); m_listenerThread.Start();
//m_log.Warn("[REGION SYNC SERVER] Started");
} }
@ -118,7 +121,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
while (true) while (true)
{ {
// *** Move/Add TRY/CATCH to here, but we don't want to spin loop on the same error // *** Move/Add TRY/CATCH to here, but we don't want to spin loop on the same error
m_log.WarnFormat("[REGION SYNC SERVER] Listening for new connections on {0}:{1}...", m_addr.ToString(), m_port.ToString()); m_log.WarnFormat("{0} Listening for new connections on {1}:{2}...", LogHeader(), m_addr.ToString(), m_port.ToString());
TcpClient tcpclient = m_listener.AcceptTcpClient(); TcpClient tcpclient = m_listener.AcceptTcpClient();
IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address; IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address;
int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port; int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port;
@ -127,13 +130,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
// so that messages coming from the scene do not get lost before the client view is added but // so that messages coming from the scene do not get lost before the client view is added but
// not sent before it is ready to process them. // not sent before it is ready to process them.
RegionSyncClientView rscv = new RegionSyncClientView(++clientCounter, m_scene, tcpclient); RegionSyncClientView rscv = new RegionSyncClientView(++clientCounter, m_scene, tcpclient);
m_log.WarnFormat("[REGION SYNC SERVER] New connection from {0}", rscv.Description); m_log.WarnFormat("{0} New connection from {1}", LogHeader(), rscv.Description);
m_ClientBalancer.AddSyncedClient(rscv); m_ClientBalancer.AddSyncedClient(rscv);
} }
} }
catch (SocketException e) catch (SocketException e)
{ {
m_log.WarnFormat("[REGION SYNC SERVER] [Listen] SocketException: {0}", e); m_log.WarnFormat("{0} [Listen] SocketException: {1}", LogHeader(), e);
} }
} }