Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Update monsoon to compile with monotorrent from git.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcgovern committed Feb 28, 2011
1 parent 988ae83 commit 4c42c5b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
22 changes: 11 additions & 11 deletions Monsoon/CreateTorrentDialog.cs
Expand Up @@ -31,6 +31,7 @@
using Gtk;
using MonoTorrent.Common;
using MonoTorrent.BEncoding;
using MonoTorrent;

namespace Monsoon
{
Expand Down Expand Up @@ -194,33 +195,32 @@ private void createTorrent()
progressDialog = new CreateTorrentProgressDialog();

// TODO: Read the multi-tracker spec -- learn the proper way to add multiple trackers
creator.Announces.Add(new List<string>());
foreach(string s in GetTrackers())
creator.Announces[0].Add(s);
creator.Announces.Add(new RawTrackerTier ());
foreach(string s in GetTrackers())
creator.Announces[0].Add(s);

creator.Comment = Comment;
creator.CreatedBy = Defines.ApplicationName;

creator.Path = SavePath;

creator.Hashed += delegate(object o, TorrentCreatorEventArgs e) {
GLib.Idle.Add(delegate {
OnHashed(o, e);
return false;
});
};
TorrentCreatorAsyncResult creatorResult = creator.BeginCreate(null, delegate (IAsyncResult r) {

var result = creator.BeginCreate(new TorrentFileSource (SavePath), delegate (IAsyncResult r) {
GLib.Idle.Add (delegate {
BeginCreateCb (r);
return false;
});
});
}, null);

ResponseType cancelResult = (ResponseType) progressDialog.Run();
if(cancelResult == ResponseType.Cancel){
creatorResult.Abort();
creator.AbortCreation ();
try{
creator.EndCreate(creatorResult);
creator.EndCreate(result);
progressDialog.Destroy();
} catch (Exception e) {
logger.ErrorException("Unable to end creation" + e.Message, e);
Expand Down Expand Up @@ -250,7 +250,7 @@ private void BeginCreateCb(IAsyncResult result)
Torrent t = Torrent.Load(p);
BitField bf = new BitField(t.Pieces.Count);
bf.Not();
MonoTorrent.Client.FastResume fresume = new MonoTorrent.Client.FastResume (t.InfoHash, bf, new List<MonoTorrent.Client.Peer>());
MonoTorrent.Client.FastResume fresume = new MonoTorrent.Client.FastResume (t.InfoHash, bf);
torrentController.FastResume.Add(fresume);
string savePath;
if (newTorrentLocationButton.Action == FileChooserAction.SelectFolder) {
Expand Down
2 changes: 1 addition & 1 deletion Monsoon/Defines.cs
Expand Up @@ -17,7 +17,7 @@ public class Defines

public static string InstallPrefix {
get {
return "/usr/local";
return "/opt/mono";
}
}

Expand Down
8 changes: 5 additions & 3 deletions Monsoon/MainWindow.cs
Expand Up @@ -854,9 +854,11 @@ protected void OnDeleteEvent (object sender, DeleteEventArgs a)
// This should be stored before the torrent is stopped
StoreTorrentSettings ();

foreach (WaitHandle h in this.torrentController.Engine.StopAll())
h.WaitOne (TimeSpan.FromSeconds(2), false);

torrentController.Engine.StopAll();
// FIXME: I should wait for all the torrents to actually hit the stopped state
// so that I know they've had time to ping the trackers with the final stats.
Thread.Sleep (2000);

// List<WaitHandle> handles = new List<WaitHandle> ();
// foreach (Download manager in torrents.Keys){
// if(manager.State == TorrentState.Stopped)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -48,7 +48,7 @@ PKG_CHECK_MODULES([GCONF_SHARP_20], [gconf-sharp-2.0])
PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0 >= 2.10])
PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0])
PKG_CHECK_MODULES([NDESK_DBUS_GLIB_10], [ndesk-dbus-glib-1.0 >= 0.4])
PKG_CHECK_MODULES([MONOTORRENT], [monotorrent = 0.80])
PKG_CHECK_MODULES([MONOTORRENT], [monotorrent = 0.90])
PKG_CHECK_MODULES([MONONAT], [mono.nat >= 1.0.1])
PKG_CHECK_MODULES([MONO_ADDINS], [mono-addins >= 0.4])
PKG_CHECK_MODULES([MONO_ADDINS_GUI], [mono-addins-gui >= 0.4])
Expand Down

0 comments on commit 4c42c5b

Please sign in to comment.