+2007-10-23 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Ping.cs : Do not call OnPingCompleted() at CancelAsync() it should
+ be called at RunWorkerCompleted. Simplified RunWorkerCompleted.
+
2007-09-29 Miguel de Icaza <miguel@novell.com>
* NetworkInterface.cs (GetAllNetworkInterfaces): return an empty
};
worker.WorkerSupportsCancellation = true;
worker.RunWorkerCompleted += delegate (object o, RunWorkerCompletedEventArgs ea) {
- if (ea.Result is PingReply)
- OnPingCompleted (new PingCompletedEventArgs (null, false, user_async_state, (PingReply) ea.Result));
- else
- OnPingCompleted (new PingCompletedEventArgs ((Exception) ea.Result, false, user_async_state, null));
+ // Note that RunWorkerCompletedEventArgs.UserState cannot be used (LAMESPEC)
+ OnPingCompleted (new PingCompletedEventArgs (ea.Error, ea.Cancelled, user_async_state, ea.Result as PingReply));
};
worker.RunWorkerAsync (userToken);
}
public void SendAsyncCancel ()
{
if (worker == null)
- throw new InvalidOperationException ("Another SendAsync operation is in progress");
+ throw new InvalidOperationException ("SendAsync operation is not in progress");
worker.CancelAsync ();
- OnPingCompleted (new PingCompletedEventArgs (null, true, user_async_state, null));
}
// ICMP message