Author: alanmc
Date: 2008-02-19 16:31:41 -0500 (Tue, 19 Feb 2008)
New Revision: 96191

Added:
   
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Tracker/Listeners/ManualListener.cs
Log:
Added a new subclass of listenerbase, the ManualListener.

Added: 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Tracker/Listeners/ManualListener.cs
===================================================================
--- 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Tracker/Listeners/ManualListener.cs  
    2008-02-19 21:30:42 UTC (rev 96190)
+++ 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Tracker/Listeners/ManualListener.cs  
    2008-02-19 21:31:41 UTC (rev 96191)
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using MonoTorrent.BEncoding;
+using System.Net;
+
+namespace MonoTorrent.Tracker.Listeners
+{
+       public class ManualListener : ListenerBase
+       {
+               private bool running;
+               
+               public override bool Running
+               {
+                       get { return running; }
+               }
+
+               public override void Start()
+               {
+                       running = true;
+               }
+
+               public override void Stop()
+               {
+                       running = false;
+               }
+
+               public BEncodedValue Handle(string rawUrl, IPAddress 
remoteAddress)
+               {
+                       if (rawUrl == null)
+                               throw new ArgumentNullException("rawUrl");
+                       if (remoteAddress == null)
+                               throw new 
ArgumentOutOfRangeException("remoteAddress");
+
+                       bool isScrape = rawUrl.StartsWith("/scrape", 
StringComparison.OrdinalIgnoreCase);
+                       return Handle(rawUrl, remoteAddress, isScrape);
+               }
+       }
+}

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to