Skip to content

Commit

Permalink
HTTP Connections are much more reliable now
Browse files Browse the repository at this point in the history
Fixed null pointer exception in RTLMessageBox
Fixed WebStats crash
  • Loading branch information
meirtsvi committed May 5, 2012
1 parent 870de32 commit f20adab
Show file tree
Hide file tree
Showing 6 changed files with 954 additions and 226 deletions.
36 changes: 34 additions & 2 deletions WazeWP7/AsyncNet.cs
Expand Up @@ -108,7 +108,7 @@ public void runNetLoop()
if (updateTime != null && updateTime.Trim().Length > 0) {
conn.Headers["IfModifiedSince"] = updateTime;
}

registeredHandle = CRunTime.registerObject(conn);

}
Expand Down Expand Up @@ -151,12 +151,44 @@ public void runNetLoop()
try
{
http_response_sync.Reset();

if (conn.Method == "POST")
{
byte[] buffer;
if (Syscalls.buffered_requests.TryGetValue(registeredHandle, out buffer))
{
conn.BeginGetRequestStream(delegate(IAsyncResult result)
{
var request = (WebRequest)result.AsyncState;
using (var str = request.EndGetRequestStream(result))
{
Syscalls.buffered_requests.Remove(registeredHandle);
str.Write(buffer, 0, (int)buffer.Length);
#if DEBUG
Logger.log("http put: " + System.Text.Encoding.UTF8.GetString(buffer, 0, buffer.Length));
#endif
}
http_response_sync.Set();

}, conn);
}
else
{
http_response_sync.Set();
}


http_response_sync.WaitOne();
}

http_response_sync.Reset();

conn.BeginGetResponse(delegate(IAsyncResult result)
{
try
{
var request = (HttpWebRequest)result.AsyncState;
Logger.log("downloading " + conn.RequestUri);
Logger.log("downloading " + request.RequestUri);
resp = (HttpWebResponse)request.EndGetResponse(result);
http_response_sync.Set();
}
Expand Down
4 changes: 2 additions & 2 deletions WazeWP7/Properties/AssemblyInfo.cs
Expand Up @@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.9.9.4")]
[assembly: AssemblyFileVersion("0.9.9.4")]
[assembly: AssemblyVersion("0.9.9.5")]
[assembly: AssemblyFileVersion("0.9.9.5")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
7 changes: 5 additions & 2 deletions WazeWP7/RTLMessageBox.xaml.cs
Expand Up @@ -45,8 +45,11 @@ public void Show(string title, string message)
Hide();

// And now add to the current page
var currentPage = ((App)Application.Current).RootFrame.Content as WazeApplicationPage;
currentPage.GetPopupPanel().Children.Add(this);
var currentPage = ((App)Application.Current).RootFrame.Content as WazeApplicationPage;
if (currentPage != null)
{
currentPage.GetPopupPanel().Children.Add(this);
}
}

internal void Hide()
Expand Down

0 comments on commit f20adab

Please sign in to comment.