mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-22 05:14:31 -04:00
fixed bug in serialization for turtle
This commit is contained in:
parent
636450f14d
commit
121133488c
15 changed files with 19 additions and 18 deletions
|
@ -109,7 +109,7 @@ uint32_t RsTurtleGenericDataItem::serial_size() const
|
|||
//
|
||||
// ---------------------------------- Serialization ----------------------------------//
|
||||
//
|
||||
RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype)
|
||||
RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype) const
|
||||
{
|
||||
if (RS_SERVICE_TYPE_TURTLE != service)
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ RsItem *RsTurtleSerialiser::create_item(uint16_t service,uint8_t item_subtype)
|
|||
RsItem *item = NULL ;
|
||||
|
||||
for(uint32_t i=0;i<_client_services.size();++i)
|
||||
if((item = _client_services[i]->create_item(service,item_subtype)) != NULL)
|
||||
if((_client_services[i]->serializer() != NULL) && (item = _client_services[i]->serializer()->create_item(service,item_subtype)) != NULL)
|
||||
return item ;
|
||||
|
||||
std::cerr << "Unknown packet type in RsTurtle (not even handled by client services)!" << std::endl ;
|
||||
|
|
|
@ -23,11 +23,12 @@ const uint8_t RS_TURTLE_SUBTYPE_REGEXP_SEARCH_REQUEST = 0x09 ;
|
|||
const uint8_t RS_TURTLE_SUBTYPE_GENERIC_DATA = 0x0a ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP = 0x10 ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_FILE_MAP_REQUEST = 0x11 ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC = 0x14 ;
|
||||
const uint8_t RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST = 0x15 ;
|
||||
|
||||
// const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC = 0x12 ; // unused
|
||||
// const uint8_t RS_TURTLE_SUBTYPE_FILE_CRC_REQUEST = 0x13 ;
|
||||
|
||||
/***********************************************************************************/
|
||||
/* Basic Turtle Item Class */
|
||||
/***********************************************************************************/
|
||||
|
@ -209,7 +210,7 @@ class RsTurtleSerialiser: public RsSerializer
|
|||
public:
|
||||
RsTurtleSerialiser() : RsSerializer(RS_SERVICE_TYPE_TURTLE) {}
|
||||
|
||||
virtual RsItem *create_item(uint16_t service,uint8_t item_subtype);
|
||||
virtual RsItem *create_item(uint16_t service,uint8_t item_subtype) const;
|
||||
|
||||
// This is used by the turtle router to add services to its serialiser.
|
||||
// Client services are only used for deserialising, since the serialisation is
|
||||
|
|
|
@ -76,7 +76,7 @@ class RsTurtleClientService
|
|||
// services might only use the generic item already provided by the turtle
|
||||
// router: RsTurtleGenericDataItem
|
||||
|
||||
virtual RsTurtleGenericTunnelItem *create_item(uint16_t service,uint8_t item_type) const { return NULL ; }
|
||||
virtual RsSerializer *serializer() { return NULL ; }
|
||||
|
||||
// These methods are called by the turtle router to add/remove virtual peers when tunnels are created/deleted
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue