diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 844dac7fd..5ed51dc84 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -48,7 +48,7 @@ #define GXS_MASK "GXS_MASK_HACK" -#define GEN_EXCH_DEBUG 1 +//#define GEN_EXCH_DEBUG 1 #define MSG_CLEANUP_PERIOD 60*5 // 5 minutes #define INTEGRITY_CHECK_PERIOD 60*30 // 30 minutes diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index 1a4e1a86b..be52966bd 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -1086,21 +1086,25 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions& bool addMsg = false; if (oit == origMsgTs.end()) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgList() Found New OrigMsgId: "; std::cerr << msgMeta->mOrigMsgId; std::cerr << " MsgId: " << msgMeta->mMsgId; std::cerr << " TS: " << msgMeta->mPublishTs; std::cerr << std::endl; +#endif addMsg = true; } // check timestamps. else if (oit->second.second < msgMeta->mPublishTs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgList() Found Later Msg. OrigMsgId: "; std::cerr << msgMeta->mOrigMsgId; std::cerr << " MsgId: " << msgMeta->mMsgId; std::cerr << " TS: " << msgMeta->mPublishTs; +#endif addMsg = true; } @@ -1177,9 +1181,10 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req) * Input is msgList + Flags. * 1) No Flags => return nothing */ - +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList()"; std::cerr << std::endl; +#endif const RsTokReqOptions& opts = req->Options; @@ -1190,67 +1195,85 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req) if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_LATEST"; std::cerr << std::endl; +#endif onlyLatestMsgs = true; } else if (opts.mOptions & RS_TOKREQOPT_MSG_VERSIONS) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_VERSIONS"; std::cerr << std::endl; +#endif onlyAllVersions = true; } if (opts.mOptions & RS_TOKREQOPT_MSG_PARENT) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_PARENTS"; std::cerr << std::endl; +#endif onlyChildMsgs = true; } if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_THREAD"; std::cerr << std::endl; +#endif onlyThreadMsgs = true; } if (onlyAllVersions && onlyChildMsgs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & PARENT)"; std::cerr << std::endl; +#endif return false; } if (onlyAllVersions && onlyThreadMsgs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & THREAD)"; std::cerr << std::endl; +#endif return false; } if ((!onlyLatestMsgs) && onlyChildMsgs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & PARENT)"; std::cerr << std::endl; +#endif return false; } if ((!onlyLatestMsgs) && onlyThreadMsgs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & THREAD)"; std::cerr << std::endl; +#endif return false; } if (onlyChildMsgs && onlyThreadMsgs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (PARENT & THREAD)"; std::cerr << std::endl; +#endif return false; } @@ -1259,8 +1282,10 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req) /* FALL BACK OPTION */ if ((!onlyLatestMsgs) && (!onlyAllVersions) && (!onlyChildMsgs) && (!onlyThreadMsgs)) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() FALLBACK -> NO FLAGS -> SIMPLY RETURN nothing"; std::cerr << std::endl; +#endif return true; } @@ -1302,8 +1327,10 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req) if(!origMeta) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedInfo(): Cannot find meta of msgId (to relate to)!" << std::endl; +#endif cleanseMsgMetaMap(result); return false; } @@ -1345,21 +1372,25 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req) bool addMsg = false; if (oit == origMsgTs.end()) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() Found New OrigMsgId: "; std::cerr << meta->mOrigMsgId; std::cerr << " MsgId: " << meta->mMsgId; std::cerr << " TS: " << meta->mPublishTs; std::cerr << std::endl; +#endif addMsg = true; } // check timestamps. else if (oit->second.second < meta->mPublishTs) { +#ifdef DATA_DEBUG std::cerr << "RsGxsDataAccess::getMsgRelatedList() Found Later Msg. OrigMsgId: "; std::cerr << meta->mOrigMsgId; std::cerr << " MsgId: " << meta->mMsgId; std::cerr << " TS: " << meta->mPublishTs; +#endif addMsg = true; } diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index 622a28d4c..d3c18e76e 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -68,7 +68,6 @@ const uint32_t PEER_IP_CONNECT_STATE_MAX_LIST_SIZE = 4; /**** * #define PEER_DEBUG 1 ***/ -#define PEER_DEBUG 1 #define MAX_AVAIL_PERIOD 230 //times a peer stay in available state when not connected #define MIN_RETRY_PERIOD 140 diff --git a/libretroshare/src/serialiser/rsgxsforumitems.cc b/libretroshare/src/serialiser/rsgxsforumitems.cc index 912275a96..731584b38 100644 --- a/libretroshare/src/serialiser/rsgxsforumitems.cc +++ b/libretroshare/src/serialiser/rsgxsforumitems.cc @@ -29,8 +29,7 @@ #include "serialiser/rstlvbase.h" #include "serialiser/rsbaseserial.h" -#define GXSFORUM_DEBUG 1 - +//#define GXSFORUM_DEBUG 1 uint32_t RsGxsForumSerialiser::size(RsItem *item) { diff --git a/libretroshare/src/serialiser/rstlvgenericmap.inl b/libretroshare/src/serialiser/rstlvgenericmap.inl index 35ddbbb13..7b852bf0a 100644 --- a/libretroshare/src/serialiser/rstlvgenericmap.inl +++ b/libretroshare/src/serialiser/rstlvgenericmap.inl @@ -26,7 +26,7 @@ // Must be different - as this is inline in headers. -#define TLV_GENERICMAP_DEBUG 1 +//#define TLV_GENERICMAP_DEBUG 1 /*********************************** RsTlvGenericPairRef ***********************************/ diff --git a/libretroshare/src/services/p3chatservice.cc b/libretroshare/src/services/p3chatservice.cc index dd7f17de7..383e08af7 100644 --- a/libretroshare/src/services/p3chatservice.cc +++ b/libretroshare/src/services/p3chatservice.cc @@ -57,8 +57,6 @@ * #define CHAT_DEBUG 1 * #define DEBUG_DISTANT_CHAT 1 ****/ -#define DEBUG_DISTANT_CHAT 1 -//#define CHAT_DEBUG 1 static const int CONNECTION_CHALLENGE_MAX_COUNT = 20 ; // sends a connection challenge every 20 messages static const time_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge @@ -3364,8 +3362,10 @@ void p3ChatService::receiveTurtleData( RsTurtleGenericTunnelItem *gitem,const Rs void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) { +#ifdef DEBUG_DISTANT_CHAT std::cerr << "p3ChatService: Received DH public key." << std::endl; item->print(std::cerr, 0) ; +#endif // Look for the current state of the key agreement. @@ -3373,7 +3373,11 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) TurtleFileHash hash ; if(getHashFromVirtualPeerId(vpid,hash)) + { +#ifdef DEBUG_DISTANT_CHAT std::cerr << " hash = " << hash << std::endl; +#endif + } else { std::cerr << " (EE) Cannot get hash from virtual peer id " << vpid << ". Probably a bug!" << std::endl; @@ -3391,7 +3395,9 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) // Now check the signature of the DH public key item. +#ifdef DEBUG_DISTANT_CHAT std::cerr << " Checking signature. " << std::endl; +#endif uint32_t pubkey_size = BN_num_bytes(item->public_key) ; unsigned char *data = (unsigned char *)malloc(pubkey_size) ; @@ -3413,7 +3419,9 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) for(int i=0;i<6;++i) if(!mIdService->getKey(senders_id,signature_key) || signature_key.keyData.bin_data == NULL) { +#ifdef DEBUG_DISTANT_CHAT std::cerr << " Cannot get key. Waiting for caching. try " << i << "/6" << std::endl; +#endif usleep(500000) ; // sleep for 500 msec. } else @@ -3434,8 +3442,10 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) std::cerr << " (EE) Signature was verified and it doesn't check! This is a security issue!" << std::endl; return ; } +#ifdef DEBUG_DISTANT_CHAT std::cerr << " Signature checks!" << std::endl; std::cerr << " Computing AES key" << std::endl; +#endif // gets current key params. By default, should contain all null pointers. // @@ -3449,7 +3459,11 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) unsigned char *key_buff = new unsigned char[size] ; if(size == DH_compute_key(key_buff,item->public_key,it->second.dh)) + { +#ifdef DEBUG_DISTANT_CHAT std::cerr << " DH key computation successed. New key in place." << std::endl; +#endif + } else { std::cerr << " (EE) DH computation failed. Probably a bug. Error code=" << ERR_get_error() << std::endl; @@ -3462,9 +3476,11 @@ void p3ChatService::handleRecvDHPublicKey(RsChatDHPublicKeyItem *item) memcpy(it->second.aes_key, RsDirUtil::sha1sum(key_buff,size).toByteArray(),DISTANT_CHAT_AES_KEY_SIZE) ; delete[] key_buff ; +#ifdef DEBUG_DISTANT_CHAT std::cerr << " DH key computed. Tunnel is now secured!" << std::endl; std::cerr << " Key computed: " ; printBinaryData(it->second.aes_key,16) ; std::cerr << std::endl; std::cerr << " Sending a ACK packet." << std::endl; +#endif // then we send an ACK packet to notify that the tunnel works. That's useful // because it makes the peer at the other end of the tunnel know that all diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 02374110d..0a608d844 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -169,8 +169,8 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std if (!rsIdentity->getIdDetails(id, details)) { - std::cerr << "GxsIdTreeWidget::MakeIdDesc() FAILED TO GET ID " << id; - std::cerr << std::endl; + // std::cerr << "GxsIdTreeWidget::MakeIdDesc() FAILED TO GET ID " << id; + //std::cerr << std::endl; str = QObject::tr("Loading... ") + QString::fromStdString(id.toStdString().substr(0,5)); @@ -254,8 +254,8 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, std // icons.push_back(QIcon(IMAGE_ANON)); // icons.push_back(QIcon(IMAGE_ANON)); - std::cerr << "GxsIdTreeWidget::MakeIdDesc() ID Ok. Comment: " << comment.toStdString() ; - std::cerr << std::endl; +// std::cerr << "GxsIdTreeWidget::MakeIdDesc() ID Ok. Comment: " << comment.toStdString() ; +// std::cerr << std::endl; return true; } diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsIdTreeWidget.cpp index 1e6b830aa..7a8c65ed5 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidget.cpp @@ -73,18 +73,12 @@ GxsIdItemDelegate::GxsIdItemDelegate(GxsIdTreeWidget *tree, int col, QObject *pa void GxsIdItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const { - std::cerr << "GxsIdItemDelegate::paint()"; - std::cerr << std::endl; - RsGxsId id ( mTree->ItemTextFromIndex(index, mGxsIdColumn).toStdString()); paintGxsId(painter, option, id); } QSize GxsIdItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const { - std::cerr << "GxsIdItemDelegate::sizeHint()"; - std::cerr << std::endl; - return QStyledItemDelegate::sizeHint(option, index); } @@ -99,18 +93,12 @@ GxsIdRSItemDelegate::GxsIdRSItemDelegate(GxsIdRSTreeWidget *tree, int col, QObje void GxsIdRSItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const { - std::cerr << "GxsIdRSItemDelegate::paint()"; - std::cerr << std::endl; - - RsGxsId id ( mTree->ItemIdFromIndex(index, mGxsIdColumn)); + RsGxsId id ( mTree->ItemIdFromIndex(index, mGxsIdColumn)); paintGxsId(painter, option, id); } QSize GxsIdRSItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const { - std::cerr << "GxsIdRSItemDelegate::sizeHint()"; - std::cerr << std::endl; - return QStyledItemDelegate::sizeHint(option, index); } diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp index 9c45b2320..2f8fad8a5 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp @@ -51,8 +51,8 @@ void GxsIdRSTreeWidgetItem::init() void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column) { - std::cerr << " GxsIdRSTreeWidgetItem::setId(" << id << "," << column << ")"; - std::cerr << std::endl; + //std::cerr << " GxsIdRSTreeWidgetItem::setId(" << id << "," << column << ")"; + //std::cerr << std::endl; mId = id; mColumn = column; @@ -76,8 +76,8 @@ void GxsIdRSTreeWidgetItem::loadId() { disconnect(rApp, SIGNAL(secondTick()), this, SLOT(loadId())); - std::cerr << " GxsIdRSTreeWidgetItem::loadId() Id: " << mId << ", mCount: " << mCount; - std::cerr << std::endl; + //std::cerr << " GxsIdRSTreeWidgetItem::loadId() Id: " << mId << ", mCount: " << mCount; + //std::cerr << std::endl; mCount++; @@ -98,15 +98,15 @@ void GxsIdRSTreeWidgetItem::loadId() if (loaded) { - std::cerr << " GxsIdRSTreeWidgetItem::loadId() Loaded Okay"; - std::cerr << std::endl; + // std::cerr << " GxsIdRSTreeWidgetItem::loadId() Loaded Okay"; + //std::cerr << std::endl; return; } if (mCount < MAX_ATTEMPTS) { - std::cerr << " GxsIdRSTreeWidgetItem::loadId() Starting Timer for re-try"; - std::cerr << std::endl; + //std::cerr << " GxsIdRSTreeWidgetItem::loadId() Starting Timer for re-try"; + //std::cerr << std::endl; /* timer event to try again */ connect(rApp, SIGNAL(secondTick()), this, SLOT(loadId()));