Author: alanmc
Date: 2007-05-23 18:47:08 -0400 (Wed, 23 May 2007)
New Revision: 77875
Removed:
trunk/bitsharp/src/Libs/Upnp.dll
trunk/bitsharp/src/Libs/Upnp.xml
trunk/bitsharp/src/MonoTorrent/Client/PortMapper.cs
Modified:
trunk/bitsharp/src/Makefile
trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs
trunk/bitsharp/src/MonoTorrent/Client/Makefile
trunk/bitsharp/src/MonoTorrent/Client/Settings/EngineSettings.cs
trunk/bitsharp/src/MonoTorrent/Makefile
trunk/bitsharp/src/SampleClient/Makefile
trunk/bitsharp/src/SampleClient/main.cs
trunk/bitsharp/src/prebuild.xml
Log:
Removed upnp stuff from the main library. It was a stupid idea putting it
there. If you want uPnP, use the uPnP library yourself.
Deleted: trunk/bitsharp/src/Libs/Upnp.dll
===================================================================
(Binary files differ)
Deleted: trunk/bitsharp/src/Libs/Upnp.xml
===================================================================
--- trunk/bitsharp/src/Libs/Upnp.xml 2007-05-23 22:34:10 UTC (rev 77874)
+++ trunk/bitsharp/src/Libs/Upnp.xml 2007-05-23 22:47:08 UTC (rev 77875)
@@ -1,183 +0,0 @@
-<?xml version="1.0"?>
-<doc>
- <assembly>
- <name>Upnp</name>
- </assembly>
- <members>
- <member name="F:Nat.UpnpNatDevice.serviceDescriptionUrl">
- <summary>
- The relative url of the xml file that describes the list of
services is at
- </summary>
- </member>
- <member name="F:Nat.UpnpNatDevice.callback">
- <summary>
- The callback to invoke when we are finished setting up the device
- </summary>
- </member>
- <member
name="M:Nat.UpnpNatDevice.BeginGetExternalIP(System.AsyncCallback,System.Object)">
- <summary>
- Begins an async call to get the external ip address of the router
- </summary>
- </member>
- <member
name="M:Nat.UpnpNatDevice.BeginCreatePortMap(Nat.Mapping,System.AsyncCallback,System.Object)">
- <summary>
- Maps the specified port to this computer
- </summary>
- </member>
- <member
name="M:Nat.UpnpNatDevice.BeginCreatePortMap(Nat.Mapping,System.String,System.AsyncCallback,System.Object)">
- <summary>
- Automatically fowards the specified port to this computer
- </summary>
- <param name="portMapDescription">The description to use for the
mapped port</param>
- </member>
- <member
name="M:Nat.UpnpNatDevice.BeginDeletePortMap(Nat.Mapping,System.AsyncCallback,System.Object)">
- <summary>
- Removes a port mapping from this computer
- </summary>
- </member>
- <member name="M:Nat.UpnpNatDevice.CreatePortMap(Nat.Mapping)">
- <summary>
- Creates a port mapping on the upnp router.
- </summary>
- <param name="mapping">Port details</param>
- </member>
- <member
name="M:Nat.UpnpNatDevice.CreatePortMap(Nat.Mapping,System.String)">
- <summary>
- Creates a port mapping on the upnp router.
- </summary>
- <param name="mapping">Port details</param>
- <param name="description">Description that identifies this
mapping.</param>
- </member>
- <member name="M:Nat.UpnpNatDevice.DeletePortMap(Nat.Mapping)">
- <summary>
- Removes a port mapping on the upnp router
- </summary>
- <param name="mapping">Port details</param>
- </member>
- <member
name="M:Nat.UpnpNatDevice.EndCreatePortMap(System.IAsyncResult)">
- <summary>
-
- </summary>
- <param name="result"></param>
- </member>
- <member
name="M:Nat.UpnpNatDevice.EndDeletePortMap(System.IAsyncResult)">
- <summary>
-
- </summary>
- <param name="result"></param>
- </member>
- <member
name="M:Nat.UpnpNatDevice.EndGetExternalIP(System.IAsyncResult)">
- <summary>
- Ends an async request to get the external ip address of the router
- </summary>
- </member>
- <member name="M:Nat.UpnpNatDevice.GetAllMappings">
- <summary>
- Retrieves all portmappings currently configured on the upnp router
- </summary>
- <returns></returns>
- </member>
- <member name="M:Nat.UpnpNatDevice.GetExternalIP">
- <summary>
- Returns the IP address of the upnp router that is currently used.
- </summary>
- <returns>Address of the upnp router.</returns>
- </member>
- <member name="P:Nat.UpnpNatDevice.LastSeen">
- <summary>
- The time that this device was last seen
- </summary>
- </member>
- <member name="P:Nat.UpnpNatDevice.HostEndPoint">
- <summary>
- The EndPoint that the device is at
- </summary>
- </member>
- <member name="P:Nat.UpnpNatDevice.ControlUrl">
- <summary>
- The relative url that we can use to control the port forwarding
- </summary>
- </member>
- <member name="M:Nat.UpnpMessages.DiscoverDeviceMessage.Encode">
- <summary>
- The message sent to discover all uPnP devices on the network
- </summary>
- <returns></returns>
- </member>
- <member name="F:Nat.NatController.SearchPeriod">
- <summary>
- The time in seconds between each search
- </summary>
- </member>
- <member name="F:Nat.NatController.localAddresses">
- <summary>
- The IPAddresses that this computer has at the moment
- </summary>
- </member>
- <member name="F:Nat.NatController.searchTimer">
- <summary>
- The timer used to control the update period
- </summary>
- </member>
- <member name="F:Nat.NatController.udpClient">
- <summary>
- The UDPClient to send search requests over
- </summary>
- </member>
- <member name="F:Nat.NatController.searchEndPoint">
- <summary>
- The local endpoint that search requests are sent to
- </summary>
- </member>
- <member name="M:Nat.NatController.StartSearching">
- <summary>
- Makes the controller start actively searching for new devices
- </summary>
- </member>
- <member name="M:Nat.NatController.StopSearching">
- <summary>
- Makes the controller stop actively searching for new devices
- </summary>
- </member>
- <member name="M:Nat.NatController.Search">
- <summary>
-
- </summary>
- </member>
- <member
name="M:Nat.NatController.timerTick(System.Object,System.Timers.ElapsedEventArgs)">
- <summary>
-
- </summary>
- <param name="sender"></param>
- <param name="e"></param>
- </member>
- <member name="M:Nat.NatController.ListenThread">
- <summary>
-
- </summary>
- </member>
- <member name="M:Nat.NatController.ReplyReceived(System.Byte[])">
- <summary>
-
- </summary>
- <param name="data"></param>
- </member>
- <member name="M:Nat.NatController.DeviceSetupComplete(Nat.INatDevice)">
- <summary>
- This method is invoked when an InternetGatewayDevice has finished
setting itself up and is now ready to be used
- to map ports.
- </summary>
- <param name="d">The device which has just finished setting
up</param>
- </member>
- <member name="P:Nat.NatController.Devices">
- <summary>
- The list of all Internet Gateway Devices that support uPnP port
forwarding
- </summary>
- </member>
- <member name="P:Nat.NatController.IsSearching">
- <summary>
- True if the controller is actively searching for new devices
- </summary>
- </member>
- </members>
-</doc>
Modified: trunk/bitsharp/src/Makefile
===================================================================
--- trunk/bitsharp/src/Makefile 2007-05-23 22:34:10 UTC (rev 77874)
+++ trunk/bitsharp/src/Makefile 2007-05-23 22:47:08 UTC (rev 77875)
@@ -4,7 +4,6 @@
for dir in $(SUBDIRS); do \
(cd $$dir && make) \
done
- cp Libs/Upnp.dll bin/Upnp.dll
clean:
-for dir in $(SUBDIRS); do \
@@ -34,7 +33,6 @@
sed -e "s,@prefix@,$(prefix)," -e 's/@cmd@/MonoTorrent.Interface.exe/'
< script.in > monotorrent-gtk
chmod +x monotorrent-gtk
mv monotorrent-gtk $(prefix)/bin/monotorrent-gtk
- cp Libs/Upnp.dll $(prefix)/lib/bitsharp/
-mkdir $(prefix)/lib/pkgconfig
cp monotorrent.pc $(prefix)/lib/pkgconfig/
@@ -52,7 +50,6 @@
distlocal:
mkdir $(DESTDIR)/Libs
- cp Libs/Upnp.dll Libs/Upnp.xml $(DESTDIR)/Libs
cp README rules.make TODO script.in Makefile configure
monotorrent.pc.in $(DESTDIR)/
distcheck: dist
Modified: trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs 2007-05-23
22:34:10 UTC (rev 77874)
+++ trunk/bitsharp/src/MonoTorrent/Client/ClientEngine.cs 2007-05-23
22:47:08 UTC (rev 77875)
@@ -68,7 +68,6 @@
/// </summary>
internal const int TickLength = 500;
- private PortMapper portMapper;
#endregion
@@ -182,21 +181,8 @@
this.onEncryptorReadyHandler = new
EncryptorReadyHandler(onEncryptorReady);
this.onEncryptorIOErrorHandler = new
EncryptorIOErrorHandler(onEncryptorError);
this.onEncryptorEncryptionErrorHandler = new
EncryptorEncryptionErrorHandler(onEncryptorError);
-
- // If uPnP support has been enabled
- if (this.settings.UsePnP)
- {
- this.portMapper = new PortMapper();
- this.portMapper.RouterFound += new
EventHandler(portMapper_RouterFound);
- this.portMapper.Start();
- }
}
- void portMapper_RouterFound(object sender, EventArgs e)
- {
- this.portMapper.MapPort(this.settings.ListenPort);
- }
-
#endregion
@@ -805,8 +791,6 @@
this.listener.Dispose();
this.timer.Dispose();
- if (this.settings.UsePnP)
- this.portMapper.Dispose();
}
Modified: trunk/bitsharp/src/MonoTorrent/Client/Makefile
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/Makefile 2007-05-23 22:34:10 UTC
(rev 77874)
+++ trunk/bitsharp/src/MonoTorrent/Client/Makefile 2007-05-23 22:47:08 UTC
(rev 77875)
@@ -3,8 +3,7 @@
REFERENCES= \
-r:../bin/MonoTorrent.Common.dll \
-r:System.Web,Mono.Security.dll \
- -r:../bin/MonoTorrent.BEncoding.dll \
- -r:../Libs/Upnp.dll
+ -r:../bin/MonoTorrent.BEncoding.dll
SOURCES=BitField.cs \
Block.cs \
Deleted: trunk/bitsharp/src/MonoTorrent/Client/PortMapper.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/PortMapper.cs 2007-05-23 22:34:10 UTC
(rev 77874)
+++ trunk/bitsharp/src/MonoTorrent/Client/PortMapper.cs 2007-05-23 22:47:08 UTC
(rev 77875)
@@ -1,71 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Nat;
-using System.Diagnostics;
-
-namespace MonoTorrent.Client
-{
- internal class PortMapper : IDisposable
- {
- private NatController controller;
- private INatDevice router;
- private int port;
-
- public event EventHandler RouterFound;
-
- internal PortMapper()
- {
- this.controller = new NatController();
- this.controller.DeviceFound += new
EventHandler<DeviceEventArgs>(controller_DeviceFound);
- this.port = -1;
- }
-
- private void controller_DeviceFound(object sender, DeviceEventArgs e)
- {
- if (router == null)
- {
- this.router = e.Device;
- if (this.RouterFound != null)
- this.RouterFound(this, EventArgs.Empty);
- }
- }
-
- internal void Start()
- {
- try
- {
- this.controller.StartSearching();
- }
- catch (Exception ex)
- {
- Logger.Log("UPnP searching failed: " + ex.ToString());
- }
- }
-
- internal void MapPort(int port)
- {
- this.port = port;
- this.router.BeginCreatePortMap(new Mapping((ushort)port,
Protocol.Tcp), "", new AsyncCallback(EndMapPort), null);
- }
-
- private void EndMapPort(IAsyncResult result)
- {
- try
- {
- this.router.EndCreatePortMap(result);
- Logger.Log("Port mapped: " + this.port);
- }
- catch
- {
- Logger.Log("Couldn't map the port: " + this.port);
- }
- }
-
- public void Dispose()
- {
- this.router.DeletePortMap(new Mapping((ushort)this.port,
Protocol.Tcp));
- this.controller.Dispose();
- }
- }
-}
\ No newline at end of file
Modified: trunk/bitsharp/src/MonoTorrent/Client/Settings/EngineSettings.cs
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Client/Settings/EngineSettings.cs
2007-05-23 22:34:10 UTC (rev 77874)
+++ trunk/bitsharp/src/MonoTorrent/Client/Settings/EngineSettings.cs
2007-05-23 22:47:08 UTC (rev 77875)
@@ -50,7 +50,6 @@
private int globalMaxDownloadSpeed; // The maximum
combined download speed
private int globalMaxUploadSpeed; // The maximum
combined upload speed
private string savePath; // The path that
torrents will be downloaded to by default
- private bool useuPnP; // True if uPnP should
be used to map ports when available
#endregion Private Fields
@@ -137,15 +136,6 @@
set { this.listenPort = value; }
}
-
- /// <summary>
- /// True if the engine should use uPnP to map ports if it is available
- /// </summary>
- public bool UsePnP
- {
- get { return this.useuPnP; }
- }
-
#endregion Properties
@@ -159,7 +149,6 @@
private const int DefaultMaxHalfOpenConnections = 5;
private const EncryptionType DefaultMinLevel = EncryptionType.None;
private const int DefaultListenPort = 52138;
- private const bool DefaultUseuPnP = false; // UPnP
crashes on vista's .NET framework, so we won't enable by default
#endregion
@@ -177,7 +166,7 @@
/// <param name="defaultSavePath">The default path to save downloaded
material to</param>
/// <param name="listenPort">The port to listen for incoming
connections on</param>
public EngineSettings(string defaultSavePath, int listenPort)
- : this(defaultSavePath, listenPort, DefaultUseuPnP,
DefaultMaxConnections, DefaultMaxHalfOpenConnections, DefaultMaxDownloadSpeed,
DefaultMaxUploadSpeed, DefaultMinLevel, DefaultAllowLegacyConnections)
+ : this(defaultSavePath, listenPort, DefaultMaxConnections,
DefaultMaxHalfOpenConnections, DefaultMaxDownloadSpeed, DefaultMaxUploadSpeed,
DefaultMinLevel, DefaultAllowLegacyConnections)
{
}
@@ -186,25 +175,11 @@
/// <summary>
/// Initialises a new engine settings with the supplied values
/// </summary>
- /// <param name="defaultSavePath">The default path to save downloaded
material to</param>
- /// <param name="listenPort">The port to listen for incoming
connections on</param>
- /// <param name="useuPnP">True if uPnP should be used to map the
listen port</param>
- public EngineSettings(string defaultSavePath, int listenPort, bool
useuPnP)
- : this(defaultSavePath, listenPort, useuPnP,
DefaultMaxConnections, DefaultMaxHalfOpenConnections, DefaultMaxDownloadSpeed,
DefaultMaxUploadSpeed, DefaultMinLevel, DefaultAllowLegacyConnections)
- {
-
- }
-
-
- /// <summary>
- /// Initialises a new engine settings with the supplied values
- /// </summary>
/// <param name="globalMaxConnections">The overall maximum number of
open connections allowed</param>
/// <param name="defaultSavePath">The default path to save downloaded
material to</param>
/// <param name="listenPort">The port to listen for incoming
connections on</param>
- /// <param name="useuPnP">True if uPnP should be used to map the
listen port</param>
- public EngineSettings(string defaultSavePath, int listenPort, bool
useuPnP, int globalMaxConnections)
- : this(defaultSavePath, listenPort, useuPnP, globalMaxConnections,
DefaultMaxHalfOpenConnections, DefaultMaxDownloadSpeed, DefaultMaxUploadSpeed,
DefaultMinLevel, DefaultAllowLegacyConnections)
+ public EngineSettings(string defaultSavePath, int listenPort, int
globalMaxConnections)
+ : this(defaultSavePath, listenPort, globalMaxConnections,
DefaultMaxHalfOpenConnections, DefaultMaxDownloadSpeed, DefaultMaxUploadSpeed,
DefaultMinLevel, DefaultAllowLegacyConnections)
{
}
@@ -217,9 +192,8 @@
/// <param name="globalHalfOpenConnections">The overall maximum number
of half open connections</param>
/// <param name="defaultSavePath">The default path to save downloaded
material to</param>
/// <param name="listenPort">The port to listen for incoming
connections on</param>
- /// <param name="useuPnP">True if uPnP should be used to map the
listen port</param>
- public EngineSettings(string defaultSavePath, int listenPort, bool
useuPnP, int globalMaxConnections, int globalHalfOpenConnections)
- : this(defaultSavePath, listenPort, useuPnP, globalMaxConnections,
globalHalfOpenConnections, DefaultMaxDownloadSpeed, DefaultMaxUploadSpeed,
DefaultMinLevel, DefaultAllowLegacyConnections)
+ public EngineSettings(string defaultSavePath, int listenPort, int
globalMaxConnections, int globalHalfOpenConnections)
+ : this(defaultSavePath, listenPort, globalMaxConnections,
globalHalfOpenConnections, DefaultMaxDownloadSpeed, DefaultMaxUploadSpeed,
DefaultMinLevel, DefaultAllowLegacyConnections)
{
}
@@ -234,10 +208,9 @@
/// <param name="globalHalfOpenConnections">The overall maximum number
of half open connections</param>
/// <param name="defaultSavePath">The default path to save downloaded
material to</param>
/// <param name="listenPort">The port to listen for incoming
connections on</param>
- /// <param name="useuPnP">True if uPnP should be used to map the
listen port</param>
/// <param name="allowLegacyConnections">True if incoming connections
without encryption should be accepted when encryption is enabled</param>
/// <param name="minEncryption">The minimum level of encryption to use
for outgoing connections</param>
- public EngineSettings(string defaultSavePath, int listenPort, bool
useuPnP, int globalMaxConnections, int globalHalfOpenConnections, int
globalMaxDownloadSpeed, int globalMaxUploadSpeed, EncryptionType minEncryption,
bool allowLegacyConnections)
+ public EngineSettings(string defaultSavePath, int listenPort, int
globalMaxConnections, int globalHalfOpenConnections, int
globalMaxDownloadSpeed, int globalMaxUploadSpeed, EncryptionType minEncryption,
bool allowLegacyConnections)
{
this.allowLegacyConnections = allowLegacyConnections;
this.globalMaxConnections = globalMaxConnections;
@@ -247,20 +220,17 @@
this.listenPort = listenPort;
this.minEncryptionLevel = minEncryption;
this.savePath = defaultSavePath;
- this.useuPnP = useuPnP;
}
#endregion
-
#region Methods
public object Clone()
{
return new EngineSettings(this.savePath,
this.listenPort,
- this.useuPnP,
this.globalMaxConnections,
this.globalMaxHalfOpenConnections,
this.globalMaxDownloadSpeed,
@@ -279,11 +249,9 @@
this.globalMaxUploadSpeed ==
settings.globalMaxUploadSpeed &&
this.listenPort ==
settings.listenPort &&
this.minEncryptionLevel ==
settings.minEncryptionLevel &&
- this.savePath ==
settings.savePath &&
- this.useuPnP ==
settings.useuPnP;
+ this.savePath ==
settings.savePath;
}
-
public override int GetHashCode()
{
return this.allowLegacyConnections.GetHashCode() +
@@ -293,13 +261,13 @@
this.globalMaxUploadSpeed +
this.listenPort.GetHashCode() +
this.minEncryptionLevel.GetHashCode() +
- this.savePath.GetHashCode() +
- this.useuPnP.GetHashCode();
+ this.savePath.GetHashCode();
}
#endregion Methods
+
#region Default Settings
/// <summary>
@@ -309,7 +277,6 @@
{
return new EngineSettings(DefaultSavePath,
DefaultListenPort,
- DefaultUseuPnP,
DefaultMaxConnections,
DefaultMaxHalfOpenConnections,
DefaultMaxDownloadSpeed,
@@ -319,7 +286,5 @@
}
#endregion
-
-
}
}
\ No newline at end of file
Modified: trunk/bitsharp/src/MonoTorrent/Makefile
===================================================================
--- trunk/bitsharp/src/MonoTorrent/Makefile 2007-05-23 22:34:10 UTC (rev
77874)
+++ trunk/bitsharp/src/MonoTorrent/Makefile 2007-05-23 22:47:08 UTC (rev
77875)
@@ -1,8 +1,7 @@
OUT=../bin/MonoTorrent.dll
REFERENCES= \
- -r:System.Web,Mono.Security.dll \
- -r:../Libs/Upnp.dll
+ -r:System.Web,Mono.Security.dll
EXTRA_DIST = AssemblyInfo.cs.in
Modified: trunk/bitsharp/src/SampleClient/Makefile
===================================================================
--- trunk/bitsharp/src/SampleClient/Makefile 2007-05-23 22:34:10 UTC (rev
77874)
+++ trunk/bitsharp/src/SampleClient/Makefile 2007-05-23 22:47:08 UTC (rev
77875)
@@ -2,8 +2,7 @@
OUT=../bin/MonoTorrent.exe
REFERENCES=\
- -r:../bin/MonoTorrent.dll \
- -r:../Libs/Upnp.dll
+ -r:../bin/MonoTorrent.dll
SOURCES=main.cs \
Top10Listener.cs
Modified: trunk/bitsharp/src/SampleClient/main.cs
===================================================================
--- trunk/bitsharp/src/SampleClient/main.cs 2007-05-23 22:34:10 UTC (rev
77874)
+++ trunk/bitsharp/src/SampleClient/main.cs 2007-05-23 22:47:08 UTC (rev
77875)
@@ -55,8 +55,7 @@
// Create the settings which the engine will use
// downloadsPath - this is the path where we will save
all the files to
// port - this is the port we listen for connections on
- // false - we don't want to use uPnP to map the port.
- EngineSettings engineSettings = new EngineSettings(downloadsPath,
port, false);
+ EngineSettings engineSettings = new EngineSettings(downloadsPath,
port);
Modified: trunk/bitsharp/src/prebuild.xml
===================================================================
--- trunk/bitsharp/src/prebuild.xml 2007-05-23 22:34:10 UTC (rev 77874)
+++ trunk/bitsharp/src/prebuild.xml 2007-05-23 22:47:08 UTC (rev 77875)
@@ -47,7 +47,6 @@
<Reference name="System" />
<Reference name="System.Web" />
<Reference name="System.Xml" />
- <Reference name="Upnp" localCopy="true" path="../Libs"/>
<Reference name="Mono.Security" localCopy="true" path="../Libs"/>
<Files>
<Match path="BEncoding" pattern="*.cs" recurse="true"/>
@@ -80,7 +79,6 @@
<Reference name="System" />
<Reference name="System.Web" />
<Reference name="System.Xml" />
- <Reference name="Upnp" localCopy="true" path="../Libs"/>
<Reference name="MonoTorrent"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches