XMLRPCModule.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections;
  29. using System.Collections.Generic;
  30. using System.Net;
  31. using System.Reflection;
  32. using System.Threading;
  33. using log4net;
  34. using Nini.Config;
  35. using Nwc.XmlRpc;
  36. using OpenMetaverse;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Monitoring;
  39. using OpenSim.Framework.Servers;
  40. using OpenSim.Framework.Servers.HttpServer;
  41. using OpenSim.Region.Framework.Interfaces;
  42. using OpenSim.Region.Framework.Scenes;
  43. using Mono.Addins;
  44. /*****************************************************
  45. *
  46. * XMLRPCModule
  47. *
  48. * Module for accepting incoming communications from
  49. * external XMLRPC client and calling a remote data
  50. * procedure for a registered data channel/prim.
  51. *
  52. *
  53. * 1. On module load, open a listener port
  54. * 2. Attach an XMLRPC handler
  55. * 3. When a request is received:
  56. * 3.1 Parse into components: channel key, int, string
  57. * 3.2 Look up registered channel listeners
  58. * 3.3 Call the channel (prim) remote data method
  59. * 3.4 Capture the response (llRemoteDataReply)
  60. * 3.5 Return response to client caller
  61. * 3.6 If no response from llRemoteDataReply within
  62. * RemoteReplyScriptTimeout, generate script timeout fault
  63. *
  64. * Prims in script must:
  65. * 1. Open a remote data channel
  66. * 1.1 Generate a channel ID
  67. * 1.2 Register primid,channelid pair with module
  68. * 2. Implement the remote data procedure handler
  69. *
  70. * llOpenRemoteDataChannel
  71. * llRemoteDataReply
  72. * remote_data(integer type, key channel, key messageid, string sender, integer ival, string sval)
  73. * llCloseRemoteDataChannel
  74. *
  75. * **************************************************/
  76. namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
  77. {
  78. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")]
  79. public class XMLRPCModule : ISharedRegionModule, IXMLRPC
  80. {
  81. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  82. private string m_name = "XMLRPCModule";
  83. // <channel id, RPCChannelInfo>
  84. private Dictionary<UUID, RPCChannelInfo> m_openChannels;
  85. private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses;
  86. private int m_remoteDataPort = 0;
  87. public int Port
  88. {
  89. get { return m_remoteDataPort; }
  90. }
  91. private Dictionary<UUID, RPCRequestInfo> m_rpcPending;
  92. private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses;
  93. private List<Scene> m_scenes = new List<Scene>();
  94. private int RemoteReplyScriptTimeout = 9000;
  95. private int RemoteReplyScriptWait = 300;
  96. private object XMLRPCListLock = new object();
  97. #region ISharedRegionModule Members
  98. public void Initialise(IConfigSource config)
  99. {
  100. // We need to create these early because the scripts might be calling
  101. // But since this gets called for every region, we need to make sure they
  102. // get called only one time (or we lose any open channels)
  103. m_openChannels = new Dictionary<UUID, RPCChannelInfo>();
  104. m_rpcPending = new Dictionary<UUID, RPCRequestInfo>();
  105. m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>();
  106. m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>();
  107. if (config.Configs["XMLRPC"] != null)
  108. {
  109. try
  110. {
  111. m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort);
  112. }
  113. catch (Exception)
  114. {
  115. }
  116. }
  117. }
  118. public void PostInitialise()
  119. {
  120. if (IsEnabled())
  121. {
  122. // Start http server
  123. // Attach xmlrpc handlers
  124. // m_log.InfoFormat(
  125. // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.",
  126. // m_remoteDataPort);
  127. IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort);
  128. httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
  129. }
  130. }
  131. public void AddRegion(Scene scene)
  132. {
  133. if (!IsEnabled())
  134. return;
  135. if (!m_scenes.Contains(scene))
  136. {
  137. m_scenes.Add(scene);
  138. scene.RegisterModuleInterface<IXMLRPC>(this);
  139. }
  140. }
  141. public void RegionLoaded(Scene scene)
  142. {
  143. }
  144. public void RemoveRegion(Scene scene)
  145. {
  146. if (!IsEnabled())
  147. return;
  148. if (m_scenes.Contains(scene))
  149. {
  150. scene.UnregisterModuleInterface<IXMLRPC>(this);
  151. m_scenes.Remove(scene);
  152. }
  153. }
  154. public void Close()
  155. {
  156. }
  157. public string Name
  158. {
  159. get { return m_name; }
  160. }
  161. public Type ReplaceableInterface
  162. {
  163. get { return null; }
  164. }
  165. #endregion
  166. #region IXMLRPC Members
  167. public bool IsEnabled()
  168. {
  169. return (m_remoteDataPort > 0);
  170. }
  171. /**********************************************
  172. * OpenXMLRPCChannel
  173. *
  174. * Generate a UUID channel key and add it and
  175. * the prim id to dictionary <channelUUID, primUUID>
  176. *
  177. * A custom channel key can be proposed.
  178. * Otherwise, passing UUID.Zero will generate
  179. * and return a random channel
  180. *
  181. * First check if there is a channel assigned for
  182. * this itemID. If there is, then someone called
  183. * llOpenRemoteDataChannel twice. Just return the
  184. * original channel. Other option is to delete the
  185. * current channel and assign a new one.
  186. *
  187. * ********************************************/
  188. public UUID OpenXMLRPCChannel(uint localID, UUID itemID, UUID channelID)
  189. {
  190. UUID newChannel = UUID.Zero;
  191. // This should no longer happen, but the check is reasonable anyway
  192. if (null == m_openChannels)
  193. {
  194. m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
  195. return newChannel;
  196. }
  197. //Is a dupe?
  198. foreach (RPCChannelInfo ci in m_openChannels.Values)
  199. {
  200. if (ci.GetItemID().Equals(itemID))
  201. {
  202. // return the original channel ID for this item
  203. newChannel = ci.GetChannelID();
  204. break;
  205. }
  206. }
  207. if (newChannel == UUID.Zero)
  208. {
  209. newChannel = (channelID == UUID.Zero) ? UUID.Random() : channelID;
  210. RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);
  211. lock (XMLRPCListLock)
  212. {
  213. m_openChannels.Add(newChannel, rpcChanInfo);
  214. }
  215. }
  216. return newChannel;
  217. }
  218. // Delete channels based on itemID
  219. // for when a script is deleted
  220. public void DeleteChannels(UUID itemID)
  221. {
  222. if (m_openChannels != null)
  223. {
  224. ArrayList tmp = new ArrayList();
  225. lock (XMLRPCListLock)
  226. {
  227. foreach (RPCChannelInfo li in m_openChannels.Values)
  228. {
  229. if (li.GetItemID().Equals(itemID))
  230. {
  231. tmp.Add(itemID);
  232. }
  233. }
  234. IEnumerator tmpEnumerator = tmp.GetEnumerator();
  235. while (tmpEnumerator.MoveNext())
  236. m_openChannels.Remove((UUID) tmpEnumerator.Current);
  237. }
  238. }
  239. }
  240. /**********************************************
  241. * Remote Data Reply
  242. *
  243. * Response to RPC message
  244. *
  245. *********************************************/
  246. public void RemoteDataReply(string channel, string message_id, string sdata, int idata)
  247. {
  248. UUID message_key = new UUID(message_id);
  249. UUID channel_key = new UUID(channel);
  250. RPCRequestInfo rpcInfo = null;
  251. if (message_key == UUID.Zero)
  252. {
  253. foreach (RPCRequestInfo oneRpcInfo in m_rpcPendingResponses.Values)
  254. if (oneRpcInfo.GetChannelKey() == channel_key)
  255. rpcInfo = oneRpcInfo;
  256. }
  257. else
  258. {
  259. m_rpcPendingResponses.TryGetValue(message_key, out rpcInfo);
  260. }
  261. if (rpcInfo != null)
  262. {
  263. rpcInfo.SetStrRetval(sdata);
  264. rpcInfo.SetIntRetval(idata);
  265. rpcInfo.SetProcessed(true);
  266. m_rpcPendingResponses.Remove(message_key);
  267. }
  268. else
  269. {
  270. m_log.Warn("[XML RPC MODULE]: Channel or message_id not found");
  271. }
  272. }
  273. /**********************************************
  274. * CloseXMLRPCChannel
  275. *
  276. * Remove channel from dictionary
  277. *
  278. *********************************************/
  279. public void CloseXMLRPCChannel(UUID channelKey)
  280. {
  281. if (m_openChannels.ContainsKey(channelKey))
  282. m_openChannels.Remove(channelKey);
  283. }
  284. public bool hasRequests()
  285. {
  286. lock (XMLRPCListLock)
  287. {
  288. if (m_rpcPending != null)
  289. return (m_rpcPending.Count > 0);
  290. else
  291. return false;
  292. }
  293. }
  294. public IXmlRpcRequestInfo GetNextCompletedRequest()
  295. {
  296. if (m_rpcPending != null)
  297. {
  298. lock (XMLRPCListLock)
  299. {
  300. foreach (UUID luid in m_rpcPending.Keys)
  301. {
  302. RPCRequestInfo tmpReq;
  303. if (m_rpcPending.TryGetValue(luid, out tmpReq))
  304. {
  305. if (!tmpReq.IsProcessed()) return tmpReq;
  306. }
  307. }
  308. }
  309. }
  310. return null;
  311. }
  312. public void RemoveCompletedRequest(UUID id)
  313. {
  314. lock (XMLRPCListLock)
  315. {
  316. RPCRequestInfo tmp;
  317. if (m_rpcPending.TryGetValue(id, out tmp))
  318. {
  319. m_rpcPending.Remove(id);
  320. m_rpcPendingResponses.Add(id, tmp);
  321. }
  322. else
  323. {
  324. m_log.Error("[XML RPC MODULE]: UNABLE TO REMOVE COMPLETED REQUEST");
  325. }
  326. }
  327. }
  328. public UUID SendRemoteData(uint localID, UUID itemID, string channel, string dest, int idata, string sdata)
  329. {
  330. SendRemoteDataRequest req = new SendRemoteDataRequest(
  331. localID, itemID, channel, dest, idata, sdata
  332. );
  333. m_pendingSRDResponses.Add(req.GetReqID(), req);
  334. req.Process();
  335. return req.ReqID;
  336. }
  337. public IServiceRequest GetNextCompletedSRDRequest()
  338. {
  339. if (m_pendingSRDResponses != null)
  340. {
  341. lock (XMLRPCListLock)
  342. {
  343. foreach (UUID luid in m_pendingSRDResponses.Keys)
  344. {
  345. SendRemoteDataRequest tmpReq;
  346. if (m_pendingSRDResponses.TryGetValue(luid, out tmpReq))
  347. {
  348. if (tmpReq.Finished)
  349. return tmpReq;
  350. }
  351. }
  352. }
  353. }
  354. return null;
  355. }
  356. public void RemoveCompletedSRDRequest(UUID id)
  357. {
  358. lock (XMLRPCListLock)
  359. {
  360. SendRemoteDataRequest tmpReq;
  361. if (m_pendingSRDResponses.TryGetValue(id, out tmpReq))
  362. {
  363. m_pendingSRDResponses.Remove(id);
  364. }
  365. }
  366. }
  367. public void CancelSRDRequests(UUID itemID)
  368. {
  369. if (m_pendingSRDResponses != null)
  370. {
  371. lock (XMLRPCListLock)
  372. {
  373. foreach (SendRemoteDataRequest li in m_pendingSRDResponses.Values)
  374. {
  375. if (li.ItemID.Equals(itemID))
  376. m_pendingSRDResponses.Remove(li.GetReqID());
  377. }
  378. }
  379. }
  380. }
  381. #endregion
  382. public XmlRpcResponse XmlRpcRemoteData(XmlRpcRequest request, IPEndPoint remoteClient)
  383. {
  384. XmlRpcResponse response = new XmlRpcResponse();
  385. Hashtable requestData = (Hashtable) request.Params[0];
  386. bool GoodXML = (requestData.Contains("Channel") && requestData.Contains("IntValue") &&
  387. requestData.Contains("StringValue"));
  388. if (GoodXML)
  389. {
  390. UUID channel = new UUID((string) requestData["Channel"]);
  391. RPCChannelInfo rpcChanInfo;
  392. if (m_openChannels.TryGetValue(channel, out rpcChanInfo))
  393. {
  394. string intVal = Convert.ToInt32(requestData["IntValue"]).ToString();
  395. string strVal = (string) requestData["StringValue"];
  396. RPCRequestInfo rpcInfo;
  397. lock (XMLRPCListLock)
  398. {
  399. rpcInfo =
  400. new RPCRequestInfo(rpcChanInfo.GetLocalID(), rpcChanInfo.GetItemID(), channel, strVal,
  401. intVal);
  402. m_rpcPending.Add(rpcInfo.GetMessageID(), rpcInfo);
  403. }
  404. int timeoutCtr = 0;
  405. while (!rpcInfo.IsProcessed() && (timeoutCtr < RemoteReplyScriptTimeout))
  406. {
  407. Thread.Sleep(RemoteReplyScriptWait);
  408. timeoutCtr += RemoteReplyScriptWait;
  409. }
  410. if (rpcInfo.IsProcessed())
  411. {
  412. Hashtable param = new Hashtable();
  413. param["StringValue"] = rpcInfo.GetStrRetval();
  414. param["IntValue"] = rpcInfo.GetIntRetval();
  415. ArrayList parameters = new ArrayList();
  416. parameters.Add(param);
  417. response.Value = parameters;
  418. rpcInfo = null;
  419. }
  420. else
  421. {
  422. response.SetFault(-1, "Script timeout");
  423. rpcInfo = null;
  424. }
  425. }
  426. else
  427. {
  428. response.SetFault(-1, "Invalid channel");
  429. }
  430. }
  431. return response;
  432. }
  433. }
  434. public class RPCRequestInfo: IXmlRpcRequestInfo
  435. {
  436. private UUID m_ChannelKey;
  437. private string m_IntVal;
  438. private UUID m_ItemID;
  439. private uint m_localID;
  440. private UUID m_MessageID;
  441. private bool m_processed;
  442. private int m_respInt;
  443. private string m_respStr;
  444. private string m_StrVal;
  445. public RPCRequestInfo(uint localID, UUID itemID, UUID channelKey, string strVal, string intVal)
  446. {
  447. m_localID = localID;
  448. m_StrVal = strVal;
  449. m_IntVal = intVal;
  450. m_ItemID = itemID;
  451. m_ChannelKey = channelKey;
  452. m_MessageID = UUID.Random();
  453. m_processed = false;
  454. m_respStr = String.Empty;
  455. m_respInt = 0;
  456. }
  457. public bool IsProcessed()
  458. {
  459. return m_processed;
  460. }
  461. public UUID GetChannelKey()
  462. {
  463. return m_ChannelKey;
  464. }
  465. public void SetProcessed(bool processed)
  466. {
  467. m_processed = processed;
  468. }
  469. public void SetStrRetval(string resp)
  470. {
  471. m_respStr = resp;
  472. }
  473. public string GetStrRetval()
  474. {
  475. return m_respStr;
  476. }
  477. public void SetIntRetval(int resp)
  478. {
  479. m_respInt = resp;
  480. }
  481. public int GetIntRetval()
  482. {
  483. return m_respInt;
  484. }
  485. public uint GetLocalID()
  486. {
  487. return m_localID;
  488. }
  489. public UUID GetItemID()
  490. {
  491. return m_ItemID;
  492. }
  493. public string GetStrVal()
  494. {
  495. return m_StrVal;
  496. }
  497. public int GetIntValue()
  498. {
  499. return int.Parse(m_IntVal);
  500. }
  501. public UUID GetMessageID()
  502. {
  503. return m_MessageID;
  504. }
  505. }
  506. public class RPCChannelInfo
  507. {
  508. private UUID m_ChannelKey;
  509. private UUID m_itemID;
  510. private uint m_localID;
  511. public RPCChannelInfo(uint localID, UUID itemID, UUID channelID)
  512. {
  513. m_ChannelKey = channelID;
  514. m_localID = localID;
  515. m_itemID = itemID;
  516. }
  517. public UUID GetItemID()
  518. {
  519. return m_itemID;
  520. }
  521. public UUID GetChannelID()
  522. {
  523. return m_ChannelKey;
  524. }
  525. public uint GetLocalID()
  526. {
  527. return m_localID;
  528. }
  529. }
  530. public class SendRemoteDataRequest: IServiceRequest
  531. {
  532. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  533. public string Channel;
  534. public string DestURL;
  535. private bool _finished;
  536. public bool Finished
  537. {
  538. get { return _finished; }
  539. set { _finished = value; }
  540. }
  541. private Thread httpThread;
  542. public int Idata;
  543. private UUID _itemID;
  544. public UUID ItemID
  545. {
  546. get { return _itemID; }
  547. set { _itemID = value; }
  548. }
  549. private uint _localID;
  550. public uint LocalID
  551. {
  552. get { return _localID; }
  553. set { _localID = value; }
  554. }
  555. private UUID _reqID;
  556. public UUID ReqID
  557. {
  558. get { return _reqID; }
  559. set { _reqID = value; }
  560. }
  561. public XmlRpcRequest Request;
  562. public int ResponseIdata;
  563. public string ResponseSdata;
  564. public string Sdata;
  565. public SendRemoteDataRequest(uint localID, UUID itemID, string channel, string dest, int idata, string sdata)
  566. {
  567. this.Channel = channel;
  568. DestURL = dest;
  569. this.Idata = idata;
  570. this.Sdata = sdata;
  571. ItemID = itemID;
  572. LocalID = localID;
  573. ReqID = UUID.Random();
  574. }
  575. public void Process()
  576. {
  577. _finished = false;
  578. httpThread = WorkManager.StartThread(SendRequest, "XMLRPCreqThread", ThreadPriority.Normal, true, false, null, int.MaxValue);
  579. }
  580. /*
  581. * TODO: More work on the response codes. Right now
  582. * returning 200 for success or 499 for exception
  583. */
  584. public void SendRequest()
  585. {
  586. Hashtable param = new Hashtable();
  587. // Check if channel is an UUID
  588. // if not, use as method name
  589. UUID parseUID;
  590. string mName = "llRemoteData";
  591. if (!string.IsNullOrEmpty(Channel))
  592. if (!UUID.TryParse(Channel, out parseUID))
  593. mName = Channel;
  594. else
  595. param["Channel"] = Channel;
  596. param["StringValue"] = Sdata;
  597. param["IntValue"] = Convert.ToString(Idata);
  598. ArrayList parameters = new ArrayList();
  599. parameters.Add(param);
  600. XmlRpcRequest req = new XmlRpcRequest(mName, parameters);
  601. try
  602. {
  603. XmlRpcResponse resp = req.Send(DestURL, 30000);
  604. if (resp != null)
  605. {
  606. Hashtable respParms;
  607. if (resp.Value.GetType().Equals(typeof(Hashtable)))
  608. {
  609. respParms = (Hashtable) resp.Value;
  610. }
  611. else
  612. {
  613. ArrayList respData = (ArrayList) resp.Value;
  614. respParms = (Hashtable) respData[0];
  615. }
  616. if (respParms != null)
  617. {
  618. if (respParms.Contains("StringValue"))
  619. {
  620. Sdata = (string) respParms["StringValue"];
  621. }
  622. if (respParms.Contains("IntValue"))
  623. {
  624. Idata = Convert.ToInt32(respParms["IntValue"]);
  625. }
  626. if (respParms.Contains("faultString"))
  627. {
  628. Sdata = (string) respParms["faultString"];
  629. }
  630. if (respParms.Contains("faultCode"))
  631. {
  632. Idata = Convert.ToInt32(respParms["faultCode"]);
  633. }
  634. }
  635. }
  636. }
  637. catch (Exception we)
  638. {
  639. Sdata = we.Message;
  640. m_log.Warn("[SendRemoteDataRequest]: Request failed");
  641. m_log.Warn(we.StackTrace);
  642. }
  643. finally
  644. {
  645. _finished = true;
  646. httpThread = null;
  647. Watchdog.RemoveThread();
  648. }
  649. }
  650. public void Stop()
  651. {
  652. try
  653. {
  654. if (httpThread != null)
  655. {
  656. Watchdog.AbortThread(httpThread.ManagedThreadId);
  657. httpThread = null;
  658. }
  659. }
  660. catch (Exception)
  661. {
  662. }
  663. }
  664. public UUID GetReqID()
  665. {
  666. return ReqID;
  667. }
  668. }
  669. }