diff options
author | gareth | 2007-03-22 10:11:15 +0000 |
---|---|---|
committer | gareth | 2007-03-22 10:11:15 +0000 |
commit | 7daa3955bc3a1918e40962851f9e8d38597a245e (patch) | |
tree | bee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /src/LocalServers/LocalGridServers/LocalGrid.cs | |
parent | Load XML for neighbourinfo from grid (diff) | |
download | opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.zip opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2 opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz |
brought zircon branch into trunk
Diffstat (limited to 'src/LocalServers/LocalGridServers/LocalGrid.cs')
-rw-r--r-- | src/LocalServers/LocalGridServers/LocalGrid.cs | 211 |
1 files changed, 0 insertions, 211 deletions
diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/src/LocalServers/LocalGridServers/LocalGrid.cs deleted file mode 100644 index bd377d3..0000000 --- a/src/LocalServers/LocalGridServers/LocalGrid.cs +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Threading; | ||
30 | using OpenSim.GridServers; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace LocalGridServers | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// | ||
37 | /// </summary> | ||
38 | /// | ||
39 | public class LocalGridPlugin : IGridPlugin | ||
40 | { | ||
41 | public LocalGridPlugin() | ||
42 | { | ||
43 | |||
44 | } | ||
45 | |||
46 | public IGridServer GetGridServer() | ||
47 | { | ||
48 | return(new LocalGridServer()); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public class LocalAssetPlugin : IAssetPlugin | ||
53 | { | ||
54 | public LocalAssetPlugin() | ||
55 | { | ||
56 | |||
57 | } | ||
58 | |||
59 | public IAssetServer GetAssetServer() | ||
60 | { | ||
61 | return(new LocalAssetServer()); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public class LocalAssetServer : IAssetServer | ||
66 | { | ||
67 | private IAssetReceiver _receiver; | ||
68 | private BlockingQueue<ARequest> _assetRequests; | ||
69 | |||
70 | public LocalAssetServer() | ||
71 | { | ||
72 | this._assetRequests = new BlockingQueue<ARequest>(); | ||
73 | ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created"); | ||
74 | } | ||
75 | |||
76 | public void SetReceiver(IAssetReceiver receiver) | ||
77 | { | ||
78 | this._receiver = receiver; | ||
79 | } | ||
80 | |||
81 | public void RequestAsset(LLUUID assetID, bool isTexture) | ||
82 | { | ||
83 | ARequest req = new ARequest(); | ||
84 | req.AssetID = assetID; | ||
85 | req.IsTexture = isTexture; | ||
86 | //this._assetRequests.Enqueue(req); | ||
87 | } | ||
88 | |||
89 | public void UpdateAsset(AssetBase asset) | ||
90 | { | ||
91 | |||
92 | } | ||
93 | |||
94 | public void UploadNewAsset(AssetBase asset) | ||
95 | { | ||
96 | |||
97 | } | ||
98 | |||
99 | public void SetServerInfo(string ServerUrl, string SendKey) | ||
100 | { | ||
101 | |||
102 | } | ||
103 | |||
104 | private void RunRequests() | ||
105 | { | ||
106 | while(true) | ||
107 | { | ||
108 | Thread.Sleep(1000); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public class LocalGridServer : LocalGridBase | ||
114 | { | ||
115 | public List<Login> Sessions = new List<Login>(); | ||
116 | |||
117 | public LocalGridServer() | ||
118 | { | ||
119 | Sessions = new List<Login>(); | ||
120 | ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); | ||
121 | } | ||
122 | |||
123 | public override string GetName() | ||
124 | { | ||
125 | return "Local"; | ||
126 | } | ||
127 | |||
128 | public override bool RequestConnection() | ||
129 | { | ||
130 | return true; | ||
131 | } | ||
132 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
133 | { | ||
134 | //we are running local | ||
135 | AuthenticateResponse user = new AuthenticateResponse(); | ||
136 | |||
137 | lock(this.Sessions) | ||
138 | { | ||
139 | |||
140 | for(int i = 0; i < Sessions.Count; i++) | ||
141 | { | ||
142 | if((Sessions[i].Agent == agentID) && (Sessions[i].Session == sessionID)) | ||
143 | { | ||
144 | user.Authorised = true; | ||
145 | user.LoginInfo = Sessions[i]; | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | return(user); | ||
150 | } | ||
151 | |||
152 | public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | ||
153 | { | ||
154 | return(true); | ||
155 | } | ||
156 | |||
157 | public override UUIDBlock RequestUUIDBlock() | ||
158 | { | ||
159 | UUIDBlock uuidBlock = new UUIDBlock(); | ||
160 | return(uuidBlock); | ||
161 | } | ||
162 | |||
163 | public override neighbourinfo[] RequestNeighbours(ulong regionhandle) | ||
164 | { | ||
165 | return new neighbourinfo[8]; | ||
166 | } | ||
167 | |||
168 | public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey) | ||
169 | { | ||
170 | |||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// used by the local login server to inform us of new sessions | ||
175 | /// </summary> | ||
176 | /// <param name="session"></param> | ||
177 | public override void AddNewSession(Login session) | ||
178 | { | ||
179 | lock(this.Sessions) | ||
180 | { | ||
181 | this.Sessions.Add(session); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | |||
186 | public class BlockingQueue< T > { | ||
187 | private Queue< T > _queue = new Queue< T >(); | ||
188 | private object _queueSync = new object(); | ||
189 | |||
190 | public void Enqueue(T value) | ||
191 | { | ||
192 | lock(_queueSync) | ||
193 | { | ||
194 | _queue.Enqueue(value); | ||
195 | Monitor.Pulse(_queueSync); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | public T Dequeue() | ||
200 | { | ||
201 | lock(_queueSync) | ||
202 | { | ||
203 | if( _queue.Count < 1) | ||
204 | Monitor.Wait(_queueSync); | ||
205 | |||
206 | return _queue.Dequeue(); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | } | ||