libktorrent  2.2.0
Public Member Functions | List of all members
bt::PacketReader Class Reference

#include <packetreader.h>

Inheritance diagram for bt::PacketReader:
Inheritance graph
[legend]

Public Member Functions

 PacketReader (Uint32 max_packet_size)
 
bool ok () const
 Did an error occur.
 
void onDataReady (Uint8 *buf, Uint32 size) override
 
void update (PeerInterface &peer)
 

Detailed Description

Chops up the raw byte stream from a socket into bittorrent packets

Author
Joris Guisson

Definition at line 66 of file packetreader.h.

Member Function Documentation

◆ onDataReady()

void bt::PacketReader::onDataReady ( Uint8 *  buf,
Uint32  size 
)
overridevirtual

Function which will be called whenever data has been read from the socket. This data should be dealt with, otherwise it will be discarded.

Parameters
bufThe buffer
sizeThe size of the buffer

Implements net::SocketReader.

◆ update()

void bt::PacketReader::update ( PeerInterface peer)

Push packets to Peer (runs in main thread)

Parameters
peerThe PeerInterface which will handle the packet

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