Changeset 4643
- Timestamp:
- 02/19/08 23:02:26 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/nuxleus/Source/Nuxleus.Web/HttpApplication/Global.cs
r4641 r4643 49 49 AmazonSimpleDBClient m_amazonSimpleDBClient; 50 50 PledgeCount m_pledgeCount; 51 Queue<string> m_pledgeQueue; 51 52 static HashAlgorithm m_hashAlgorithm = HashAlgorithm.MD5; 52 53 … … 75 76 m_encoding = new UTF8Encoding(); 76 77 m_pledgeCount = new PledgeCount(0, 0); 78 m_pledgeQueue = new Queue<string>(); 77 79 78 80 string sdbAccessKey = String.Empty; … … 161 163 Application["as_simpledbclient"] = m_amazonSimpleDBClient; 162 164 Application["as_pledgeCount"] = m_pledgeCount; 165 Application["as_pledgeQueue"] = m_pledgeQueue; 163 166 } 164 167 … … 177 180 Application["simpledbclient"] = Application["as_simpledbclient"]; 178 181 Application["pledgeCount"] = Application["as_pledgeCount"]; 182 Application["pledgeQueue"] = Application["as_pledgeQueue"]; 179 183 } 180 184 trunk/nuxleus/Source/Nuxleus.Web/HttpHandler/NuxleusHttpAsyncFormHandler.cs
r4642 r4643 14 14 using Nuxleus.Agent; 15 15 using Nuxleus.Web.HttpApplication; 16 using System.Collections.Generic; 16 17 17 18 namespace Nuxleus.Web.HttpHandler { … … 56 57 m_pledgeCount = (PledgeCount)context.Application["pledgeCount"]; 57 58 59 Queue<string> pledgeQueue = (Queue<string>)context.Application["pledgeQueue"]; 60 61 58 62 m_putAttributes = new PutAttributes(); 59 63 m_putAttributes.DomainName = "4lessig-dev"; … … 67 71 ); 68 72 69 if (location == "ca12thdistrict") { 70 lock (m_lock) { 71 m_pledgeCount.PledgeCountDistrict = m_pledgeCount.PledgeCountDistrict + 1; 72 m_pledgeCount.PledgeCountTotal = m_pledgeCount.PledgeCountTotal + 1; 73 } 74 } else { 75 lock (m_lock) { 76 m_pledgeCount.PledgeCountTotal = m_pledgeCount.PledgeCountTotal + 1; 77 } 78 } 73 pledgeQueue.Enqueue(location); 74 75 //if (location == "ca12thdistrict") { 76 // lock (m_lock) { 77 // m_pledgeCount.PledgeCountDistrict = m_pledgeCount.PledgeCountDistrict + 1; 78 // m_pledgeCount.PledgeCountTotal = m_pledgeCount.PledgeCountTotal + 1; 79 // } 80 //} else { 81 // lock (m_lock) { 82 // m_pledgeCount.PledgeCountTotal = m_pledgeCount.PledgeCountTotal + 1; 83 // } 84 //} 79 85 80 86 Console.WriteLine("District Count: {0}, Total Count: {1}", m_pledgeCount.PledgeCountDistrict, m_pledgeCount.PledgeCountTotal); trunk/nuxleus/Source/Nuxleus.Web/HttpHandler/NuxleusHttpAsyncRequestValidationHandler.cs
r4641 r4643 31 31 { 32 32 NuxleusAsyncResult m_asyncResult; 33 PledgeCount m_pledgeCount; 33 int m_pledgeCountDistrict; 34 int m_pledgeCountTotal; 34 35 35 36 public void ProcessRequest(HttpContext context) … … 49 50 m_asyncResult = new NuxleusAsyncResult(cb, extraData); 50 51 51 m_pledgeCount = (PledgeCount)context.Application["pledgeCount"]; 52 Queue<string> pledgeQueue = (Queue<string>)context.Application["pledgeQueue"]; 53 54 if (pledgeQueue.Count > 0) { 55 while (pledgeQueue.Count != 0) { 56 string location = pledgeQueue.Dequeue(); 57 if (location == "ca12thdistrict") { 58 m_pledgeCountDistrict++; 59 m_pledgeCountTotal++; 60 } else { 61 m_pledgeCountTotal++; 62 } 63 } 64 } 52 65 53 66 using(XmlWriter writer = XmlWriter.Create(context.Response.Output)) … … 59 72 writer.WriteStartElement("session"); 60 73 writer.WriteStartAttribute("request-total"); 61 writer.WriteString(m_pledgeCount.PledgeCountTotal.ToString());74 writer.WriteString(m_pledgeCountTotal.ToString()); 62 75 writer.WriteEndAttribute(); 63 76 writer.WriteStartAttribute("request-district"); 64 writer.WriteString(m_pledgeCount .PledgeCountDistrict.ToString());77 writer.WriteString(m_pledgeCountDistrict.ToString()); 65 78 writer.WriteEndAttribute(); 66 79 writer.WriteEndElement();
