diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 7b1aa2c..1e22fcc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -903,47 +903,64 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
903 | 903 | ||
904 | private void HandleUseCircuitCode(object o) | 904 | private void HandleUseCircuitCode(object o) |
905 | { | 905 | { |
906 | // DateTime startTime = DateTime.Now; | 906 | IPEndPoint remoteEndPoint = null; |
907 | object[] array = (object[])o; | 907 | IClientAPI client = null; |
908 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; | ||
909 | UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; | ||
910 | |||
911 | m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint); | ||
912 | |||
913 | IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; | ||
914 | 908 | ||
915 | AuthenticateResponse sessionInfo; | 909 | try |
916 | if (IsClientAuthorized(uccp, out sessionInfo)) | ||
917 | { | 910 | { |
918 | // Begin the process of adding the client to the simulator | 911 | // DateTime startTime = DateTime.Now; |
919 | IClientAPI client | 912 | object[] array = (object[])o; |
920 | = AddClient( | 913 | UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; |
921 | uccp.CircuitCode.Code, | 914 | UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; |
922 | uccp.CircuitCode.ID, | 915 | |
923 | uccp.CircuitCode.SessionID, | 916 | m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint); |
924 | remoteEndPoint, | 917 | |
925 | sessionInfo); | 918 | remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; |
926 | 919 | ||
927 | // Send ack straight away to let the viewer know that the connection is active. | 920 | AuthenticateResponse sessionInfo; |
928 | // The client will be null if it already exists (e.g. if on a region crossing the client sends a use | 921 | if (IsClientAuthorized(uccp, out sessionInfo)) |
929 | // circuit code to the existing child agent. This is not particularly obvious. | 922 | { |
930 | SendAckImmediate(remoteEndPoint, uccp.Header.Sequence); | 923 | // Begin the process of adding the client to the simulator |
931 | 924 | client | |
932 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 925 | = AddClient( |
933 | if (client != null) | 926 | uccp.CircuitCode.Code, |
934 | client.SceneAgent.SendInitialDataToMe(); | 927 | uccp.CircuitCode.ID, |
928 | uccp.CircuitCode.SessionID, | ||
929 | remoteEndPoint, | ||
930 | sessionInfo); | ||
931 | |||
932 | // Send ack straight away to let the viewer know that the connection is active. | ||
933 | // The client will be null if it already exists (e.g. if on a region crossing the client sends a use | ||
934 | // circuit code to the existing child agent. This is not particularly obvious. | ||
935 | SendAckImmediate(remoteEndPoint, uccp.Header.Sequence); | ||
936 | |||
937 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | ||
938 | if (client != null) | ||
939 | client.SceneAgent.SendInitialDataToMe(); | ||
940 | } | ||
941 | else | ||
942 | { | ||
943 | // Don't create clients for unauthorized requesters. | ||
944 | m_log.WarnFormat( | ||
945 | "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", | ||
946 | uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); | ||
947 | } | ||
948 | |||
949 | // m_log.DebugFormat( | ||
950 | // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", | ||
951 | // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); | ||
952 | |||
935 | } | 953 | } |
936 | else | 954 | catch (Exception e) |
937 | { | 955 | { |
938 | // Don't create clients for unauthorized requesters. | 956 | m_log.ErrorFormat( |
939 | m_log.WarnFormat( | 957 | "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", |
940 | "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", | 958 | remoteEndPoint != null ? remoteEndPoint.ToString() : "n/a", |
941 | uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); | 959 | client != null ? client.Name : "unknown", |
960 | client != null ? client.AgentId.ToString() : "unknown", | ||
961 | e.Message, | ||
962 | e.StackTrace); | ||
942 | } | 963 | } |
943 | |||
944 | // m_log.DebugFormat( | ||
945 | // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", | ||
946 | // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); | ||
947 | } | 964 | } |
948 | 965 | ||
949 | /// <summary> | 966 | /// <summary> |