mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 12:24:24 -04:00
* Disabled personal signatures on Channel Messages.
* Made "ConnectCallback" more accurate. * Improved DHT display slightly. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3606 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0ea899de29
commit
5321c35d30
3 changed files with 53 additions and 14 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "dht/p3bitdht.h"
|
#include "dht/p3bitdht.h"
|
||||||
|
|
||||||
#include "bitdht/bdstddht.h"
|
#include "bitdht/bdstddht.h"
|
||||||
|
#include "pqi/p3connmgr.h"
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
|
@ -404,6 +405,8 @@ int p3BitDht::removeTranslation(const std::string pid)
|
||||||
|
|
||||||
|
|
||||||
/********************** Callback Functions **************************/
|
/********************** Callback Functions **************************/
|
||||||
|
uint32_t translatebdcbflgs(uint32_t peerflags);
|
||||||
|
|
||||||
int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_BITDHT
|
#ifdef DEBUG_BITDHT
|
||||||
|
@ -437,26 +440,27 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||||
if (lookupRsId(&(id->id), pid))
|
if (lookupRsId(&(id->id), pid))
|
||||||
{
|
{
|
||||||
/* we found it ... do callback to p3connmgr */
|
/* we found it ... do callback to p3connmgr */
|
||||||
//uint32_t cbflags = ONLINE | UNREACHABLE;
|
|
||||||
|
|
||||||
std::cerr << "p3BitDht::NodeCallback() FOUND NODE!!!: ";
|
std::cerr << "p3BitDht::NodeCallback() FOUND NODE!!!: ";
|
||||||
bdStdPrintNodeId(std::cerr, &(id->id));
|
bdStdPrintNodeId(std::cerr, &(id->id));
|
||||||
std::cerr << "-> " << pid << " flags: " << peerflags;
|
std::cerr << "-> " << pid << " flags: " << peerflags;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
/* send status info to p3connmgr */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pqiIpAddress dhtpeer;
|
||||||
|
dhtpeer.mSrc = RS_CB_DHT;
|
||||||
|
dhtpeer.mSeenTime = time(NULL);
|
||||||
|
dhtpeer.mAddr = id->addr;
|
||||||
|
|
||||||
/* add address to set */
|
|
||||||
pqiIpAddrSet addrs;
|
pqiIpAddrSet addrs;
|
||||||
pqiIpAddress addr;
|
addrs.updateExtAddrs(dhtpeer);
|
||||||
|
|
||||||
addr.mAddr = id->addr;
|
uint32_t type = RS_NET_CONN_UDP_DHT_SYNC;
|
||||||
addr.mSeenTime = time(NULL);
|
uint32_t flags = translatebdcbflgs(peerflags);
|
||||||
addr.mSrc = 0;
|
uint32_t source = RS_CB_DHT;
|
||||||
|
|
||||||
addrs.updateExtAddrs(addr);
|
mConnCb->peerStatus(pid, addrs, type, flags, source);
|
||||||
int type = 0;
|
|
||||||
|
|
||||||
/* callback to say they are online */
|
|
||||||
mConnCb->peerStatus(pid, addrs, type, 0, RS_CB_DHT);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -469,6 +473,33 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
uint32_t translatebdcbflgs(uint32_t peerflags)
|
||||||
|
{
|
||||||
|
uint32_t outflags = 0;
|
||||||
|
outflags |= RS_NET_FLAGS_ONLINE;
|
||||||
|
return outflags;
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
// The input flags.
|
||||||
|
#define BITDHT_PEER_STATUS_RECV_PONG 0x00000001
|
||||||
|
#define BITDHT_PEER_STATUS_RECV_NODES 0x00000002
|
||||||
|
#define BITDHT_PEER_STATUS_RECV_HASHES 0x00000004
|
||||||
|
|
||||||
|
#define BITDHT_PEER_STATUS_DHT_ENGINE 0x00000100
|
||||||
|
#define BITDHT_PEER_STATUS_DHT_APPL 0x00000200
|
||||||
|
#define BITDHT_PEER_STATUS_DHT_VERSION 0x00000400
|
||||||
|
|
||||||
|
if (peerflags & ONLINE)
|
||||||
|
{
|
||||||
|
outflags |= RS_NET_FLAGS_ONLINE;
|
||||||
|
}
|
||||||
|
if (peerflags & ONLINE)
|
||||||
|
{
|
||||||
|
outflags |= RS_NET_FLAGS_EXTERNAL_ADDR | RS_NET_FLAGS_STABLE_UDP;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int p3BitDht::PeerCallback(const bdNodeId *id, uint32_t status)
|
int p3BitDht::PeerCallback(const bdNodeId *id, uint32_t status)
|
||||||
{
|
{
|
||||||
|
|
|
@ -403,7 +403,10 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
autostr << "DHT:SEARCHING ";
|
if (!(pcs.state & RS_PEER_S_CONNECTED))
|
||||||
|
{
|
||||||
|
autostr << "DHT:SEARCHING ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcs.inConnAttempt)
|
if (pcs.inConnAttempt)
|
||||||
|
|
|
@ -278,7 +278,12 @@ bool p3Channels::ChannelMessageSend(ChannelMsgInfo &info)
|
||||||
cmsg->thumbnail.image_type = 0;
|
cmsg->thumbnail.image_type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string msgId = publishMsg(cmsg, true);
|
bool toSign = false;
|
||||||
|
// Channels are not personally signed yet... (certainly not by default!).
|
||||||
|
// This functionality can easily be added once its available in the gui + API.
|
||||||
|
// should check the GroupFlags for default.
|
||||||
|
|
||||||
|
std::string msgId = publishMsg(cmsg, toSign);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue