aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorMelanie2011-12-08 18:29:19 +0000
committerMelanie2011-12-08 18:29:19 +0000
commit96539ffc79c1654feddc17592170f0e4b57f5b8d (patch)
treed500df1c7a7b37cae6e74d52b67f51aa7bfad46d /OpenSim/Region/ClientStack/Linden
parentMerge branch 'master' into bigmerge (diff)
parentWhen a client connects to a scene, send other avatar appearance data asynchro... (diff)
downloadopensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.zip
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.gz
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.bz2
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs58
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs5
3 files changed, 46 insertions, 21 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index effa8d0..af68de6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -390,6 +390,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
390 } 390 }
391 } 391 }
392 public UUID AgentId { get { return m_agentId; } } 392 public UUID AgentId { get { return m_agentId; } }
393 public ISceneAgent SceneAgent { get; private set; }
393 public UUID ActiveGroupId { get { return m_activeGroupID; } } 394 public UUID ActiveGroupId { get { return m_activeGroupID; } }
394 public string ActiveGroupName { get { return m_activeGroupName; } } 395 public string ActiveGroupName { get { return m_activeGroupName; } }
395 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 396 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
@@ -531,6 +532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
531 532
532 // Remove ourselves from the scene 533 // Remove ourselves from the scene
533 m_scene.RemoveClient(AgentId, true); 534 m_scene.RemoveClient(AgentId, true);
535 SceneAgent = null;
534 536
535 // We can't reach into other scenes and close the connection 537 // We can't reach into other scenes and close the connection
536 // We need to do this over grid communications 538 // We need to do this over grid communications
@@ -710,7 +712,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
710 712
711 public virtual void Start() 713 public virtual void Start()
712 { 714 {
713 m_scene.AddNewClient(this, PresenceType.User); 715 SceneAgent = m_scene.AddNewClient(this, PresenceType.User);
714 716
715 RefreshGroupMembership(); 717 RefreshGroupMembership();
716 } 718 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index ae8251a..b04fe9f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -894,11 +894,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
894 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; 894 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
895 895
896 // Begin the process of adding the client to the simulator 896 // Begin the process of adding the client to the simulator
897 AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint); 897 IClientAPI client = AddNewClient((UseCircuitCodePacket)packet, remoteEndPoint);
898 898
899 // Send ack 899 // Send ack straight away to let the viewer know that the connection is active.
900 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 900 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
901 901
902 // FIXME: Nasty - this is the only way we currently know if Scene.AddNewClient() failed to find a
903 // circuit and bombed out early. That check might be pointless since authorization is established
904 // up here.
905 if (client != null && client.SceneAgent != null)
906 client.SceneAgent.SendInitialDataToMe();
907
902 // m_log.DebugFormat( 908 // m_log.DebugFormat(
903// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 909// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
904// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 910// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
@@ -933,7 +939,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
933 return sessionInfo.Authorised; 939 return sessionInfo.Authorised;
934 } 940 }
935 941
936 private void AddNewClient(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint) 942 /// <summary>
943 /// Add a new client.
944 /// </summary>
945 /// <param name="useCircuitCode"></param>
946 /// <param name="remoteEndPoint"></param>
947 /// <returns>
948 /// The client that was added or null if the client failed authorization or already existed.
949 /// </returns>
950 private IClientAPI AddNewClient(UseCircuitCodePacket useCircuitCode, IPEndPoint remoteEndPoint)
937 { 951 {
938 UUID agentID = useCircuitCode.CircuitCode.ID; 952 UUID agentID = useCircuitCode.CircuitCode.ID;
939 UUID sessionID = useCircuitCode.CircuitCode.SessionID; 953 UUID sessionID = useCircuitCode.CircuitCode.SessionID;
@@ -942,7 +956,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
942 AuthenticateResponse sessionInfo; 956 AuthenticateResponse sessionInfo;
943 if (IsClientAuthorized(useCircuitCode, out sessionInfo)) 957 if (IsClientAuthorized(useCircuitCode, out sessionInfo))
944 { 958 {
945 AddClient(circuitCode, agentID, sessionID, remoteEndPoint, sessionInfo); 959 return AddClient(circuitCode, agentID, sessionID, remoteEndPoint, sessionInfo);
946 } 960 }
947 else 961 else
948 { 962 {
@@ -950,38 +964,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
950 m_log.WarnFormat( 964 m_log.WarnFormat(
951 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", 965 "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}",
952 useCircuitCode.CircuitCode.ID, useCircuitCode.CircuitCode.Code, remoteEndPoint); 966 useCircuitCode.CircuitCode.ID, useCircuitCode.CircuitCode.Code, remoteEndPoint);
967
968 return null;
953 } 969 }
954 } 970 }
955 971
956 protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) 972 /// <summary>
973 /// Add a client.
974 /// </summary>
975 /// <param name="circuitCode"></param>
976 /// <param name="agentID"></param>
977 /// <param name="sessionID"></param>
978 /// <param name="remoteEndPoint"></param>
979 /// <param name="sessionInfo"></param>
980 /// <returns>The client if it was added. Null if the client already existed.</returns>
981 protected virtual IClientAPI AddClient(
982 uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
957 { 983 {
984 IClientAPI client = null;
985
958 // In priciple there shouldn't be more than one thread here, ever. 986 // In priciple there shouldn't be more than one thread here, ever.
959 // But in case that happens, we need to synchronize this piece of code 987 // But in case that happens, we need to synchronize this piece of code
960 // because it's too important 988 // because it's too important
961 lock (this) 989 lock (this)
962 { 990 {
963 IClientAPI existingClient; 991 if (!m_scene.TryGetClient(agentID, out client))
964
965 if (!m_scene.TryGetClient(agentID, out existingClient))
966 { 992 {
967 // Create the LLUDPClient
968 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 993 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
969 // Create the LLClientView 994
970 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 995 client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
971 client.OnLogout += LogoutHandler; 996 client.OnLogout += LogoutHandler;
972 997
973 client.DisableFacelights = m_disableFacelights; 998 ((LLClientView)client).DisableFacelights = m_disableFacelights;
974 999
975 // Start the IClientAPI
976 client.Start(); 1000 client.Start();
977
978 }
979 else
980 {
981 m_log.WarnFormat("[LLUDPSERVER]: Ignoring a repeated UseCircuitCode from {0} at {1} for circuit {2}",
982 existingClient.AgentId, remoteEndPoint, circuitCode);
983 } 1001 }
984 } 1002 }
1003
1004 return client;
985 } 1005 }
986 1006
987 private void RemoveClient(LLUDPClient udpClient) 1007 private void RemoveClient(LLUDPClient udpClient)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
index 737c654..fb94355 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
@@ -53,9 +53,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
53 public override void Update() {} 53 public override void Update() {}
54 public override void LoadWorldMap() {} 54 public override void LoadWorldMap() {}
55 55
56 public override void AddNewClient(IClientAPI client, PresenceType type) 56 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
57 { 57 {
58 client.OnObjectName += RecordObjectNameCall; 58 client.OnObjectName += RecordObjectNameCall;
59
60 // FIXME
61 return null;
59 } 62 }
60 63
61 public override void RemoveClient(UUID agentID, bool someReason) {} 64 public override void RemoveClient(UUID agentID, bool someReason) {}