libktorrent  2.1.1
Classes | Public Types | Public Member Functions | Friends | List of all members
utp::Connection Class Reference

#include <connection.h>

Inheritance diagram for utp::Connection:
Inheritance graph
[legend]

Classes

struct  Stats
 
class  TransmissionError
 Thrown when a transmission error occurs, server should kill the connection if it happens. More...
 

Public Types

typedef QSharedPointer< ConnectionPtr
 
enum  Type { INCOMING, OUTGOING }
 
typedef QWeakPointer< ConnectionWPtr
 

Public Member Functions

 Connection (bt::Uint16 recv_connection_id, Type type, const net::Address &remote, Transmitter *transmitter)
 
bool allDataSent () const
 Is all data sent.
 
bt::Uint32 bytesAvailable () const
 Get the number of bytes available.
 
void checkTimeout (const TimeValue &now)
 Check if we haven't hit a timeout yet.
 
void close ()
 Close the socket.
 
ConnectionState connectionState () const
 Get the connection state.
 
const StatsconnectionStats () const
 Get the connection stats.
 
Type connectionType () const
 Get the type of connection.
 
bt::Uint32 currentTimeout () const override
 Get the current timeout.
 
void dumpStats ()
 Dump connection stats.
 
ConnectionState handlePacket (const PacketParser &parser, bt::Buffer::Ptr packet)
 Handle a single packet.
 
bool isWriteable () const
 Can we write to this socket.
 
bt::Uint16 receiveConnectionID () const
 Get the receive connection id.
 
int recv (bt::Uint8 *buf, bt::Uint32 max_len)
 Read available data from local window, returns the amount of bytes read.
 
const net::AddressremoteAddress () const
 Get the remote address.
 
void reset ()
 Reset the connection.
 
void retransmit (PacketBuffer &packet, bt::Uint16 p_seq_nr) override
 Retransmit a packet.
 
int send (const bt::Uint8 *data, bt::Uint32 len)
 Send some data, returns the amount of bytes sent (or -1 on error)
 
void setBlocking (bool on)
 Turn on or off blocking mode.
 
void setWeakPointer (WPtr ptr)
 Set a weak pointer to self.
 
void startConnecting ()
 Start connecting (OUTGOING only)
 
void updateRTT (const Header *hdr, bt::Uint32 packet_rtt, bt::Uint32 packet_size) override
 Update the RTT time.
 
bool waitForData (bt::Uint32 timeout=0)
 Wait until there is data ready or the socket is closed or a timeout occurs.
 
bool waitUntilConnected ()
 Wait until the connectTo call fails or succeeds.
 

Friends

class UTPServer
 

Detailed Description

Keeps track of a single UTP connection

Definition at line 67 of file connection.h.


The documentation for this class was generated from the following file: