From 6392d657aaf562223a35ceb3f0de909600616809 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Dec 2015 16:50:52 -0500 Subject: [PATCH 01/13] fixed [dos] LF in IdDialog.h --- retroshare-gui/src/gui/Identity/IdDialog.h | 234 ++++++++++----------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 3d6101c00..1d945429b 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -1,117 +1,117 @@ -/* - * Retroshare Identity. - * - * Copyright 2012-2012 by Robert Fernie. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License Version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - * - * Please report all bugs and problems to "retroshare@lunamutt.com". - * - */ - -#ifndef IDENTITYDIALOG_H -#define IDENTITYDIALOG_H - -#include "gui/gxs/RsGxsUpdateBroadcastPage.h" - -#include - -#include "util/TokenQueue.h" - -#define IMAGE_IDDIALOG ":/icons/friends_128.png" - -namespace Ui { -class IdDialog; -} - -class UIStateHelper; -class QTreeWidgetItem; - -class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse -{ - Q_OBJECT - -public: - IdDialog(QWidget *parent = 0); - ~IdDialog(); - - virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDDIALOG) ; } //MainPage - virtual QString pageName() const { return tr("People") ; } //MainPage - virtual QString helpText() const { return ""; } //MainPage - - void loadRequest(const TokenQueue *queue, const TokenRequest &req); - -protected: - virtual void updateDisplay(bool complete); - -private slots: - void filterComboBoxChanged(); - void filterChanged(const QString &text); - - void addIdentity(); - void removeIdentity(); - void editIdentity(); - void chatIdentity(); - void sendMsg(); - - - void updateSelection(); - - void modifyReputation(); - - /** Create the context popup menu and it's submenus */ - void IdListCustomPopupMenu( QPoint point ); - - void addtoContacts(); - void removefromContacts(); - - void banPerson(); - void unbanPerson(); - - static QString inviteMessage(); - void sendInvite(); - -private: - void processSettings(bool load); - - void requestIdDetails(); - void insertIdDetails(uint32_t token); - - void requestIdList(); - void requestIdData(std::list &ids); - bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept); - void insertIdList(uint32_t token); - void filterIds(); - - void requestRepList(); - void insertRepList(uint32_t token); - - void requestIdEdit(std::string &id); - void showIdEdit(uint32_t token); - -private: - TokenQueue *mIdQueue; - UIStateHelper *mStateHelper; - - QTreeWidgetItem *contactsItem; - QTreeWidgetItem *allItem; - - RsGxsGroupId mId; - - /* UI - Designer */ - Ui::IdDialog *ui; -}; - -#endif +/* + * Retroshare Identity. + * + * Copyright 2012-2012 by Robert Fernie. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "retroshare@lunamutt.com". + * + */ + +#ifndef IDENTITYDIALOG_H +#define IDENTITYDIALOG_H + +#include "gui/gxs/RsGxsUpdateBroadcastPage.h" + +#include + +#include "util/TokenQueue.h" + +#define IMAGE_IDDIALOG ":/icons/friends_128.png" + +namespace Ui { +class IdDialog; +} + +class UIStateHelper; +class QTreeWidgetItem; + +class IdDialog : public RsGxsUpdateBroadcastPage, public TokenResponse +{ + Q_OBJECT + +public: + IdDialog(QWidget *parent = 0); + ~IdDialog(); + + virtual QIcon iconPixmap() const { return QIcon(IMAGE_IDDIALOG) ; } //MainPage + virtual QString pageName() const { return tr("People") ; } //MainPage + virtual QString helpText() const { return ""; } //MainPage + + void loadRequest(const TokenQueue *queue, const TokenRequest &req); + +protected: + virtual void updateDisplay(bool complete); + +private slots: + void filterComboBoxChanged(); + void filterChanged(const QString &text); + + void addIdentity(); + void removeIdentity(); + void editIdentity(); + void chatIdentity(); + void sendMsg(); + + + void updateSelection(); + + void modifyReputation(); + + /** Create the context popup menu and it's submenus */ + void IdListCustomPopupMenu( QPoint point ); + + void addtoContacts(); + void removefromContacts(); + + void banPerson(); + void unbanPerson(); + + static QString inviteMessage(); + void sendInvite(); + +private: + void processSettings(bool load); + + void requestIdDetails(); + void insertIdDetails(uint32_t token); + + void requestIdList(); + void requestIdData(std::list &ids); + bool fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept); + void insertIdList(uint32_t token); + void filterIds(); + + void requestRepList(); + void insertRepList(uint32_t token); + + void requestIdEdit(std::string &id); + void showIdEdit(uint32_t token); + +private: + TokenQueue *mIdQueue; + UIStateHelper *mStateHelper; + + QTreeWidgetItem *contactsItem; + QTreeWidgetItem *allItem; + + RsGxsGroupId mId; + + /* UI - Designer */ + Ui::IdDialog *ui; +}; + +#endif From b6b04dcd67a89c3b5f6435fa9845bf566b95e364 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Dec 2015 17:28:42 -0500 Subject: [PATCH 02/13] added script to convert files to unix format --- .../convert_dos_files_to_unix.sh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh diff --git a/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh b/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh new file mode 100755 index 000000000..fb5af0d05 --- /dev/null +++ b/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# This script search for files with [dos] line endings down the current directory and converts them to unix format + +files="" +files=$files" "`find . -name "*.cpp" | xargs file /tmp | grep CRLF | cut -d: -f1` +files=$files" "`find . -name "*.h" | xargs file /tmp | grep CRLF | cut -d: -f1` +files=$files" "`find . -name "*.ui" | xargs file /tmp | grep CRLF | cut -d: -f1` +files=$files" "`find . -name "*.pro" | xargs file /tmp | grep CRLF | cut -d: -f1` + +echo About to convert the following files to unix format: +for i in $files; do + echo " "$i +done +echo Please press [ENTER] when ready + +read tmp + +for i in $files; do + echo converting $i... + cat $i | sed -e s/ //g > $i.tmp0000 + mv -f $i.tmp0000 $i +done + +echo Done. + + From e87272786898c21a50225b08f67d98b20e28b3e2 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Dec 2015 17:37:05 -0500 Subject: [PATCH 03/13] updated dos->unix convertion script --- .../Debian+Ubuntu/convert_dos_files_to_unix.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh b/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh index fb5af0d05..f5d08d35c 100755 --- a/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh +++ b/build_scripts/Debian+Ubuntu/convert_dos_files_to_unix.sh @@ -2,11 +2,16 @@ # This script search for files with [dos] line endings down the current directory and converts them to unix format -files="" -files=$files" "`find . -name "*.cpp" | xargs file /tmp | grep CRLF | cut -d: -f1` -files=$files" "`find . -name "*.h" | xargs file /tmp | grep CRLF | cut -d: -f1` -files=$files" "`find . -name "*.ui" | xargs file /tmp | grep CRLF | cut -d: -f1` -files=$files" "`find . -name "*.pro" | xargs file /tmp | grep CRLF | cut -d: -f1` +if test "$*" = ""; then + echo No files supplied. Searching for files down the current directory... + files="" + files=$files" "`find . -name "*.cpp" | xargs file /tmp | grep CRLF | cut -d: -f1` + files=$files" "`find . -name "*.h" | xargs file /tmp | grep CRLF | cut -d: -f1` + files=$files" "`find . -name "*.ui" | xargs file /tmp | grep CRLF | cut -d: -f1` + files=$files" "`find . -name "*.pro" | xargs file /tmp | grep CRLF | cut -d: -f1` +else + files="$*" +fi echo About to convert the following files to unix format: for i in $files; do @@ -17,7 +22,7 @@ echo Please press [ENTER] when ready read tmp for i in $files; do - echo converting $i... + echo " "converting $i... cat $i | sed -e s/ //g > $i.tmp0000 mv -f $i.tmp0000 $i done From 78959326b6d5f37e956369f4213e12d1a0ba0a30 Mon Sep 17 00:00:00 2001 From: Gio Date: Fri, 1 Jan 2016 00:45:01 +0100 Subject: [PATCH 04/13] print_stacktrace is OS specific --- libretroshare/src/util/stacktrace.h | 163 ++++++++++++++++------------ 1 file changed, 96 insertions(+), 67 deletions(-) diff --git a/libretroshare/src/util/stacktrace.h b/libretroshare/src/util/stacktrace.h index 49a5e5c0a..b535e34f9 100644 --- a/libretroshare/src/util/stacktrace.h +++ b/libretroshare/src/util/stacktrace.h @@ -1,10 +1,32 @@ -// stacktrace.h (c) 2008, Timo Bingmann from http://idlebox.net/ -// published under the WTFPL v2.0 +/* + * stacktrace.h + * + * Copyright (C) 2016 Gioacchino Mazzurco + * Copyright (C) 2008 Timo Bingmann http://idlebox.net/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + */ #ifndef _STACKTRACE_H_ #define _STACKTRACE_H_ #include + +#ifndef WINDOWS_SYS + #include #include #include @@ -12,82 +34,89 @@ /** Print a demangled stack backtrace of the caller function to FILE* out. */ static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63) { - fprintf(out, "stack trace:\n"); + fprintf(out, "stack trace:\n"); - // storage array for stack trace address data - void* addrlist[max_frames+1]; + // storage array for stack trace address data + void* addrlist[max_frames+1]; - // retrieve current stack addresses - int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*)); + // retrieve current stack addresses + int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*)); - if (addrlen == 0) { - fprintf(out, " \n"); - return; - } - - // resolve addresses into strings containing "filename(function+address)", - // this array must be free()-ed - char** symbollist = backtrace_symbols(addrlist, addrlen); - - // allocate string which will be filled with the demangled function name - size_t funcnamesize = 256; - char* funcname = (char*)malloc(funcnamesize); - - // iterate over the returned symbol lines. skip the first, it is the - // address of this function. - for (int i = 1; i < addrlen; i++) - { - char *begin_name = 0, *begin_offset = 0, *end_offset = 0; - - // find parentheses and +address offset surrounding the mangled name: - // ./module(function+0x15c) [0x8048a6d] - for (char *p = symbollist[i]; *p; ++p) + if (addrlen == 0) { - if (*p == '(') - begin_name = p; - else if (*p == '+') - begin_offset = p; - else if (*p == ')' && begin_offset) { - end_offset = p; - break; - } + fprintf(out, " \n"); + return; } - if (begin_name && begin_offset && end_offset - && begin_name < begin_offset) + // resolve addresses into strings containing "filename(function+address)", + // this array must be free()-ed + char** symbollist = backtrace_symbols(addrlist, addrlen); + + // allocate string which will be filled with the demangled function name + size_t funcnamesize = 256; + char* funcname = (char*)malloc(funcnamesize); + + // iterate over the returned symbol lines. skip the first, it is the + // address of this function. + for (int i = 1; i < addrlen; i++) { - *begin_name++ = '\0'; - *begin_offset++ = '\0'; - *end_offset = '\0'; + char *begin_name = 0, *begin_offset = 0, *end_offset = 0; - // mangled name is now in [begin_name, begin_offset) and caller - // offset in [begin_offset, end_offset). now apply - // __cxa_demangle(): + // find parentheses and +address offset surrounding the mangled name: + // ./module(function+0x15c) [0x8048a6d] + for (char *p = symbollist[i]; *p; ++p) + { + if (*p == '(') begin_name = p; + else if (*p == '+') begin_offset = p; + else if (*p == ')' && begin_offset) + { + end_offset = p; + break; + } + } - int status; - char* ret = abi::__cxa_demangle(begin_name, - funcname, &funcnamesize, &status); - if (status == 0) { - funcname = ret; // use possibly realloc()-ed string - fprintf(out, " %s : %s+%s\n", - symbollist[i], funcname, begin_offset); - } - else { - // demangling failed. Output function name as a C function with - // no arguments. - fprintf(out, " %s : %s()+%s\n", - symbollist[i], begin_name, begin_offset); - } + if (begin_name && begin_offset && end_offset && begin_name < begin_offset) + { + *begin_name++ = '\0'; + *begin_offset++ = '\0'; + *end_offset = '\0'; + + // mangled name is now in [begin_name, begin_offset) and caller + // offset in [begin_offset, end_offset). now apply + // __cxa_demangle(): + + int status; + char* ret = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status); + if (status == 0) + { + funcname = ret; // use possibly realloc()-ed string + fprintf(out, " %s : %s+%s\n", symbollist[i], funcname, begin_offset); + } + else + { + // demangling failed. Output function name as a C function with + // no arguments. + fprintf(out, " %s : %s()+%s\n", symbollist[i], begin_name, begin_offset); + } + } + else + { + // couldn't parse the line? print the whole line. + fprintf(out, " %s\n", symbollist[i]); + } } - else - { - // couldn't parse the line? print the whole line. - fprintf(out, " %s\n", symbollist[i]); - } - } - free(funcname); - free(symbollist); + free(funcname); + free(symbollist); } +#else // WINDOWS_SYS +static inline void print_stacktrace(FILE *out = stderr, unsigned int max_frames = 63) +{ + (void) max_frames; + + fprintf(out, "TODO: 2016/01/01 print_stacktrace not implemented yet for WINDOWS_SYS\n"); +} +#endif // WINDOWS_SYS + #endif // _STACKTRACE_H_ From 640d71b8aff19080497caaa5771d8ae002469c71 Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 11:09:49 +0100 Subject: [PATCH 05/13] removed delete of RsTemporaryMemory --- libretroshare/src/gxstunnel/p3gxstunnel.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index 6471d90e8..53fbdf0f7 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -1213,7 +1213,6 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item) if(!RsAES::aes_crypt_8_16(buff,rssize,aes_key,(uint8_t*)&IV,encrypted_data,encrypted_size)) { std::cerr << "(EE) packet encryption failed." << std::endl; - delete[] encrypted_data ; return false; } From 7efb763191ae921aae91ed1ef83404dd6356839d Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 11:38:29 +0100 Subject: [PATCH 06/13] restore stream state of std::cerr after printing hex number --- libretroshare/src/gxstunnel/p3gxstunnel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare/src/gxstunnel/p3gxstunnel.cc b/libretroshare/src/gxstunnel/p3gxstunnel.cc index 53fbdf0f7..bc96b0185 100644 --- a/libretroshare/src/gxstunnel/p3gxstunnel.cc +++ b/libretroshare/src/gxstunnel/p3gxstunnel.cc @@ -295,7 +295,7 @@ void p3GxsTunnelService::handleRecvTunnelDataAckItem(const RsGxsTunnelId& id,RsG if(it == pendingGxsTunnelDataItems.end()) { - std::cerr << " (EE) item number " << std::hex << item->unique_item_counter << " is unknown. This is unexpected." << std::endl; + std::cerr << " (EE) item number " << std::hex << item->unique_item_counter << std::dec << " is unknown. This is unexpected." << std::endl; return ; } From 55ea8a54f8f09d29f59d3b512aaa8b9eb1c2821f Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 11:49:03 +0100 Subject: [PATCH 07/13] init pointer in RsServer --- libretroshare/src/rsserver/p3face-server.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/libretroshare/src/rsserver/p3face-server.cc b/libretroshare/src/rsserver/p3face-server.cc index ceeca9b7d..746ebac5a 100644 --- a/libretroshare/src/rsserver/p3face-server.cc +++ b/libretroshare/src/rsserver/p3face-server.cc @@ -93,6 +93,7 @@ RsServer::RsServer() msgSrv = NULL; chatSrv = NULL; mStatusSrv = NULL; + mGxsTunnels = NULL; mMin = 0; mLoop = 0; From 72812be7bed584a5294e041b0fa1751b4b3228b0 Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 11:54:59 +0100 Subject: [PATCH 08/13] added missing initialisation of integers in GxsForumThreadWidget --- retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 050582bc3..6280f029c 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -100,6 +100,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget mTokenTypeMessageData = nextTokenType(); mTokenTypeReplyMessage = nextTokenType(); mTokenTypeReplyForumMessage = nextTokenType(); + mTokenTypeBanAuthor = nextTokenType(); setUpdateWhenInvisible(true); @@ -127,6 +128,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget //mStateHelper->addLoadPlaceholder(mTokenTypeMessageData, ui->threadTitle); mSubscribeFlags = 0; + mSignFlags = 0; mInProcessSettings = false; mUnreadCount = 0; mNewCount = 0; From 9cb81f57ea6621fe055fe10c04cadd857373dea9 Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 12:01:49 +0100 Subject: [PATCH 09/13] don't create wiki dataservice if wiki is not enabled for compile --- libretroshare/src/rsserver/rsinit.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index e9f6f3161..5cdbaf521 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1372,12 +1372,11 @@ int RsServer::StartupRetroShare() /**** Wiki GXS service ****/ - +#ifdef RS_USE_WIKI RsGeneralDataService* wiki_ds = new RsDataService(currGxsDir + "/", "wiki_db", RS_SERVICE_GXS_TYPE_WIKI, NULL, rsInitConfig->gxs_passwd); -#ifdef RS_USE_WIKI p3Wiki *mWiki = new p3Wiki(wiki_ds, NULL, mGxsIdService); // create GXS wiki service RsGxsNetService* wiki_ns = new RsGxsNetService( From 3b2eae4f4979e1492853c56167a2b213123bb77e Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 12:17:08 +0100 Subject: [PATCH 10/13] fixed memory leak by using stack memory instead of heap memory --- retroshare-gui/src/util/HandleRichText.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/util/HandleRichText.cpp b/retroshare-gui/src/util/HandleRichText.cpp index 15945a791..59466b827 100644 --- a/retroshare-gui/src/util/HandleRichText.cpp +++ b/retroshare-gui/src/util/HandleRichText.cpp @@ -587,9 +587,9 @@ static void optimizeHtml(QDomDocument& doc if (pair.length()!=2) return; //Malformed style list so a bad message or last item. QString keyvalue = pair.at(1); keyvalue.replace(";",""); - QStringList* classUsingIt = new QStringList(pair.at(0).split(',')); + QStringList classUsingIt(pair.at(0).split(',')); QStringList* exported = new QStringList(); - foreach (QString keyVal, *classUsingIt) { + foreach (QString keyVal, classUsingIt) { if(!keyVal.trimmed().isEmpty()) { exported->append(keyVal.trimmed().replace(".","")); } From 58672e83a63d96959ce75ed1bc988ef03bfcc513 Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 13:44:38 +0100 Subject: [PATCH 11/13] fix the logic to prevent using invalid iterators. First make a valid iterator, then dereference it. Not the other way round. This bug can randomly prevent gxs group stats from being collected from peers. --- libretroshare/src/gxs/rsgxsnetservice.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 79107197a..619d6e691 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -733,7 +733,7 @@ void RsGxsNetService::syncGrpStatistics() #ifdef NXS_NET_DEBUG_6 GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl; #endif - // randomly select 2 friends among the suppliers of this group + // randomly select GROUP_STATS_UPDATE_NB_PEERS friends among the suppliers of this group uint32_t n = RSRandom::random_u32() % rec.suppliers.size() ; @@ -743,13 +743,15 @@ void RsGxsNetService::syncGrpStatistics() for(uint32_t i=0;ifirst) << " asking friend " << peer_id << " for an update of stats for group " << it->first << std::endl; From 22c00fc638032ea63b57b4f1fe9f3b52eab4abf0 Mon Sep 17 00:00:00 2001 From: electron128 Date: Fri, 1 Jan 2016 14:07:15 +0100 Subject: [PATCH 12/13] fixed free() in UdpLayer::recv_loop --- libbitdht/src/udp/udplayer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libbitdht/src/udp/udplayer.cc b/libbitdht/src/udp/udplayer.cc index df0ce8c84..71dfd4f9a 100644 --- a/libbitdht/src/udp/udplayer.cc +++ b/libbitdht/src/udp/udplayer.cc @@ -262,6 +262,7 @@ void UdpLayer::recv_loop() #ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::recv_loop() stopping thread" << std::endl; #endif + free(inbuf) ; stop(); } @@ -301,9 +302,6 @@ void UdpLayer::recv_loop() #endif } } - - free(inbuf) ; - return; } From ab3939cd9ad9f2f9ef6812cc33412f15ad0ade85 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 1 Jan 2016 11:11:40 -0500 Subject: [PATCH 13/13] added missing update of mClientMsgUpdateMap, causing both a memory leak and an inconsistency in TS --- libretroshare/src/gxs/rsgxsnetservice.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 619d6e691..af175d672 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -2749,6 +2749,8 @@ void RsGxsNetService::locked_stampPeerGroupUpdateTime(const RsPeerId& pid,const { pitem = new RsGxsMsgUpdateItem(mServType) ; pitem->peerId = pid ; + + mClientMsgUpdateMap[pid] = pitem ; } else pitem = it->second ;