diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 42db1cf..17387da 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -829,26 +829,23 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
829 | 829 | ||
830 | private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) | 830 | private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) |
831 | { | 831 | { |
832 | if (TerrainUploader != null) | 832 | lock (this) |
833 | { | 833 | { |
834 | lock (TerrainUploader) | 834 | if ((TerrainUploader != null) && (XferID == TerrainUploader.XferID)) |
835 | { | 835 | { |
836 | if (XferID == TerrainUploader.XferID) | 836 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; |
837 | { | 837 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; |
838 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; | 838 | TerrainUploader.TerrainUploadDone -= HandleTerrainApplication; |
839 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; | ||
840 | TerrainUploader.TerrainUploadDone -= HandleTerrainApplication; | ||
841 | 839 | ||
842 | TerrainUploader = null; | 840 | TerrainUploader = null; |
843 | remoteClient.SendAlertMessage("Terrain Upload aborted by the client"); | 841 | remoteClient.SendAlertMessage("Terrain Upload aborted by the client"); |
844 | } | ||
845 | } | 842 | } |
846 | } | 843 | } |
847 | |||
848 | } | 844 | } |
845 | |||
849 | private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient) | 846 | private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient) |
850 | { | 847 | { |
851 | lock (TerrainUploader) | 848 | lock (this) |
852 | { | 849 | { |
853 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; | 850 | remoteClient.OnXferReceive -= TerrainUploader.XferReceive; |
854 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; | 851 | remoteClient.OnAbortXfer -= AbortTerrainXferHandler; |
@@ -907,22 +904,32 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
907 | 904 | ||
908 | private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) | 905 | private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) |
909 | { | 906 | { |
910 | if (TerrainUploader == null) | 907 | lock (this) |
911 | { | 908 | { |
912 | 909 | if (TerrainUploader == null) | |
913 | TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); | ||
914 | lock (TerrainUploader) | ||
915 | { | 910 | { |
911 | m_log.DebugFormat("Starting to receive uploaded terrain"); | ||
912 | TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); | ||
916 | remote_client.OnXferReceive += TerrainUploader.XferReceive; | 913 | remote_client.OnXferReceive += TerrainUploader.XferReceive; |
917 | remote_client.OnAbortXfer += AbortTerrainXferHandler; | 914 | remote_client.OnAbortXfer += AbortTerrainXferHandler; |
918 | TerrainUploader.TerrainUploadDone += HandleTerrainApplication; | 915 | TerrainUploader.TerrainUploadDone += HandleTerrainApplication; |
916 | TerrainUploader.RequestStartXfer(remote_client); | ||
917 | } | ||
918 | else | ||
919 | { | ||
920 | remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); | ||
919 | } | 921 | } |
920 | TerrainUploader.RequestStartXfer(remote_client); | ||
921 | |||
922 | } | 922 | } |
923 | else | 923 | } |
924 | |||
925 | public bool IsTerrainXfer(ulong xferID) | ||
926 | { | ||
927 | lock (this) | ||
924 | { | 928 | { |
925 | remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); | 929 | if (TerrainUploader == null) |
930 | return false; | ||
931 | else | ||
932 | return TerrainUploader.XferID == xferID; | ||
926 | } | 933 | } |
927 | } | 934 | } |
928 | 935 | ||