CapabilitiesModule.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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 copyrightD
  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.Linq;
  31. using System.Reflection;
  32. using System.Text;
  33. using log4net;
  34. using Nini.Config;
  35. using Mono.Addins;
  36. using OpenMetaverse;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Console;
  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 Caps=OpenSim.Framework.Capabilities.Caps;
  44. namespace OpenSim.Region.CoreModules.Framework
  45. {
  46. [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CapabilitiesModule")]
  47. public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule
  48. {
  49. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  50. private string m_showCapsCommandFormat = " {0,-38} {1,-60}\n";
  51. protected Scene m_scene;
  52. /// <summary>
  53. /// Each agent has its own capabilities handler.
  54. /// </summary>
  55. protected Dictionary<uint, Caps> m_capsObjects = new Dictionary<uint, Caps>();
  56. protected Dictionary<UUID, string> m_capsPaths = new Dictionary<UUID, string>();
  57. protected Dictionary<UUID, Dictionary<ulong, string>> m_childrenSeeds
  58. = new Dictionary<UUID, Dictionary<ulong, string>>();
  59. public void Initialise(IConfigSource source)
  60. {
  61. }
  62. public void AddRegion(Scene scene)
  63. {
  64. m_scene = scene;
  65. m_scene.RegisterModuleInterface<ICapabilitiesModule>(this);
  66. MainConsole.Instance.Commands.AddCommand(
  67. "Comms", false, "show caps list",
  68. "show caps list",
  69. "Shows list of registered capabilities for users.", HandleShowCapsListCommand);
  70. MainConsole.Instance.Commands.AddCommand(
  71. "Comms", false, "show caps stats by user",
  72. "show caps stats by user [<first-name> <last-name>]",
  73. "Shows statistics on capabilities use by user.",
  74. "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.",
  75. HandleShowCapsStatsByUserCommand);
  76. MainConsole.Instance.Commands.AddCommand(
  77. "Comms", false, "show caps stats by cap",
  78. "show caps stats by cap [<cap-name>]",
  79. "Shows statistics on capabilities use by capability.",
  80. "If a capability name is given, then prints a detailed breakdown of use by each user.",
  81. HandleShowCapsStatsByCapCommand);
  82. }
  83. public void RegionLoaded(Scene scene)
  84. {
  85. }
  86. public void RemoveRegion(Scene scene)
  87. {
  88. m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
  89. }
  90. public void PostInitialise()
  91. {
  92. }
  93. public void Close() {}
  94. public string Name
  95. {
  96. get { return "Capabilities Module"; }
  97. }
  98. public Type ReplaceableInterface
  99. {
  100. get { return null; }
  101. }
  102. public void CreateCaps(UUID agentId, uint circuitCode)
  103. {
  104. int ts = Util.EnvironmentTickCount();
  105. /* this as no business here...
  106. * must be done elsewhere ( and is )
  107. int flags = m_scene.GetUserFlags(agentId);
  108. m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts));
  109. if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags))
  110. return;
  111. */
  112. Caps caps;
  113. String capsObjectPath = GetCapsPath(agentId);
  114. lock (m_capsObjects)
  115. {
  116. if (m_capsObjects.ContainsKey(circuitCode))
  117. {
  118. Caps oldCaps = m_capsObjects[circuitCode];
  119. if (capsObjectPath == oldCaps.CapsObjectPath)
  120. {
  121. // m_log.WarnFormat(
  122. // "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
  123. // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
  124. return;
  125. }
  126. else
  127. {
  128. // not reusing add extra melanie cleanup
  129. // Remove tge handlers. They may conflict with the
  130. // new object created below
  131. oldCaps.DeregisterHandlers();
  132. // Better safe ... should not be needed but also
  133. // no big deal
  134. m_capsObjects.Remove(circuitCode);
  135. }
  136. }
  137. // m_log.DebugFormat(
  138. // "[CAPS]: Adding capabilities for agent {0} in {1} with path {2}",
  139. // agentId, m_scene.RegionInfo.RegionName, capsObjectPath);
  140. caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
  141. (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
  142. capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
  143. m_log.DebugFormat("[CreateCaps]: new caps agent {0}, circuit {1}, path {2}, time {3} ",agentId,
  144. circuitCode,caps.CapsObjectPath, Util.EnvironmentTickCountSubtract(ts));
  145. m_capsObjects[circuitCode] = caps;
  146. }
  147. m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
  148. // m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts));
  149. }
  150. public void RemoveCaps(UUID agentId, uint circuitCode)
  151. {
  152. m_log.DebugFormat("[CAPS]: Remove caps for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName);
  153. lock (m_childrenSeeds)
  154. {
  155. if (m_childrenSeeds.ContainsKey(agentId))
  156. {
  157. m_childrenSeeds.Remove(agentId);
  158. }
  159. }
  160. lock (m_capsObjects)
  161. {
  162. if (m_capsObjects.TryGetValue(circuitCode, out Caps cp))
  163. {
  164. m_scene.EventManager.TriggerOnDeregisterCaps(agentId, cp);
  165. m_capsObjects.Remove(circuitCode);
  166. cp.Dispose();
  167. }
  168. else
  169. {
  170. foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
  171. {
  172. if (kvp.Value.AgentID == agentId)
  173. {
  174. m_scene.EventManager.TriggerOnDeregisterCaps(agentId, kvp.Value);
  175. m_capsObjects.Remove(kvp.Key);
  176. kvp.Value.Dispose();
  177. return;
  178. }
  179. }
  180. m_log.WarnFormat(
  181. "[CAPS]: Received request to remove CAPS handler for root agent {0} in {1}, but no such CAPS handler found!",
  182. agentId, m_scene.RegionInfo.RegionName);
  183. }
  184. }
  185. }
  186. public Caps GetCapsForUser(uint circuitCode)
  187. {
  188. lock (m_capsObjects)
  189. {
  190. if (m_capsObjects.ContainsKey(circuitCode))
  191. {
  192. return m_capsObjects[circuitCode];
  193. }
  194. }
  195. return null;
  196. }
  197. public void ActivateCaps(uint circuitCode)
  198. {
  199. lock (m_capsObjects)
  200. {
  201. if (m_capsObjects.ContainsKey(circuitCode))
  202. {
  203. m_capsObjects[circuitCode].Activate();
  204. }
  205. }
  206. }
  207. public void SetAgentCapsSeeds(AgentCircuitData agent)
  208. {
  209. lock (m_capsPaths)
  210. m_capsPaths[agent.AgentID] = agent.CapsPath;
  211. lock (m_childrenSeeds)
  212. m_childrenSeeds[agent.AgentID]
  213. = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
  214. }
  215. public string GetCapsPath(UUID agentId)
  216. {
  217. lock (m_capsPaths)
  218. {
  219. if (m_capsPaths.ContainsKey(agentId))
  220. {
  221. return m_capsPaths[agentId];
  222. }
  223. }
  224. return null;
  225. }
  226. public Dictionary<ulong, string> GetChildrenSeeds(UUID agentID)
  227. {
  228. Dictionary<ulong, string> seeds = null;
  229. lock (m_childrenSeeds)
  230. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  231. return seeds;
  232. return new Dictionary<ulong, string>();
  233. }
  234. public void DropChildSeed(UUID agentID, ulong handle)
  235. {
  236. Dictionary<ulong, string> seeds;
  237. lock (m_childrenSeeds)
  238. {
  239. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  240. {
  241. seeds.Remove(handle);
  242. }
  243. }
  244. }
  245. public string GetChildSeed(UUID agentID, ulong handle)
  246. {
  247. Dictionary<ulong, string> seeds;
  248. string returnval;
  249. lock (m_childrenSeeds)
  250. {
  251. if (m_childrenSeeds.TryGetValue(agentID, out seeds))
  252. {
  253. if (seeds.TryGetValue(handle, out returnval))
  254. return returnval;
  255. }
  256. }
  257. return null;
  258. }
  259. public void SetChildrenSeed(UUID agentID, Dictionary<ulong, string> seeds)
  260. {
  261. //m_log.DebugFormat(" !!! Setting child seeds in {0} to {1}", m_scene.RegionInfo.RegionName, seeds.Count);
  262. lock (m_childrenSeeds)
  263. m_childrenSeeds[agentID] = seeds;
  264. }
  265. public void DumpChildrenSeeds(UUID agentID)
  266. {
  267. m_log.Info("================ ChildrenSeed "+m_scene.RegionInfo.RegionName+" ================");
  268. lock (m_childrenSeeds)
  269. {
  270. foreach (KeyValuePair<ulong, string> kvp in m_childrenSeeds[agentID])
  271. {
  272. uint x, y;
  273. Util.RegionHandleToRegionLoc(kvp.Key, out x, out y);
  274. m_log.Info(" >> "+x+", "+y+": "+kvp.Value);
  275. }
  276. }
  277. }
  278. private void HandleShowCapsListCommand(string module, string[] cmdParams)
  279. {
  280. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  281. return;
  282. StringBuilder capsReport = new StringBuilder();
  283. capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
  284. lock (m_capsObjects)
  285. {
  286. foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects)
  287. {
  288. Caps caps = kvp.Value;
  289. string name = string.Empty;
  290. if(m_scene.TryGetScenePresence(caps.AgentID, out ScenePresence sp) && sp!=null)
  291. name = sp.Name;
  292. capsReport.AppendFormat("** Circuit {0}; {1} {2}:\n", kvp.Key, caps.AgentID,name);
  293. for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); )
  294. {
  295. Uri uri = new Uri(kvp2.Value.ToString());
  296. capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery);
  297. }
  298. foreach (KeyValuePair<string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers())
  299. capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url);
  300. foreach (KeyValuePair<string, string> kvp3 in caps.ExternalCapsHandlers)
  301. capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value);
  302. }
  303. }
  304. MainConsole.Instance.Output(capsReport.ToString());
  305. }
  306. private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams)
  307. {
  308. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  309. return;
  310. if (cmdParams.Length != 5 && cmdParams.Length != 6)
  311. {
  312. MainConsole.Instance.Output("Usage: show caps stats by cap [<cap-name>]");
  313. return;
  314. }
  315. StringBuilder sb = new StringBuilder();
  316. sb.AppendFormat("Region {0}:\n", m_scene.Name);
  317. if (cmdParams.Length == 5)
  318. {
  319. BuildSummaryStatsByCapReport(sb);
  320. }
  321. else if (cmdParams.Length == 6)
  322. {
  323. BuildDetailedStatsByCapReport(sb, cmdParams[5]);
  324. }
  325. MainConsole.Instance.Output(sb.ToString());
  326. }
  327. private void BuildDetailedStatsByCapReport(StringBuilder sb, string capName)
  328. {
  329. /*
  330. sb.AppendFormat("Capability name {0}\n", capName);
  331. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  332. cdt.AddColumn("User Name", 34);
  333. cdt.AddColumn("Req Received", 12);
  334. cdt.AddColumn("Req Handled", 12);
  335. cdt.Indent = 2;
  336. Dictionary<string, int> receivedStats = new Dictionary<string, int>();
  337. Dictionary<string, int> handledStats = new Dictionary<string, int>();
  338. m_scene.ForEachScenePresence(
  339. sp =>
  340. {
  341. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  342. if (caps == null)
  343. return;
  344. Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
  345. IRequestHandler reqHandler;
  346. if (capsHandlers.TryGetValue(capName, out reqHandler))
  347. {
  348. receivedStats[sp.Name] = reqHandler.RequestsReceived;
  349. handledStats[sp.Name] = reqHandler.RequestsHandled;
  350. }
  351. else
  352. {
  353. PollServiceEventArgs pollHandler = null;
  354. if (caps.TryGetPollHandler(capName, out pollHandler))
  355. {
  356. receivedStats[sp.Name] = pollHandler.RequestsReceived;
  357. handledStats[sp.Name] = pollHandler.RequestsHandled;
  358. }
  359. }
  360. }
  361. );
  362. foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
  363. {
  364. cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
  365. }
  366. sb.Append(cdt.ToString());
  367. */
  368. }
  369. private void BuildSummaryStatsByCapReport(StringBuilder sb)
  370. {
  371. /*
  372. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  373. cdt.AddColumn("Name", 34);
  374. cdt.AddColumn("Req Received", 12);
  375. cdt.AddColumn("Req Handled", 12);
  376. cdt.Indent = 2;
  377. Dictionary<string, int> receivedStats = new Dictionary<string, int>();
  378. Dictionary<string, int> handledStats = new Dictionary<string, int>();
  379. m_scene.ForEachScenePresence(
  380. sp =>
  381. {
  382. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  383. if (caps == null)
  384. return;
  385. foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
  386. {
  387. string reqName = reqHandler.Name ?? "";
  388. if (!receivedStats.ContainsKey(reqName))
  389. {
  390. receivedStats[reqName] = reqHandler.RequestsReceived;
  391. handledStats[reqName] = reqHandler.RequestsHandled;
  392. }
  393. else
  394. {
  395. receivedStats[reqName] += reqHandler.RequestsReceived;
  396. handledStats[reqName] += reqHandler.RequestsHandled;
  397. }
  398. }
  399. foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
  400. {
  401. string name = kvp.Key;
  402. PollServiceEventArgs pollHandler = kvp.Value;
  403. if (!receivedStats.ContainsKey(name))
  404. {
  405. receivedStats[name] = pollHandler.RequestsReceived;
  406. handledStats[name] = pollHandler.RequestsHandled;
  407. }
  408. else
  409. {
  410. receivedStats[name] += pollHandler.RequestsReceived;
  411. handledStats[name] += pollHandler.RequestsHandled;
  412. }
  413. }
  414. }
  415. );
  416. foreach (KeyValuePair<string, int> kvp in receivedStats.OrderByDescending(kp => kp.Value))
  417. cdt.AddRow(kvp.Key, kvp.Value, handledStats[kvp.Key]);
  418. sb.Append(cdt.ToString());
  419. */
  420. }
  421. private void HandleShowCapsStatsByUserCommand(string module, string[] cmdParams)
  422. {
  423. /*
  424. if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
  425. return;
  426. if (cmdParams.Length != 5 && cmdParams.Length != 7)
  427. {
  428. MainConsole.Instance.Output("Usage: show caps stats by user [<first-name> <last-name>]");
  429. return;
  430. }
  431. StringBuilder sb = new StringBuilder();
  432. sb.AppendFormat("Region {0}:\n", m_scene.Name);
  433. if (cmdParams.Length == 5)
  434. {
  435. BuildSummaryStatsByUserReport(sb);
  436. }
  437. else if (cmdParams.Length == 7)
  438. {
  439. string firstName = cmdParams[5];
  440. string lastName = cmdParams[6];
  441. ScenePresence sp = m_scene.GetScenePresence(firstName, lastName);
  442. if (sp == null)
  443. return;
  444. BuildDetailedStatsByUserReport(sb, sp);
  445. }
  446. MainConsole.Instance.Output(sb.ToString());
  447. */
  448. }
  449. private void BuildDetailedStatsByUserReport(StringBuilder sb, ScenePresence sp)
  450. {
  451. /*
  452. sb.AppendFormat("Avatar name {0}, type {1}\n", sp.Name, sp.IsChildAgent ? "child" : "root");
  453. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  454. cdt.AddColumn("Cap Name", 34);
  455. cdt.AddColumn("Req Received", 12);
  456. cdt.AddColumn("Req Handled", 12);
  457. cdt.Indent = 2;
  458. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  459. if (caps == null)
  460. return;
  461. List<CapTableRow> capRows = new List<CapTableRow>();
  462. foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values)
  463. capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled));
  464. foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers())
  465. capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled));
  466. foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived))
  467. cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled);
  468. sb.Append(cdt.ToString());
  469. */
  470. }
  471. private void BuildSummaryStatsByUserReport(StringBuilder sb)
  472. {
  473. /*
  474. ConsoleDisplayTable cdt = new ConsoleDisplayTable();
  475. cdt.AddColumn("Name", 32);
  476. cdt.AddColumn("Type", 5);
  477. cdt.AddColumn("Req Received", 12);
  478. cdt.AddColumn("Req Handled", 12);
  479. cdt.Indent = 2;
  480. m_scene.ForEachScenePresence(
  481. sp =>
  482. {
  483. Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID);
  484. if (caps == null)
  485. return;
  486. Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers();
  487. int totalRequestsReceived = 0;
  488. int totalRequestsHandled = 0;
  489. foreach (IRequestHandler reqHandler in capsHandlers.Values)
  490. {
  491. totalRequestsReceived += reqHandler.RequestsReceived;
  492. totalRequestsHandled += reqHandler.RequestsHandled;
  493. }
  494. Dictionary<string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers();
  495. foreach (PollServiceEventArgs handler in capsPollHandlers.Values)
  496. {
  497. totalRequestsReceived += handler.RequestsReceived;
  498. totalRequestsHandled += handler.RequestsHandled;
  499. }
  500. cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled);
  501. }
  502. );
  503. sb.Append(cdt.ToString());
  504. */
  505. }
  506. private class CapTableRow
  507. {
  508. public string Name { get; set; }
  509. public int RequestsReceived { get; set; }
  510. public int RequestsHandled { get; set; }
  511. public CapTableRow(string name, int requestsReceived, int requestsHandled)
  512. {
  513. Name = name;
  514. RequestsReceived = requestsReceived;
  515. RequestsHandled = requestsHandled;
  516. }
  517. }
  518. }
  519. }