aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
diff options
context:
space:
mode:
authorMelanie2009-10-06 17:44:59 +0100
committerMelanie2009-10-06 17:44:59 +0100
commit0374f1b144f3faf35da39e3925e8abd4b2a8bd04 (patch)
tree456d3d532c70d32564d35fc3cb9bbc81bdf08b2e /OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
parentMake sure that keys exist in arrays before trying to access them. (diff)
parentCorrected words in error message. (diff)
downloadopensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.zip
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.gz
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.bz2
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs')
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs75
1 files changed, 46 insertions, 29 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index e22328d..433ed0b 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -67,43 +67,50 @@ namespace OpenSim.Server.Handlers.Grid
67 67
68 //m_log.DebugFormat("[XXX]: query String: {0}", body); 68 //m_log.DebugFormat("[XXX]: query String: {0}", body);
69 69
70 Dictionary<string, string> request = 70 try
71 ServerUtils.ParseQueryString(body); 71 {
72 Dictionary<string, string> request =
73 ServerUtils.ParseQueryString(body);
72 74
73 if (!request.ContainsKey("METHOD")) 75 if (!request.ContainsKey("METHOD"))
74 return FailureResult(); 76 return FailureResult();
75 77
76 string method = request["METHOD"]; 78 string method = request["METHOD"];
77 79
78 switch (method) 80 switch (method)
79 { 81 {
80 case "register": 82 case "register":
81 return Register(request); 83 return Register(request);
82 84
83 case "deregister": 85 case "deregister":
84 return Deregister(request); 86 return Deregister(request);
85 87
86 case "get_neighbours": 88 case "get_neighbours":
87 return GetNeighbours(request); 89 return GetNeighbours(request);
88 90
89 case "get_region_by_uuid": 91 case "get_region_by_uuid":
90 return GetRegionByUUID(request); 92 return GetRegionByUUID(request);
91 93
92 case "get_region_by_position": 94 case "get_region_by_position":
93 return GetRegionByPosition(request); 95 return GetRegionByPosition(request);
94 96
95 case "get_region_by_name": 97 case "get_region_by_name":
96 return GetRegionByName(request); 98 return GetRegionByName(request);
97 99
98 case "get_regions_by_name": 100 case "get_regions_by_name":
99 return GetRegionsByName(request); 101 return GetRegionsByName(request);
100 102
101 case "get_region_range": 103 case "get_region_range":
102 return GetRegionRange(request); 104 return GetRegionRange(request);
103 105
106 }
107 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
108 }
109 catch (Exception e)
110 {
111 m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e);
104 } 112 }
105 113
106 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
107 return FailureResult(); 114 return FailureResult();
108 115
109 } 116 }
@@ -113,7 +120,7 @@ namespace OpenSim.Server.Handlers.Grid
113 byte[] Register(Dictionary<string, string> request) 120 byte[] Register(Dictionary<string, string> request)
114 { 121 {
115 UUID scopeID = UUID.Zero; 122 UUID scopeID = UUID.Zero;
116 if (request["SCOPEID"] != null) 123 if (request.ContainsKey("SCOPEID"))
117 UUID.TryParse(request["SCOPEID"], out scopeID); 124 UUID.TryParse(request["SCOPEID"], out scopeID);
118 else 125 else
119 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); 126 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
@@ -137,11 +144,21 @@ namespace OpenSim.Server.Handlers.Grid
137 } 144 }
138 145
139 Dictionary<string, object> rinfoData = new Dictionary<string, object>(); 146 Dictionary<string, object> rinfoData = new Dictionary<string, object>();
140 foreach (KeyValuePair<string, string> kvp in request) 147 GridRegion rinfo = null;
141 rinfoData[kvp.Key] = kvp.Value; 148 try
142 GridRegion rinfo = new GridRegion(rinfoData); 149 {
150 foreach (KeyValuePair<string, string> kvp in request)
151 rinfoData[kvp.Key] = kvp.Value;
152 rinfo = new GridRegion(rinfoData);
153 }
154 catch (Exception e)
155 {
156 m_log.DebugFormat("[GRID HANDLER]: exception unpacking region data: {0}", e);
157 }
143 158
144 bool result = m_GridService.RegisterRegion(scopeID, rinfo); 159 bool result = false;
160 if (rinfo != null)
161 result = m_GridService.RegisterRegion(scopeID, rinfo);
145 162
146 if (result) 163 if (result)
147 return SuccessResult(); 164 return SuccessResult();