aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs43
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs254
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs6
-rwxr-xr-xbin/Ionic.Zip.dllbin462336 -> 491520 bytes
7 files changed, 272 insertions, 44 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 3d715cc..3bad06c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -131,15 +131,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
131 m_TakeStore = new List<TakeValueCallbackClass>(); 131 m_TakeStore = new List<TakeValueCallbackClass>();
132 m_ReadStore = new List<TakeValueCallbackClass>(); 132 m_ReadStore = new List<TakeValueCallbackClass>();
133 } 133 }
134 134
135 public JsonStore(string value) : this() 135 public JsonStore(string value) : this()
136 { 136 {
137 // This is going to throw an exception if the value is not
138 // a valid JSON chunk. Calling routines should catch the
139 // exception and handle it appropriately
137 if (String.IsNullOrEmpty(value)) 140 if (String.IsNullOrEmpty(value))
138 ValueStore = new OSDMap(); 141 ValueStore = new OSDMap();
139 else 142 else
140 ValueStore = OSDParser.DeserializeJson(value); 143 ValueStore = OSDParser.DeserializeJson(value);
141 } 144 }
142 145
143 // ----------------------------------------------------------------- 146 // -----------------------------------------------------------------
144 /// <summary> 147 /// <summary>
145 /// 148 ///
@@ -198,7 +201,37 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
198 // ----------------------------------------------------------------- 201 // -----------------------------------------------------------------
199 public bool SetValue(string expr, string value, bool useJson) 202 public bool SetValue(string expr, string value, bool useJson)
200 { 203 {
201 OSD ovalue = useJson ? OSDParser.DeserializeJson(value) : new OSDString(value); 204 OSD ovalue;
205
206 // One note of caution... if you use an empty string in the
207 // structure it will be assumed to be a default value and will
208 // not be seialized in the json
209
210 if (useJson)
211 {
212 // There doesn't appear to be a good way to determine if the
213 // value is valid Json other than to let the parser crash
214 try
215 {
216 ovalue = OSDParser.DeserializeJson(value);
217 }
218 catch (Exception e)
219 {
220 if (value.StartsWith("'") && value.EndsWith("'"))
221 {
222 ovalue = new OSDString(value.Substring(1,value.Length - 2));
223 }
224 else
225 {
226 return false;
227 }
228 }
229 }
230 else
231 {
232 ovalue = new OSDString(value);
233 }
234
202 return SetValueFromExpression(expr,ovalue); 235 return SetValueFromExpression(expr,ovalue);
203 } 236 }
204 237
@@ -544,14 +577,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
544 // The path pointed to an intermediate hash structure 577 // The path pointed to an intermediate hash structure
545 if (result.Type == OSDType.Map) 578 if (result.Type == OSDType.Map)
546 { 579 {
547 value = OSDParser.SerializeJsonString(result as OSDMap); 580 value = OSDParser.SerializeJsonString(result as OSDMap,true);
548 return true; 581 return true;
549 } 582 }
550 583
551 // The path pointed to an intermediate hash structure 584 // The path pointed to an intermediate hash structure
552 if (result.Type == OSDType.Array) 585 if (result.Type == OSDType.Array)
553 { 586 {
554 value = OSDParser.SerializeJsonString(result as OSDArray); 587 value = OSDParser.SerializeJsonString(result as OSDArray,true);
555 return true; 588 return true;
556 } 589 }
557 590
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index f1ce856..cc13661 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
227 } 227 }
228 catch (Exception e) 228 catch (Exception e)
229 { 229 {
230 m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e); 230 m_log.ErrorFormat("[JsonStore]: Unable to initialize store from {0}", value);
231 return false; 231 return false;
232 } 232 }
233 233
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index af97ac7..eb4bc22 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -115,8 +115,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
115 TestHelpers.InMethod(); 115 TestHelpers.InMethod();
116// TestHelpers.EnableLogging(); 116// TestHelpers.EnableLogging();
117 117
118 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 118 // Test blank store
119 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero)); 119 {
120 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
121 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
122 }
123
124 // Test single element store
125 {
126 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
127 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
128 }
129
130 // Test with an integer value
131 {
132 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 42.15 }");
133 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
134
135 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
136 Assert.That(value, Is.EqualTo("42.15"));
137 }
120 } 138 }
121 139
122 [Test] 140 [Test]
@@ -153,19 +171,64 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
153 TestHelpers.InMethod(); 171 TestHelpers.InMethod();
154// TestHelpers.EnableLogging(); 172// TestHelpers.EnableLogging();
155 173
156 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); 174 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
175
176 {
177 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello.World");
178 Assert.That(value, Is.EqualTo("Two"));
179 }
157 180
158 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); 181 // Test get of path section instead of leaf
159 Assert.That(value, Is.EqualTo("World")); 182 {
183 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
184 Assert.That(value, Is.EqualTo(""));
185 }
160 186
161 // Test get of non-existing value 187 // Test get of non-existing value
162 string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo"); 188 {
163 Assert.That(fakeValueGet, Is.EqualTo("")); 189 string fakeValueGet = (string)InvokeOp("JsonGetValue", storeId, "foo");
190 Assert.That(fakeValueGet, Is.EqualTo(""));
191 }
164 192
165 // Test get from non-existing store 193 // Test get from non-existing store
166 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 194 {
167 string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); 195 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
168 Assert.That(fakeStoreValueGet, Is.EqualTo("")); 196 string fakeStoreValueGet = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello");
197 Assert.That(fakeStoreValueGet, Is.EqualTo(""));
198 }
199 }
200
201 [Test]
202 public void TestJsonGetValueJson()
203 {
204 TestHelpers.InMethod();
205// TestHelpers.EnableLogging();
206
207 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
208
209 {
210 string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello.World");
211 Assert.That(value, Is.EqualTo("'Two'"));
212 }
213
214 // Test get of path section instead of leaf
215 {
216 string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello");
217 Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}"));
218 }
219
220 // Test get of non-existing value
221 {
222 string fakeValueGet = (string)InvokeOp("JsonGetValueJson", storeId, "foo");
223 Assert.That(fakeValueGet, Is.EqualTo(""));
224 }
225
226 // Test get from non-existing store
227 {
228 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
229 string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello");
230 Assert.That(fakeStoreValueGet, Is.EqualTo(""));
231 }
169 } 232 }
170 233
171// [Test] 234// [Test]
@@ -224,18 +287,62 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
224 TestHelpers.InMethod(); 287 TestHelpers.InMethod();
225// TestHelpers.EnableLogging(); 288// TestHelpers.EnableLogging();
226 289
227 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); 290 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
228 291
229 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); 292 {
230 Assert.That(result, Is.EqualTo(1)); 293 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World");
294 Assert.That(result, Is.EqualTo(1));
295 }
231 296
232 int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo"); 297 // Test for path which does not resolve to a value.
233 Assert.That(result2, Is.EqualTo(0)); 298 {
299 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
300 Assert.That(result, Is.EqualTo(0));
301 }
302
303 {
304 int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo");
305 Assert.That(result2, Is.EqualTo(0));
306 }
234 307
235 // Test with fake store 308 // Test with fake store
236 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 309 {
237 int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello"); 310 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
238 Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); 311 int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello");
312 Assert.That(fakeStoreValueRemove, Is.EqualTo(0));
313 }
314 }
315
316 [Test]
317 public void TestJsonTestPathJson()
318 {
319 TestHelpers.InMethod();
320// TestHelpers.EnableLogging();
321
322 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
323
324 {
325 int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World");
326 Assert.That(result, Is.EqualTo(1));
327 }
328
329 // Test for path which does not resolve to a value.
330 {
331 int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello");
332 Assert.That(result, Is.EqualTo(1));
333 }
334
335 {
336 int result2 = (int)InvokeOp("JsonTestPathJson", storeId, "foo");
337 Assert.That(result2, Is.EqualTo(0));
338 }
339
340 // Test with fake store
341 {
342 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
343 int fakeStoreValueRemove = (int)InvokeOp("JsonTestPathJson", fakeStoreId, "Hello");
344 Assert.That(fakeStoreValueRemove, Is.EqualTo(0));
345 }
239 } 346 }
240 347
241 [Test] 348 [Test]
@@ -244,18 +351,91 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
244 TestHelpers.InMethod(); 351 TestHelpers.InMethod();
245// TestHelpers.EnableLogging(); 352// TestHelpers.EnableLogging();
246 353
247 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 354 {
355 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
356
357 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
358 Assert.That(result, Is.EqualTo(1));
359
360 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
361 Assert.That(value, Is.EqualTo("Times"));
362 }
363
364 // Test setting to location that does not exist. This should fail.
365 {
366 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
248 367
249 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); 368 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
250 Assert.That(result, Is.EqualTo(1)); 369 Assert.That(result, Is.EqualTo(0));
251 370
252 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); 371 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus");
253 Assert.That(value, Is.EqualTo("Times")); 372 Assert.That(value, Is.EqualTo(""));
373 }
254 374
255 // Test with fake store 375 // Test with fake store
256 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 376 {
257 int fakeStoreValueSet = (int)InvokeOp("JsonSetValue", fakeStoreId, "Hello", "World"); 377 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
258 Assert.That(fakeStoreValueSet, Is.EqualTo(0)); 378 int fakeStoreValueSet = (int)InvokeOp("JsonSetValue", fakeStoreId, "Hello", "World");
379 Assert.That(fakeStoreValueSet, Is.EqualTo(0));
380 }
381 }
382
383 [Test]
384 public void TestJsonSetValueJson()
385 {
386 TestHelpers.InMethod();
387// TestHelpers.EnableLogging();
388
389 // Single quoted token case
390 {
391 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
392
393 int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "'Times'");
394 Assert.That(result, Is.EqualTo(1));
395
396 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
397 Assert.That(value, Is.EqualTo("Times"));
398 }
399
400 // Sub-tree case
401 {
402 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
403
404 int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "{ 'Filled' : 'Times' }");
405 Assert.That(result, Is.EqualTo(1));
406
407 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled");
408 Assert.That(value, Is.EqualTo("Times"));
409 }
410
411 // If setting single strings in JsonSetValueJson, these must be single quoted tokens, not bare strings.
412 {
413 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
414
415 int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "Times");
416 Assert.That(result, Is.EqualTo(0));
417
418 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
419 Assert.That(value, Is.EqualTo(""));
420 }
421
422 // Test setting to location that does not exist. This should fail.
423 {
424 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
425
426 int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun.Circus", "'Times'");
427 Assert.That(result, Is.EqualTo(0));
428
429 string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus");
430 Assert.That(value, Is.EqualTo(""));
431 }
432
433 // Test with fake store
434 {
435 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
436 int fakeStoreValueSet = (int)InvokeOp("JsonSetValueJson", fakeStoreId, "Hello", "'World'");
437 Assert.That(fakeStoreValueSet, Is.EqualTo(0));
438 }
259 } 439 }
260 440
261 /// <summary> 441 /// <summary>
@@ -357,8 +537,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
357 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); 537 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
358 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName); 538 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName);
359 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 539 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
360 540
361 // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
362 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); 541 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
363 Assert.That(value, Is.EqualTo("")); 542 Assert.That(value, Is.EqualTo(""));
364 543
@@ -367,27 +546,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
367 } 546 }
368 547
369 { 548 {
370 // Read notecard to new multi-component path 549 // Read notecard to new multi-component path. This should not work.
371 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); 550 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
372 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); 551 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
373 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 552 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
374 553
375 // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
376 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); 554 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
377 Assert.That(value, Is.EqualTo("")); 555 Assert.That(value, Is.EqualTo(""));
378 556
379 // TODO: Check that we are not expecting reading to a new path to work.
380 value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello"); 557 value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello");
381 Assert.That(value, Is.EqualTo("")); 558 Assert.That(value, Is.EqualTo(""));
382 } 559 }
383 560
384 { 561 {
385 // Read notecard to existing multi-component path 562 // Read notecard to existing multi-component path. This should work
386 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); 563 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
387 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); 564 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
388 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 565 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
389 566
390 // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
391 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); 567 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
392 Assert.That(value, Is.EqualTo("")); 568 Assert.That(value, Is.EqualTo(""));
393 569
@@ -396,10 +572,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
396 } 572 }
397 573
398 { 574 {
575 // Read notecard to invalid path. This should not work.
576 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
577 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
578 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
579
580 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
581 Assert.That(value, Is.EqualTo(""));
582 }
583
584 {
399 // Try read notecard to fake store. 585 // Try read notecard to fake store.
400 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 586 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
401 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName); 587 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName);
402 Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero)); 588 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
403 589
404 string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); 590 string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello");
405 Assert.That(value, Is.EqualTo("")); 591 Assert.That(value, Is.EqualTo(""));
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f68612c..35ae44c 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -52,7 +52,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
52 { 52 {
53 bool Cancel(); 53 bool Cancel();
54 void Abort(); 54 void Abort();
55 bool Wait(TimeSpan t); 55
56 /// <summary>
57 /// Wait for the work item to complete.
58 /// </summary>
59 /// <param name='t'>The number of milliseconds to wait. Must be >= -1 (Timeout.Infinite).</param>
60 bool Wait(int t);
56 } 61 }
57 62
58 /// <summary> 63 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index c8ced43..26850c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -603,7 +603,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
603 if (!m_coopTermination) 603 if (!m_coopTermination)
604 { 604 {
605 // If we're not co-operative terminating then try and wait for the event to complete before stopping 605 // If we're not co-operative terminating then try and wait for the event to complete before stopping
606 if (workItem.Wait(new TimeSpan((long)timeout * 100000))) 606 if (workItem.Wait(timeout))
607 return true; 607 return true;
608 } 608 }
609 else 609 else
@@ -618,7 +618,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
618 618
619 // For now, we will wait forever since the event should always cleanly terminate once LSL loop 619 // For now, we will wait forever since the event should always cleanly terminate once LSL loop
620 // checking is implemented. May want to allow a shorter timeout option later. 620 // checking is implemented. May want to allow a shorter timeout option later.
621 if (workItem.Wait(TimeSpan.MaxValue)) 621 if (workItem.Wait(Timeout.Infinite))
622 { 622 {
623 if (DebugLevel >= 1) 623 if (DebugLevel >= 1)
624 m_log.DebugFormat( 624 m_log.DebugFormat(
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs b/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs
index 2ac5c31..8dd7677 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XWorkItem.cs
@@ -57,8 +57,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
57 wr.Abort(); 57 wr.Abort();
58 } 58 }
59 59
60 public bool Wait(TimeSpan t) 60 public bool Wait(int t)
61 { 61 {
62 // We use the integer version of WaitAll because the current version of SmartThreadPool has a bug with the
63 // TimeSpan version. The number of milliseconds in TimeSpan is an int64 so when STP casts it down to an
64 // int (32-bit) we can end up with bad values. This occurs on Windows though curious not on Mono 2.10.8
65 // (or very likely other versions of Mono at least up until 3.0.3).
62 return SmartThreadPool.WaitAll(new IWorkItemResult[] {wr}, t, false); 66 return SmartThreadPool.WaitAll(new IWorkItemResult[] {wr}, t, false);
63 } 67 }
64 } 68 }
diff --git a/bin/Ionic.Zip.dll b/bin/Ionic.Zip.dll
index 95fa928..e37f1bd 100755
--- a/bin/Ionic.Zip.dll
+++ b/bin/Ionic.Zip.dll
Binary files differ