mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 09:57:19 -05:00
fixed wrong usage of local client ids in global router causing distant messages to stay in outbox forever.
This commit is contained in:
parent
4484b08b50
commit
9651f430d5
@ -1184,15 +1184,17 @@ void p3GRouter::autoWash()
|
|||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
grouter_debug() << " Removing cached item " << std::hex << it->first << std::dec << std::endl;
|
grouter_debug() << " Removing cached item " << std::hex << it->first << std::dec << std::endl;
|
||||||
#endif
|
#endif
|
||||||
GRouterClientService *client = NULL ;
|
//GRouterClientService *client = NULL ;
|
||||||
GRouterServiceId service_id = 0;
|
//GRouterServiceId service_id = 0;
|
||||||
|
|
||||||
if( it->second.data_status != RS_GROUTER_DATA_STATUS_DONE )
|
if( it->second.data_status != RS_GROUTER_DATA_STATUS_DONE )
|
||||||
{
|
{
|
||||||
if(!locked_getClientAndServiceId(it->second.tunnel_hash,it->second.data_item->destination_key,client,service_id))
|
GRouterClientService *client = NULL;
|
||||||
std::cerr << " ERROR: cannot find client for cancelled message " << it->first << std::endl;
|
|
||||||
|
if(locked_getLocallyRegisteredClientFromServiceId(it->second.client_id,client))
|
||||||
|
failed_msgs[it->first] = client ;
|
||||||
else
|
else
|
||||||
failed_msgs[it->first] = client;
|
std::cerr << " ERROR: client id " << it->second.client_id << " not registered. Consistency error." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete it->second.data_item ;
|
delete it->second.data_item ;
|
||||||
@ -1411,7 +1413,7 @@ void p3GRouter::handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_it
|
|||||||
#endif
|
#endif
|
||||||
it->second.data_status = RS_GROUTER_DATA_STATUS_DONE;
|
it->second.data_status = RS_GROUTER_DATA_STATUS_DONE;
|
||||||
|
|
||||||
if(locked_getClientAndServiceId(it->second.tunnel_hash,it->second.data_item->destination_key,client_service,service_id))
|
if(locked_getLocallyRegisteredClientFromServiceId(it->second.client_id,client_service))
|
||||||
mid = it->first ;
|
mid = it->first ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1604,6 +1606,7 @@ void p3GRouter::handleIncomingDataItem(RsGRouterGenericDataItem *data_item)
|
|||||||
info.receipt_item = receipt_item ; // inited before, or NULL.
|
info.receipt_item = receipt_item ; // inited before, or NULL.
|
||||||
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
||||||
info.last_sent_TS = 0 ;
|
info.last_sent_TS = 0 ;
|
||||||
|
info.client_id = data_item->service_id ;
|
||||||
info.item_hash = item_hash ;
|
info.item_hash = item_hash ;
|
||||||
info.last_tunnel_request_TS = 0 ;
|
info.last_tunnel_request_TS = 0 ;
|
||||||
info.sending_attempts = 0 ;
|
info.sending_attempts = 0 ;
|
||||||
@ -1680,25 +1683,9 @@ void p3GRouter::handleIncomingDataItem(RsGRouterGenericDataItem *data_item)
|
|||||||
IndicateConfigChanged() ;
|
IndicateConfigChanged() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GRouter::locked_getClientAndServiceId(const TurtleFileHash& hash, const RsGxsId& destination_key, GRouterClientService *& client, GRouterServiceId& service_id)
|
bool p3GRouter::locked_getLocallyRegisteredClientFromServiceId(const GRouterServiceId& service_id,GRouterClientService *& client)
|
||||||
{
|
{
|
||||||
client = NULL ;
|
client = NULL ;
|
||||||
service_id = 0;
|
|
||||||
RsGxsId gxs_id ;
|
|
||||||
|
|
||||||
if(!locked_getGxsIdAndClientId(hash,gxs_id,service_id))
|
|
||||||
{
|
|
||||||
std::cerr << " p3GRouter::ERROR: locked_getGxsIdAndClientId(): no key registered for hash " << hash << std::endl;
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gxs_id != destination_key)
|
|
||||||
{
|
|
||||||
std::cerr << " ERROR: verification (destination) GXS key " << destination_key << " does not match key from hash " << gxs_id << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// now find the client given its id.
|
|
||||||
|
|
||||||
std::map<GRouterServiceId,GRouterClientService*>::const_iterator its = _registered_services.find(service_id) ;
|
std::map<GRouterServiceId,GRouterClientService*>::const_iterator its = _registered_services.find(service_id) ;
|
||||||
|
|
||||||
@ -1981,6 +1968,7 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
|
|||||||
info.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
info.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
||||||
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
||||||
info.last_sent_TS = 0 ;
|
info.last_sent_TS = 0 ;
|
||||||
|
info.client_id = client_id ;
|
||||||
info.last_tunnel_request_TS = 0 ;
|
info.last_tunnel_request_TS = 0 ;
|
||||||
info.item_hash = computeDataItemHash(data_item) ;
|
info.item_hash = computeDataItemHash(data_item) ;
|
||||||
info.sending_attempts = 0 ;
|
info.sending_attempts = 0 ;
|
||||||
@ -2029,7 +2017,8 @@ Sha1CheckSum p3GRouter::makeTunnelHash(const RsGxsId& destination,const GRouterS
|
|||||||
|
|
||||||
return RsDirUtil::sha1sum(bytes,20) ;
|
return RsDirUtil::sha1sum(bytes,20) ;
|
||||||
}
|
}
|
||||||
bool p3GRouter::locked_getGxsIdAndClientId(const TurtleFileHash& sum,RsGxsId& gxs_id,GRouterServiceId& client_id)
|
#ifdef TO_REMOVE
|
||||||
|
bool p3GRouter::locked_getGxsOwnIdAndClientIdFromHash(const TurtleFileHash& sum,RsGxsId& gxs_id,GRouterServiceId& client_id)
|
||||||
{
|
{
|
||||||
assert( gxs_id.SIZE_IN_BYTES == 16) ;
|
assert( gxs_id.SIZE_IN_BYTES == 16) ;
|
||||||
assert(Sha1CheckSum::SIZE_IN_BYTES == 20) ;
|
assert(Sha1CheckSum::SIZE_IN_BYTES == 20) ;
|
||||||
@ -2047,6 +2036,7 @@ bool p3GRouter::locked_getGxsIdAndClientId(const TurtleFileHash& sum,RsGxsId& gx
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
bool p3GRouter::loadList(std::list<RsItem*>& items)
|
bool p3GRouter::loadList(std::list<RsItem*>& items)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -2211,6 +2201,7 @@ void p3GRouter::debugDump()
|
|||||||
for(std::map<Sha1CheckSum, GRouterPublishedKeyInfo>::const_iterator it(_owned_key_ids.begin());it!=_owned_key_ids.end();++it)
|
for(std::map<Sha1CheckSum, GRouterPublishedKeyInfo>::const_iterator it(_owned_key_ids.begin());it!=_owned_key_ids.end();++it)
|
||||||
{
|
{
|
||||||
grouter_debug() << " Hash : " << it->first << std::endl;
|
grouter_debug() << " Hash : " << it->first << std::endl;
|
||||||
|
grouter_debug() << " Key : " << it->second.authentication_key << std::endl;
|
||||||
grouter_debug() << " Service id : " << std::hex << it->second.service_id << std::dec << std::endl;
|
grouter_debug() << " Service id : " << std::hex << it->second.service_id << std::dec << std::endl;
|
||||||
grouter_debug() << " Description : " << it->second.description_string << std::endl;
|
grouter_debug() << " Description : " << it->second.description_string << std::endl;
|
||||||
}
|
}
|
||||||
@ -2226,15 +2217,17 @@ void p3GRouter::debugDump()
|
|||||||
|
|
||||||
for(std::map<GRouterMsgPropagationId, GRouterRoutingInfo>::iterator it(_pending_messages.begin());it!=_pending_messages.end();++it)
|
for(std::map<GRouterMsgPropagationId, GRouterRoutingInfo>::iterator it(_pending_messages.begin());it!=_pending_messages.end();++it)
|
||||||
{
|
{
|
||||||
grouter_debug() << " Msg id : " << std::hex << it->first << std::dec ;
|
grouter_debug() << " Msg id: " << std::hex << it->first << std::dec ;
|
||||||
grouter_debug() << " data hash : " << it->second.item_hash ;
|
grouter_debug() << " data hash: " << it->second.item_hash ;
|
||||||
grouter_debug() << " Destination : " << it->second.data_item->destination_key ;
|
grouter_debug() << " client id: " << std::hex << it->second.client_id << std::dec;
|
||||||
grouter_debug() << " Received : " << now - it->second.received_time_TS << " secs ago.";
|
grouter_debug() << " Flags: " << std::hex << it->second.routing_flags << std::dec;
|
||||||
grouter_debug() << " Last sent : " << now - it->second.last_sent_TS << " secs ago.";
|
grouter_debug() << " Destination: " << it->second.data_item->destination_key ;
|
||||||
grouter_debug() << " Transaction TS : " << now - it->second.data_transaction_TS << " secs ago.";
|
grouter_debug() << " Received: " << now - it->second.received_time_TS << " secs ago.";
|
||||||
grouter_debug() << " Data Status : " << statusString[it->second.data_status] << std::endl;
|
grouter_debug() << " Last sent: " << now - it->second.last_sent_TS << " secs ago.";
|
||||||
grouter_debug() << " Tunl Status : " << statusString[it->second.tunnel_status] << std::endl;
|
grouter_debug() << " Transaction TS: " << now - it->second.data_transaction_TS << " secs ago.";
|
||||||
grouter_debug() << " Receipt ok : " << (it->second.receipt_item != NULL) << std::endl;
|
grouter_debug() << " Data Status: " << statusString[it->second.data_status] << std::endl;
|
||||||
|
grouter_debug() << " Tunl Status: " << statusString[it->second.tunnel_status] << std::endl;
|
||||||
|
grouter_debug() << " Receipt ok: " << (it->second.receipt_item != NULL) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
grouter_debug() << " Tunnels: " << std::endl;
|
grouter_debug() << " Tunnels: " << std::endl;
|
||||||
|
@ -252,8 +252,7 @@ private:
|
|||||||
void handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_item) ;
|
void handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_item) ;
|
||||||
void handleIncomingDataItem(RsGRouterGenericDataItem *data_item) ;
|
void handleIncomingDataItem(RsGRouterGenericDataItem *data_item) ;
|
||||||
|
|
||||||
bool locked_getClientAndServiceId(const TurtleFileHash& hash, const RsGxsId& destination_key, GRouterClientService *& client, GRouterServiceId& service_id);
|
bool locked_getLocallyRegisteredClientFromServiceId(const GRouterServiceId& service_id,GRouterClientService *& client);
|
||||||
|
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
//
|
//
|
||||||
@ -270,7 +269,7 @@ private:
|
|||||||
|
|
||||||
static Sha1CheckSum makeTunnelHash(const RsGxsId& destination,const GRouterServiceId& client);
|
static Sha1CheckSum makeTunnelHash(const RsGxsId& destination,const GRouterServiceId& client);
|
||||||
|
|
||||||
bool locked_getGxsIdAndClientId(const TurtleFileHash &sum,RsGxsId& gxs_id,GRouterServiceId& client_id);
|
//bool locked_getGxsIdAndClientId(const TurtleFileHash &sum,RsGxsId& gxs_id,GRouterServiceId& client_id);
|
||||||
bool locked_sendTransactionData(const RsPeerId& pid,const RsGRouterTransactionItem& item);
|
bool locked_sendTransactionData(const RsPeerId& pid,const RsGRouterTransactionItem& item);
|
||||||
|
|
||||||
void locked_collectAvailableFriends(const GRouterKeyId &gxs_id,std::list<RsPeerId>& friend_peers, const std::set<RsPeerId>& incoming_routes,bool is_origin);
|
void locked_collectAvailableFriends(const GRouterKeyId &gxs_id,std::list<RsPeerId>& friend_peers, const std::set<RsPeerId>& incoming_routes,bool is_origin);
|
||||||
|
Loading…
Reference in New Issue
Block a user