always pass data accept test in distant chat when we are on the client side of the tunnel

This commit is contained in:
csoler 2016-04-10 21:09:47 -04:00
parent c97f197b7e
commit b148239e4f
4 changed files with 11 additions and 4 deletions

View file

@ -349,6 +349,7 @@ void p3GxsTunnelService::handleRecvTunnelDataItem(const RsGxsTunnelId& tunnel_id
RsGxsTunnelClientService *service = NULL ;
RsGxsId peer_from ;
bool is_client_side = false ;
{
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
@ -367,6 +368,7 @@ void p3GxsTunnelService::handleRecvTunnelDataItem(const RsGxsTunnelId& tunnel_id
{
it2->second.client_services.insert(item->service_id) ;
peer_from = it2->second.to_gxs_id ;
is_client_side = (it2->second.direction == RsTurtleGenericDataItem::DIRECTION_CLIENT);
}
// Check if the item has already been received. This is necessary because we actually re-send items until an ACK is received. If the ACK gets lost (connection interrupted) the
@ -380,7 +382,7 @@ void p3GxsTunnelService::handleRecvTunnelDataItem(const RsGxsTunnelId& tunnel_id
it2->second.received_data_prints[item->unique_item_counter] = time(NULL) ;
}
if(service->acceptDataFromPeer(peer_from,tunnel_id))
if(service->acceptDataFromPeer(peer_from,tunnel_id,is_client_side))
service->receiveData(tunnel_id,item->data,item->data_size) ;
item->data = NULL ; // avoids deletion, since the client has the memory now
@ -1474,6 +1476,7 @@ bool p3GxsTunnelService::getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelI
info.tunnel_status = it->second.status;
info.total_size_sent = it->second.total_sent;
info.total_size_received= it->second.total_received;
info.is_client_side = (it->second.direction == RsTurtleGenericTunnelItem::DIRECTION_CLIENT);
// Data packets