Author: alanmc
Date: 2006-09-10 08:56:07 -0400 (Sun, 10 Sep 2006)
New Revision: 65165
Removed:
branches/BitSharp/bitsharp/src/MonoTorrent.Client/ClientPeer.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/IPeerConnectionID.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerBase.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnection.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionBase.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionId.cs
branches/BitSharp/bitsharp/src/MonoTorrent.Client/Peers.cs
Log:
Removed duplicated/depreciated files
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/ClientPeer.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/ClientPeer.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/ClientPeer.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,245 +0,0 @@
-//
-// ClientPeer.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System;
-using MonoTorrent.Common;
-using System.Net;
-
-namespace MonoTorrent.Client
-{
- /// <summary>
- ///
- /// </summary>
- public class ClientPeer : Peer, IPeer
- {
- #region Member Variables
- /// <summary>
- /// The connection associated with this peer
- /// </summary>
- public PeerConnectionBase Connection
- {
- get { return this.connection; }
- set { this.connection = value; }
- }
- private PeerConnectionBase connection;
-
-
- /// <summary>
- /// The current status of the peer
- /// </summary>
- public PeerStatus Status
- {
- get { return this.status; }
- set { this.status = value; }
- }
- private PeerStatus status;
-
-
- /// <summary>
- /// The type of peer
- /// </summary>
- public PeerType PeerType
- {
- get { return this.peerType; }
- internal set { this.peerType = value; }
- }
- private PeerType peerType;
-
-
- /// <summary>
- ///
- /// </summary>
- public bool AmInterested
- {
- get { return this.amInterested; }
- set { this.amInterested = value; }
- }
- private bool amInterested;
-
-
- /// <summary>
- ///
- /// </summary>
- public bool AmChoking
- {
- get { return this.amChoking; }
- set { this.amChoking = value; }
- }
- private bool amChoking;
-
-
- /// <summary>
- ///
- /// </summary>
- public bool IsChoking
- {
- get { return this.isChoking; }
- set { this.isChoking = value; }
- }
- private bool isChoking;
-
-
- /// <summary>
- ///
- /// </summary>
- public bool IsInterested
- {
- get { return this.isInterested; }
- set { this.isInterested = value; }
- }
- private bool isInterested;
-
-
- /// <summary>
- ///
- /// </summary>
- public int IsRequestingPiecesCount
- {
- get { return this.isRequestingPiecesCount; }
- set { this.isRequestingPiecesCount = value; }
- }
- private int isRequestingPiecesCount;
-
-
- /// <summary>
- ///
- /// </summary>
- public int AmRequestingPiecesCount
- {
- get { return this.amRequestingPiecesCount; }
- set { this.amRequestingPiecesCount = value; }
- }
- private int amRequestingPiecesCount;
-
-
- /// <summary>
- /// True if we are currently processing the peers message queue
- /// </summary>
- public bool ProcessingQueue
- {
- get { return this.processingQueue; }
- set { this.processingQueue = value; }
- }
- private bool processingQueue;
-
-
- /// <summary>
- /// The number of pieces that we've sent the peer.
- /// </summary>
- public int PiecesSent
- {
- get { return this.piecesSent; }
- internal set { this.piecesSent = value; }
- }
- private int piecesSent;
-
-
- /// <summary>
- /// The peers bitfield
- /// </summary>
- public BitField BitField
- {
- get { return this.bitField; }
- set { this.bitField = value; }
- }
- private BitField bitField;
- #endregion
-
-
- #region Constructors
- /// <summary>
- /// Creates a new ClientPeer
- /// </summary>
- /// <param name="ipAddress">The IPAddress of the peer</param>
- /// <param name="port">The port the peer is listening on</param>
- /// <param name="peerId">The PeerID</param>
- public ClientPeer(string ipAddress, int port, string peerId)
- : this(new IPEndPoint(IPAddress.Parse(ipAddress), port), peerId)
- {
-
- }
-
-
- /// <summary>
- /// Creates a new ClientPeer
- /// </summary>
- /// <param name="remoteHost">The IPEndpoint of the peer</param>
- /// <param name="peerId">The PeerID</param>
- public ClientPeer(IPEndPoint remoteHost, string peerId)
- : base(remoteHost, peerId)
- {
- this.status = PeerStatus.Available;
- this.AmInterested = false;
- this.AmChoking = true;
- this.IsInterested = false;
- this.IsChoking = true;
- this.peerType = PeerType.Unknown;
- }
- #endregion
-
-
- #region Overridden Methods
- /// <summary>
- ///
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public override bool Equals(object obj)
- {
- ClientPeer peer2 = obj as ClientPeer;
-
- if (peer2 == null)
- return false;
-
- return this.PeerEndpoint.Equals(peer2.PeerEndpoint);
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override int GetHashCode()
- {
- return this.PeerEndpoint.GetHashCode();
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override string ToString()
- {
- return this.PeerEndpoint.ToString();
- }
- #endregion
- }
-}
\ No newline at end of file
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/IPeerConnectionID.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/IPeerConnectionID.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/IPeerConnectionID.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,54 +0,0 @@
-//
-// IPeerConnectionID.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using MonoTorrent.Common;
-
-namespace MonoTorrent.Client
-{
- /// <summary>
- /// The interface to access a PeerConnectionID from
- /// </summary>
- public interface IPeerConnectionID
- {
- /// <summary>
- /// The IPeer in this ID
- /// </summary>
- IPeer Peer { get; }
-
-
- /// <summary>
- /// The ITorrentManager in this ID
- /// </summary>
- ITorrentManager TorrentManager { get; }
- }
-}
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerBase.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerBase.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerBase.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,80 +0,0 @@
-//
-// PeerBase.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Net;
-
-namespace MonoTorrent.Common
-{
- public abstract class PeerBase
- {
- public IPEndPoint PeerEndpoint
- {
- get { return this.peerEndpoint; }
- }
- private IPEndPoint peerEndpoint;
-
- public string PeerId
- {
- get { return peerId; }
- set { peerId = value; }
- }
- private string peerId;
-
- public int FailedConnectionAttempts
- {
- get { return this.failedConnectionAttempts; }
- set { this.failedConnectionAttempts = value; }
- }
- private int failedConnectionAttempts;
-
- public int LastMessageSent
- {
- get { return this.lastMessageSent; }
- set { this.lastMessageSent = value; }
- }
- private int lastMessageSent;
-
- public int LastMessageRecieved
- {
- get { return this.lastMessageRecieved; }
- set { this.lastMessageRecieved = value; }
- }
- private int lastMessageRecieved;
-
- public PeerBase(IPEndPoint peerEndpoint, string peerId)
- {
- this.peerEndpoint = peerEndpoint;
- this.peerId = peerId;
- }
- }
-}
\ No newline at end of file
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnection.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnection.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnection.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,257 +0,0 @@
-//
-// PeerConnection.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System.Collections.Generic;
-using System.Net.Sockets;
-using System.Net;
-using MonoTorrent.Client.PeerMessages;
-using System;
-
-namespace MonoTorrent.Client
-{
- /// <summary>
- /// Holds the data for a connection to another peer
- /// </summary>
- public class PeerConnection : IDisposable
- {
- #region Member Variables
- /// <summary>
- /// The size of the send and recieve buffers. Defaults to 32bytes more
than my default request size.
- /// </summary>
- private static readonly int BufferSize = ((1 << 14) + 32);
-
-
- /// <summary>
- /// The total bytes to send from the buffer
- /// </summary>
- public int BytesToSend
- {
- get { return this.bytesToSend; }
- set { this.bytesToSend = value; }
- }
- private int bytesToSend;
-
-
- /// <summary>
- /// The total number of bytes sent from the current send buffer
- /// </summary>
- public int BytesSent
- {
- get { return this.bytesSent; }
- set { this.bytesSent = value; }
- }
- private int bytesSent;
-
-
- /// <summary>
- /// The total number of bytes recieved into the current recieve buffer
- /// </summary>
- public int BytesRecieved
- {
- get { return this.bytesRecieved; }
- set { this.bytesRecieved = value; }
- }
- private int bytesRecieved;
-
-
- /// <summary>
- /// The total number of bytes to receive
- /// </summary>
- public int BytesToRecieve
- {
- get { return this.bytesToRecieve; }
- set { this.bytesToRecieve = value; }
- }
- private int bytesToRecieve;
-
-
- /// <summary>
- ///
- /// </summary>
- private Socket peerSocket;
-
-
- /// <summary>
- /// This holds the peermessages waiting to be sent
- /// </summary>
- private Queue<IPeerMessage> sendQueue;
-
-
- internal byte[] recieveBuffer;
- internal byte[] sendBuffer;
-
-
- /// <summary>
- /// The endpoint where the remote host is
- /// </summary>
- public IPEndPoint PeerEndpoint
- {
- get { return this.peerEndpoint; }
- }
- private IPEndPoint peerEndpoint;
-
-
- /// <summary>
- /// The connection Monitor for this peer
- /// </summary>
- public ConnectionMonitor Monitor
- {
- get { return this.monitor; }
- }
- private ConnectionMonitor monitor;
- #endregion
-
-
- #region Constructors
- /// <summary>
- /// Creates a new connection to the peer at the specificed IP address
and port
- /// </summary>
- /// <param name="ip">The IPAddress to connect to</param>
- /// <param name="port">The Port to connect to</param>
- public PeerConnection(string ip, int port)
- : this(new IPEndPoint(IPAddress.Parse(ip), port))
- {
- }
-
- /// <summary>
- /// Creates a new connection to the peer at the specified IPEndpoint
- /// </summary>
- /// <param name="peerEndpoint">The IPEndpoint to connect to</param>
- public PeerConnection(IPEndPoint peerEndpoint)
- {
- this.monitor = new ConnectionMonitor();
- this.sendQueue = new Queue<IPeerMessage>(4);
- this.sendBuffer = new byte[BufferSize];
- this.recieveBuffer = new byte[BufferSize];
- this.peerEndpoint = peerEndpoint;
- this.peerSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
- }
-
- /// <summary>
- /// Creates a new connection to the peer based on the peerSocket
- /// </summary>
- /// <param name="peerSocket">The socket that the remote host connected
to</param>
- public PeerConnection(Socket peerSocket)
- {
- this.monitor = new ConnectionMonitor();
- this.sendQueue = new Queue<IPeerMessage>(4);
- this.sendBuffer = new byte[BufferSize];
- this.recieveBuffer = new byte[BufferSize];
- this.peerEndpoint = (IPEndPoint)peerSocket.RemoteEndPoint;
- this.peerSocket = peerSocket;
- }
- #endregion
-
-
- #region Methods
- /// <summary>
- /// Queues a PeerMessage up to be sent to the remote host
- /// </summary>
- /// <param name="msg"></param>
- public void EnQueue(IPeerMessage msg)
- {
- sendQueue.Enqueue(msg);
- }
-
-
- /// <summary>
- /// Returns the PeerMessage at the head of the queue
- /// </summary>
- /// <returns></returns>
- public IPeerMessage DeQueue()
- {
- return sendQueue.Dequeue();
- }
-
-
- /// <summary>
- /// The length of the Message queue
- /// </summary>
- public int QueueLength
- {
- get { return this.sendQueue.Count; }
- }
-
-
- /// <summary>
- ///
- /// </summary>
- public void Dispose()
- {
- this.peerSocket.Close();
- }
-
- internal void Shutdown(SocketShutdown socketShutdown)
- {
- this.peerSocket.Shutdown(socketShutdown);
- }
-
- #endregion
-
-
- #region Async Methods
- internal void BeginSend(byte[] buffer, int offset, int count,
SocketFlags socketFlags, System.AsyncCallback asyncCallback, PeerConnectionID
id)
- {
- this.peerSocket.BeginSend(buffer, offset, count, socketFlags,
asyncCallback, id);
- }
-
- internal int EndSend(System.IAsyncResult result)
- {
- return this.peerSocket.EndSend(result);
- }
-
- internal void BeginReceive(byte[] buffer, int offset, int count,
SocketFlags socketFlags, System.AsyncCallback asyncCallback, PeerConnectionID
id)
- {
- this.peerSocket.BeginReceive(buffer, offset, count, socketFlags,
asyncCallback, id);
- }
-
- internal int EndReceive(System.IAsyncResult result)
- {
- return this.peerSocket.EndReceive(result);
- }
-
- internal void BeginConnect(IPEndPoint iPEndPoint, System.AsyncCallback
peerEndCreateConnection, PeerConnectionID id)
- {
- this.peerSocket.BeginConnect(iPEndPoint, peerEndCreateConnection,
id);
- }
-
- internal void EndConnect(System.IAsyncResult result)
- {
- this.peerSocket.EndConnect(result);
- }
-
- internal void Close()
- {
- this.peerSocket.Close();
- }
- #endregion
-
- }
-}
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionBase.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionBase.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionBase.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,190 +0,0 @@
-//
-// PeerConnectionBase.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System.Collections.Generic;
-using System.Net.Sockets;
-using System.Net;
-using MonoTorrent.Client.PeerMessages;
-using System;
-
-namespace MonoTorrent.Client
-{
- /// <summary>
- /// Holds the data for a connection to another peer
- /// </summary>
- public abstract class PeerConnectionBase : IDisposable
- {
- #region Member Variables
- /// <summary>
- /// The size of the send and recieve buffers. Defaults to 32bytes more
than my default request size.
- /// </summary>
- private static readonly int BufferSize = ((1 << 14) + 32);
-
-
- /// <summary>
- /// The total bytes to send from the buffer
- /// </summary>
- public int BytesToSend
- {
- get { return this.bytesToSend; }
- set { this.bytesToSend = value; }
- }
- private int bytesToSend;
-
-
- /// <summary>
- /// The total number of bytes sent from the current send buffer
- /// </summary>
- public int BytesSent
- {
- get { return this.bytesSent; }
- set { this.bytesSent = value; }
- }
- private int bytesSent;
-
-
- /// <summary>
- /// The total number of bytes recieved into the current recieve buffer
- /// </summary>
- public int BytesRecieved
- {
- get { return this.bytesRecieved; }
- set { this.bytesRecieved = value; }
- }
- private int bytesRecieved;
-
-
- /// <summary>
- /// The total number of bytes to receive
- /// </summary>
- public int BytesToRecieve
- {
- get { return this.bytesToRecieve; }
- set { this.bytesToRecieve = value; }
- }
- private int bytesToRecieve;
-
-
- /// <summary>
- /// This holds the peermessages waiting to be sent
- /// </summary>
- private Queue<IPeerMessage> sendQueue;
-
-
- internal byte[] recieveBuffer;
- internal byte[] sendBuffer;
-
-
- /// <summary>
- /// The endpoint where the remote host is
- /// </summary>
- public IPEndPoint PeerEndpoint
- {
- get { return this.peerEndpoint; }
- internal set { this.peerEndpoint = value; }
- }
- private IPEndPoint peerEndpoint;
-
-
- /// <summary>
- /// The connection Monitor for this peer
- /// </summary>
- public ConnectionMonitor Monitor
- {
- get { return this.monitor; }
- }
- private ConnectionMonitor monitor;
- #endregion
-
-
- #region Constructors
- /// <summary>
- /// Creates a new connection to the peer at the specified IPEndpoint
- /// </summary>
- /// <param name="peerEndpoint">The IPEndpoint to connect to</param>
- public PeerConnectionBase()
- {
- this.monitor = new ConnectionMonitor();
- this.sendQueue = new Queue<IPeerMessage>(4);
- this.sendBuffer = new byte[BufferSize];
- this.recieveBuffer = new byte[BufferSize];
- }
- #endregion
-
-
- #region Methods
- /// <summary>
- /// Queues a PeerMessage up to be sent to the remote host
- /// </summary>
- /// <param name="msg"></param>
- public void EnQueue(IPeerMessage msg)
- {
- sendQueue.Enqueue(msg);
- }
-
-
- /// <summary>
- /// Returns the PeerMessage at the head of the queue
- /// </summary>
- /// <returns></returns>
- public IPeerMessage DeQueue()
- {
- return sendQueue.Dequeue();
- }
-
-
- /// <summary>
- /// The length of the Message queue
- /// </summary>
- public int QueueLength
- {
- get { return this.sendQueue.Count; }
- }
- #endregion
-
-
- #region Async Methods
- internal abstract void BeginSend(byte[] buffer, int offset, int count,
SocketFlags socketFlags, System.AsyncCallback asyncCallback, PeerConnectionID
id);
-
- internal abstract int EndSend(System.IAsyncResult result);
-
- internal abstract void BeginReceive(byte[] buffer, int offset, int
count, SocketFlags socketFlags, System.AsyncCallback asyncCallback,
PeerConnectionID id);
-
- internal abstract int EndReceive(System.IAsyncResult result);
-
- internal abstract void BeginConnect(IPEndPoint iPEndPoint,
System.AsyncCallback peerEndCreateConnection, PeerConnectionID id);
-
- internal abstract void EndConnect(System.IAsyncResult result);
-
- public abstract void Dispose();
- #endregion
-
- }
-}
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionId.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionId.cs
2006-09-10 12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/PeerConnectionId.cs
2006-09-10 12:56:07 UTC (rev 65165)
@@ -1,129 +0,0 @@
-//
-// PeerConnectionId.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using MonoTorrent.Common;
-namespace MonoTorrent.Client
-{
- /// <summary>
- ///
- /// </summary>
- public class PeerConnectionID : IPeerConnectionID
- {
- #region Member Variables
- /// <summary>
- ///
- /// </summary>
- public ClientPeer Peer
- {
- get { return this.peer; }
- set { this.peer = value; }
- }
- private ClientPeer peer;
-
- /// <summary>
- ///
- /// </summary>
- public TorrentManager TorrentManager
- {
- get { return this.torrentManager; }
- set
- {
- this.torrentManager = value;
- this.peer.BitField = new BitField(value.Torrent.Pieces.Length);
- }
- }
- private TorrentManager torrentManager;
- #endregion
-
-
- #region Constructors
- /// <summary>
- /// Creates a new PeerConnectionID
- /// </summary>
- /// <param name="peer"></param>
- public PeerConnectionID(ClientPeer peer)
- {
- this.peer = peer;
- this.torrentManager = null;
- this.peer.BitField = null;
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="peer"></param>
- /// <param name="manager"></param>
- public PeerConnectionID(ClientPeer peer, TorrentManager manager)
- {
- this.peer = peer;
- this.torrentManager = manager;
- this.peer.BitField = new BitField(manager.Torrent.Pieces.Length);
- }
- #endregion
-
-
- #region Overridden Methods
- /// <summary>
- ///
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public override bool Equals(object obj)
- {
- PeerConnectionID id2 = obj as PeerConnectionID;
- if (id2 == null)
- return false;
-
- return (this.peer.Equals(id2.peer));
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public override int GetHashCode()
- {
- return this.peer.GetHashCode();
- }
- #endregion
-
-
- IPeer IPeerConnectionID.Peer
- {
- get { return this.peer; }
- }
-
- ITorrentManager IPeerConnectionID.TorrentManager
- {
- get { return this.torrentManager; }
- }
- }
-}
\ No newline at end of file
Deleted: branches/BitSharp/bitsharp/src/MonoTorrent.Client/Peers.cs
===================================================================
--- branches/BitSharp/bitsharp/src/MonoTorrent.Client/Peers.cs 2006-09-10
12:16:13 UTC (rev 65164)
+++ branches/BitSharp/bitsharp/src/MonoTorrent.Client/Peers.cs 2006-09-10
12:56:07 UTC (rev 65165)
@@ -1,142 +0,0 @@
-//
-// Peers.cs
-//
-// Authors:
-// Alan McGovern [EMAIL PROTECTED]
-//
-// Copyright (C) 2006 Alan McGovern
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-
-using System.Collections.Generic;
-
-using MonoTorrent.Common;
-
-namespace MonoTorrent.Client
-{
- /// <summary>
- /// Represents a list of Peers that can be downloaded from
- /// </summary>
- public class Peers
- {
- #region Member Variables
- private List<PeerConnectionID> peerList;
- #endregion
-
-
- #region Constructors
- /// <summary>
- /// Creates a new Peer list
- /// </summary>
- public Peers()
- : this(16)
- {
- }
-
-
- /// <summary>
- /// Creates a new Peer list
- /// </summary>
- /// <param name="capacity">The initial capacity of the list</param>
- public Peers(int capacity)
- {
- this.peerList = new List<PeerConnectionID>(capacity);
- }
- #endregion
-
-
- #region Methods
- /// <summary>
- /// Returns the PeerConnectionID at the specified index
- /// </summary>
- /// <param name="index">The index of the PeerConnectionID to
return</param>
- /// <returns></returns>
- public PeerConnectionID this[int index]
- {
- get { return this.peerList[index]; }
- set { this.peerList[index] = value; }
- }
-
-
- /// <summary>
- /// Adds a peer to the PeerConnectionID
- /// </summary>
- /// <param name="peer">The peer to add</param>
- public void Add(PeerConnectionID peer)
- {
- this.peerList.Add(peer);
- }
-
-
- /// <summary>
- /// Removes the PeerConnectionID at the specified index
- /// </summary>
- /// <param name="index">The index to remove the PeerConnectionID
at</param>
- public void Remove(int index)
- {
- this.peerList.RemoveAt(index);
- }
-
-
- /// <summary>
- /// Removes the supplied PeerConnectionID from the list
- /// </summary>
- /// <param name="id">The PeerConnectionID to remove</param>
- /// <returns>True if the PeerConnectionID was removed</returns>
- public bool Remove(PeerConnectionID id)
- {
- return this.peerList.Remove(id);
- }
-
-
- /// <summary>
- /// Returns the number of Peers in the list
- /// </summary>
- public int Count
- {
- get { return this.peerList.Count; }
- }
-
-
- /// <summary>
- /// Checks if the specified PeerConnectionID is in the list
- /// </summary>
- /// <param name="peer">The PeerConnectionID to search for</param>
- /// <returns>True if the PeerConnectionID was found, false
otherwise</returns>
- public bool Contains(PeerConnectionID peer)
- {
- return (this.peerList.Contains(peer));
- }
-
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public List<PeerConnectionID>.Enumerator GetEnumerator()
- {
- return this.peerList.GetEnumerator();
- }
- #endregion
- }
-}
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches