diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Map/MapGetServerConnector.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs index 7bb2f39..1ae669c 100644 --- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | 33 | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using log4net; | 35 | using log4net; |
@@ -37,6 +38,7 @@ using OpenSim.Server.Base; | |||
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Server.Handlers.Base; | 40 | using OpenSim.Server.Handlers.Base; |
41 | using OpenMetaverse; | ||
40 | 42 | ||
41 | namespace OpenSim.Server.Handlers.MapImage | 43 | namespace OpenSim.Server.Handlers.MapImage |
42 | { | 44 | { |
@@ -70,6 +72,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
70 | 72 | ||
71 | class MapServerGetHandler : BaseStreamHandler | 73 | class MapServerGetHandler : BaseStreamHandler |
72 | { | 74 | { |
75 | public static ManualResetEvent ev = new ManualResetEvent(true); | ||
76 | |||
73 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
74 | 78 | ||
75 | private IMapImageService m_MapService; | 79 | private IMapImageService m_MapService; |
@@ -82,10 +86,25 @@ namespace OpenSim.Server.Handlers.MapImage | |||
82 | 86 | ||
83 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 87 | protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
84 | { | 88 | { |
85 | byte[] result = new byte[0]; | 89 | ev.WaitOne(); |
90 | lock (ev) | ||
91 | { | ||
92 | ev.Reset(); | ||
93 | } | ||
86 | 94 | ||
95 | byte[] result = new byte[0]; | ||
87 | string format = string.Empty; | 96 | string format = string.Empty; |
88 | result = m_MapService.GetMapTile(path.Trim('/'), out format); | 97 | |
98 | // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); | ||
99 | UUID scopeID = UUID.Zero; | ||
100 | |||
101 | string[] bits = path.Trim('/').Split(new char[] {'/'}); | ||
102 | if (bits.Length > 1) | ||
103 | { | ||
104 | scopeID = new UUID(bits[0]); | ||
105 | path = bits[1]; | ||
106 | } | ||
107 | result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format); | ||
89 | if (result.Length > 0) | 108 | if (result.Length > 0) |
90 | { | 109 | { |
91 | httpResponse.StatusCode = (int)HttpStatusCode.OK; | 110 | httpResponse.StatusCode = (int)HttpStatusCode.OK; |
@@ -100,6 +119,11 @@ namespace OpenSim.Server.Handlers.MapImage | |||
100 | httpResponse.ContentType = "text/plain"; | 119 | httpResponse.ContentType = "text/plain"; |
101 | } | 120 | } |
102 | 121 | ||
122 | lock (ev) | ||
123 | { | ||
124 | ev.Set(); | ||
125 | } | ||
126 | |||
103 | return result; | 127 | return result; |
104 | } | 128 | } |
105 | 129 | ||