New topic: Global dictionary woes
<http://forums.realsoftware.com/viewtopic.php?t=34249> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message tvalleau Post subject: Global dictionary woesPosted: Sat Jun 12, 2010 12:49 am Joined: Fri Feb 16, 2007 6:10 pm Posts: 46 I have an app, based on the RB webserver sample. There is an application class (server) and the httpConnection object. I have also created a module, for the purpose of making 2 global properties as dictionaries: actionResults and callQueue. I've placed them in the module because I need to access them from the HTTPConnection object as well as from the application class itself. I run the software and it sits there waiting for an incoming GET. When a GET call comes in to the parseHeaders method in the HTTPConnection object, I place an identifier into the callQueue. The next time a get call comes in, I look to see if the identifier is in the callQueue. Problem is: sometimes it is but most of the time, it isn't. In debugging, I have verified that it goes in successfully: callQueue.Value(uuid) = ctl // add the fact that this uuid is making a call... // debugging: if (callQueue.HasKey(uuid) = False) then Window1.status.Text = "NOT FOUND!!!" else Window1.status.Text = "FOUND="+uuid end The the socket sends a reply and the connection exits. The software calls it via a GET again and this line is hit: if (callQueue.HasKey(uuid) = False) then (the item is no longer in the dictionary) The problem is that 9 times out of 10, callQueue.HasKey(uuid) IS False! Even tho there is NO remove call ever made. What is happening? This is so weird that All I can think of is that something is wrong with how I've created the dictionaries in the first place. In my Application's Activate, I have: callQueue = new Dictionary actionResults = new Dictionary as the way of initializing the objects. "Dim" won't work because that makes them local. Leaving that out won't work because the dictionaries are not seen I'm completely stumped. I'd sure appreciate some advice. Top tvalleau Post subject: Re: Global dictionary woesPosted: Sat Jun 12, 2010 1:05 am Joined: Fri Feb 16, 2007 6:10 pm Posts: 46 You know... sometimes writing it out (not to mention looking a fool in public) will solve it. DUH... I had the "new" in "Activate" instead of "open"... sheesh... Just bill the wasted bandwidth to my account..... Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
