diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.GridInterfaces/Local/LocalGridServer.cs (renamed from src/LocalServers/LocalGridServers/LocalGrid.cs) | 135 |
1 files changed, 40 insertions, 95 deletions
diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs index bd377d3..d70e989 100644 --- a/src/LocalServers/LocalGridServers/LocalGrid.cs +++ b/OpenSim.GridInterfaces/Local/LocalGridServer.cs | |||
@@ -27,10 +27,14 @@ | |||
27 | using System; | 27 | using System; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Threading; | 29 | using System.Threading; |
30 | using OpenSim.GridServers; | 30 | using System.IO; |
31 | using OpenSim.Framework.Interfaces; | ||
32 | using OpenSim.Framework.Assets; | ||
31 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Db4objects.Db4o; | ||
35 | using Db4objects.Db4o.Query; | ||
32 | 36 | ||
33 | namespace LocalGridServers | 37 | namespace OpenSim.GridInterfaces.Local |
34 | { | 38 | { |
35 | /// <summary> | 39 | /// <summary> |
36 | /// | 40 | /// |
@@ -49,86 +53,26 @@ namespace LocalGridServers | |||
49 | } | 53 | } |
50 | } | 54 | } |
51 | 55 | ||
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 | 56 | public class LocalGridServer : LocalGridBase |
114 | { | 57 | { |
115 | public List<Login> Sessions = new List<Login>(); | 58 | public List<Login> Sessions = new List<Login>(); |
116 | 59 | ||
117 | public LocalGridServer() | 60 | public LocalGridServer() |
118 | { | 61 | { |
119 | Sessions = new List<Login>(); | 62 | Sessions = new List<Login>(); |
120 | ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); | 63 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Grid Server class created"); |
121 | } | ||
122 | |||
123 | public override string GetName() | ||
124 | { | ||
125 | return "Local"; | ||
126 | } | 64 | } |
127 | 65 | ||
128 | public override bool RequestConnection() | 66 | public override bool RequestConnection() |
129 | { | 67 | { |
130 | return true; | 68 | return true; |
131 | } | 69 | } |
70 | |||
71 | public override string GetName() | ||
72 | { | ||
73 | return "Local"; | ||
74 | } | ||
75 | |||
132 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | 76 | public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) |
133 | { | 77 | { |
134 | //we are running local | 78 | //we are running local |
@@ -159,17 +103,22 @@ namespace LocalGridServers | |||
159 | UUIDBlock uuidBlock = new UUIDBlock(); | 103 | UUIDBlock uuidBlock = new UUIDBlock(); |
160 | return(uuidBlock); | 104 | return(uuidBlock); |
161 | } | 105 | } |
162 | 106 | ||
163 | public override neighbourinfo[] RequestNeighbours(ulong regionhandle) | 107 | public override NeighbourInfo[] RequestNeighbours() |
164 | { | 108 | { |
165 | return new neighbourinfo[8]; | 109 | return null; |
166 | } | 110 | } |
167 | 111 | ||
168 | public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey) | 112 | public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey) |
169 | { | 113 | { |
170 | 114 | ||
171 | } | 115 | } |
172 | 116 | ||
117 | public override void Close() | ||
118 | { | ||
119 | |||
120 | } | ||
121 | |||
173 | /// <summary> | 122 | /// <summary> |
174 | /// used by the local login server to inform us of new sessions | 123 | /// used by the local login server to inform us of new sessions |
175 | /// </summary> | 124 | /// </summary> |
@@ -182,30 +131,26 @@ namespace LocalGridServers | |||
182 | } | 131 | } |
183 | } | 132 | } |
184 | } | 133 | } |
185 | |||
186 | public class BlockingQueue< T > { | ||
187 | private Queue< T > _queue = new Queue< T >(); | ||
188 | private object _queueSync = new object(); | ||
189 | 134 | ||
190 | public void Enqueue(T value) | 135 | public class AssetUUIDQuery : Predicate |
136 | { | ||
137 | private LLUUID _findID; | ||
138 | |||
139 | public AssetUUIDQuery(LLUUID find) | ||
191 | { | 140 | { |
192 | lock(_queueSync) | 141 | _findID = find; |
193 | { | ||
194 | _queue.Enqueue(value); | ||
195 | Monitor.Pulse(_queueSync); | ||
196 | } | ||
197 | } | 142 | } |
198 | 143 | public bool Match(AssetStorage asset) | |
199 | public T Dequeue() | ||
200 | { | 144 | { |
201 | lock(_queueSync) | 145 | return (asset.UUID == _findID); |
202 | { | ||
203 | if( _queue.Count < 1) | ||
204 | Monitor.Wait(_queueSync); | ||
205 | |||
206 | return _queue.Dequeue(); | ||
207 | } | ||
208 | } | 146 | } |
209 | } | 147 | } |
210 | 148 | ||
149 | public class AssetStorage | ||
150 | { | ||
151 | public byte[] Data; | ||
152 | public sbyte Type; | ||
153 | public string Name; | ||
154 | public LLUUID UUID; | ||
155 | } | ||
211 | } | 156 | } |