mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added in RsItem a new virtual method queueType() that returns the type of the queue to
use for handling the packet: RsItem::DATA_QUEUE for data and RsItem::CONTROL_QUEUE for control packets, to be used in pqistreamer. Up to now, File data chunks where the only packets that were going into the --less prioritized-- data queue. Now, the default in RsItem::queueType() being to return CONTROL_QUEUE, developpers can choose which queue t use by simply overloading this method so that it returns a different value. The first use of this was to make generic turtle tunnel packets use the data queue instead of the control queuem, which restores a correct balance between turtle downloads and friends downloads. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3153 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
347c80fb1e
commit
95c5c4b1a1
@ -321,9 +321,17 @@ int pqistreamer::queue_outpqi(RsItem *pqi)
|
||||
}
|
||||
|
||||
/* decide which type of packet it is */
|
||||
RsFileData *dta = dynamic_cast<RsFileData *>(pqi);
|
||||
RsFileData *dta = dynamic_cast<RsFileData *>(pqi); // This is the old test method
|
||||
bool isCntrl = (dta == NULL);
|
||||
|
||||
if(pqi->queueType() == RsItem::DATA_QUEUE) // this is the new test method. More general.
|
||||
{
|
||||
#ifdef DEBUG_PQISTREAMER
|
||||
std::cerr << "PQISTREAMER:: got a data queue packet !!" << std::endl ;
|
||||
#endif
|
||||
isCntrl = false ;
|
||||
}
|
||||
|
||||
uint32_t pktsize = rsSerialiser->size(pqi);
|
||||
void *ptr = malloc(pktsize);
|
||||
|
||||
|
@ -92,6 +92,9 @@ uint8_t PacketSubType();
|
||||
RsItem(uint8_t ver, uint16_t service, uint8_t subtype);
|
||||
uint16_t PacketService(); /* combined Packet class/type (mid 16bits) */
|
||||
|
||||
typedef enum { CONTROL_QUEUE, DATA_QUEUE } QueueType ;
|
||||
virtual QueueType queueType() const { return CONTROL_QUEUE ; }
|
||||
|
||||
private:
|
||||
uint32_t type;
|
||||
std::string peerId;
|
||||
@ -164,7 +167,8 @@ class RsRawItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsRawItem(uint32_t t, uint32_t size)
|
||||
:RsItem(t), len(size) { data = malloc(len);}
|
||||
:RsItem(t), len(size), _queue_type(RsItem::CONTROL_QUEUE)
|
||||
{ data = malloc(len);}
|
||||
|
||||
virtual ~RsRawItem()
|
||||
{
|
||||
@ -180,9 +184,13 @@ void * getRawData() { return data; }
|
||||
virtual void clear() { return; } /* what can it do? */
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
virtual RsItem::QueueType queueType() const { return _queue_type ;}
|
||||
void setQueueType(const RsItem::QueueType& t) { _queue_type = t ;}
|
||||
|
||||
private:
|
||||
void *data;
|
||||
uint32_t len;
|
||||
RsItem::QueueType _queue_type ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -198,6 +198,7 @@ RsRawItem *p3Service::send()
|
||||
if (raw)
|
||||
{
|
||||
raw->PeerId(si->PeerId());
|
||||
raw->setQueueType(si->queueType()) ;
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
|
@ -174,6 +174,9 @@ class RsTurtleGenericTunnelItem: public RsTurtleItem
|
||||
/// requests are server packets, whereas file data are client packets.
|
||||
|
||||
virtual Direction travelingDirection() const = 0 ;
|
||||
|
||||
/// Generic tunnel items (such as file data) are added into the data queue
|
||||
virtual RsItem::QueueType queueType() const { return RsItem::DATA_QUEUE ; }
|
||||
};
|
||||
|
||||
/***********************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user