aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs54
1 files changed, 30 insertions, 24 deletions
diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
index 2293dbf..f763446 100644
--- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
+++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs
@@ -16,7 +16,7 @@ namespace OpenGrid.Framework.Communications.OGS1
16{ 16{
17 public class OGS1GridServices : IGridServices 17 public class OGS1GridServices : IGridServices
18 { 18 {
19 public RegionCommsListener listener; 19 public Dictionary<ulong, RegionCommsListener> listeners = new Dictionary<ulong, RegionCommsListener>();
20 public GridInfo grid; 20 public GridInfo grid;
21 public BaseHttpServer httpListener; 21 public BaseHttpServer httpListener;
22 private bool initialised = false; 22 private bool initialised = false;
@@ -52,7 +52,7 @@ namespace OpenGrid.Framework.Communications.OGS1
52 } 52 }
53 53
54 // Initialise the background listeners 54 // Initialise the background listeners
55 listener = new RegionCommsListener(); 55 listeners[regionInfo.RegionHandle] = new RegionCommsListener();
56 56
57 if (!initialised) 57 if (!initialised)
58 { 58 {
@@ -62,21 +62,12 @@ namespace OpenGrid.Framework.Communications.OGS1
62 httpListener.Start(); 62 httpListener.Start();
63 } 63 }
64 64
65 return listener; 65 return listeners[regionInfo.RegionHandle];
66 } 66 }
67 67
68 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo) 68 public List<RegionInfo> RequestNeighbours(RegionInfo regionInfo)
69 { 69 {
70 Hashtable param = new Hashtable(); 70 Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1);
71 param["xmin"] = regionInfo.RegionLocX - 1;
72 param["ymin"] = regionInfo.RegionLocY - 1;
73 param["xmax"] = regionInfo.RegionLocX + 1;
74 param["ymax"] = regionInfo.RegionLocY + 1;
75 IList parameters = new ArrayList();
76 parameters.Add(param);
77 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
78 XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
79 Hashtable respData = (Hashtable)resp.Value;
80 71
81 List<RegionInfo> neighbours = new List<RegionInfo>(); 72 List<RegionInfo> neighbours = new List<RegionInfo>();
82 73
@@ -101,23 +92,16 @@ namespace OpenGrid.Framework.Communications.OGS1
101 92
102 return neighbours; 93 return neighbours;
103 } 94 }
95
104 public RegionInfo RequestNeighbourInfo(ulong regionHandle) 96 public RegionInfo RequestNeighbourInfo(ulong regionHandle)
105 { 97 {
106 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()"); 98 OpenSim.Framework.Console.MainLog.Instance.Warn("Unimplemented - RequestNeighbourInfo()");
107 return null; 99 return null;
108 } 100 }
101
109 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY) 102 public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
110 { 103 {
111 Hashtable param = new Hashtable(); 104 Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY);
112 param["xmin"] = minX;
113 param["ymin"] = minY;
114 param["xmax"] = maxX;
115 param["ymax"] = maxY;
116 IList parameters = new ArrayList();
117 parameters.Add(param);
118 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
119 XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
120 Hashtable respData = (Hashtable)resp.Value;
121 105
122 List<MapBlockData> neighbours = new List<MapBlockData>(); 106 List<MapBlockData> neighbours = new List<MapBlockData>();
123 107
@@ -140,6 +124,21 @@ namespace OpenGrid.Framework.Communications.OGS1
140 return neighbours; 124 return neighbours;
141 } 125 }
142 126
127 private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
128 {
129 Hashtable param = new Hashtable();
130 param["xmin"] = minX;
131 param["ymin"] = minY;
132 param["xmax"] = maxX;
133 param["ymax"] = maxY;
134 IList parameters = new ArrayList();
135 parameters.Add(param);
136 XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
137 XmlRpcResponse resp = req.Send(grid.GridServerURI, 3000);
138 Hashtable respData = (Hashtable)resp.Value;
139 return respData;
140 }
141
143 // Grid Request Processing 142 // Grid Request Processing
144 public XmlRpcResponse ExpectUser(XmlRpcRequest request) 143 public XmlRpcResponse ExpectUser(XmlRpcRequest request)
145 { 144 {
@@ -162,7 +161,14 @@ namespace OpenGrid.Framework.Communications.OGS1
162 161
163 } 162 }
164 163
165 this.listener.TriggerExpectUser((ulong)requestData["regionhandle"], agentData); 164 if (listeners.ContainsKey((ulong)requestData["regionhandle"]))
165 {
166 this.listeners[(ulong)requestData["regionhandle"]].TriggerExpectUser((ulong)requestData["regionhandle"], agentData);
167 }
168 else
169 {
170 OpenSim.Framework.Console.MainLog.Instance.Error("ExpectUser() - Unknown region " + ((ulong)requestData["regionhandle"]).ToString());
171 }
166 172
167 return new XmlRpcResponse(); 173 return new XmlRpcResponse();
168 } 174 }