merged upstream/master

This commit is contained in:
csoler 2018-03-15 09:19:56 +01:00
commit 04dc764339
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
329 changed files with 129212 additions and 86062 deletions

View File

@ -52,7 +52,8 @@ addons:
branch_pattern: coverity_scan
before_script:
- qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests
- if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests ; fi
- if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests CONFIG+=rs_macos10.12 ; fi
script:
- if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && tests/unittests/unittests >/dev/null 2>&1 ; fi

View File

@ -10,7 +10,7 @@ Add to the PATH environment variable by editing your *~/.profile* file.
export PATH="/users/$USER/Qt/5.5/clang_64/bin:$PATH"
Depends on wich version of Qt you use.
Depends on which version of Qt you use.
## ***Choose if you use MacPort or HomeBrew***

View File

@ -31,7 +31,7 @@ export ANDROID_NDK_PATH="/opt/android-ndk/"
## The path where your fresh compiled toolchain will be installed, make sure
## the parent exists
export NDK_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android/"
export NATIVE_LIBS_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android/"
## The CPU architecture of the Android device you want to target
export ANDROID_NDK_ARCH="arm"
@ -46,6 +46,7 @@ export HOST_NUM_CPU=1
./android-prepare-toolchain.sh
-------------------------------------------------------------------------------
== Preparing Qt Creator
Now that your environement is set up you should configure Qt Creator for Android
@ -65,7 +66,7 @@ _Qt Creator left pane -> Projects -> Build and Run -> Android SOMESTUFF kit ->
Build Environement -> Add
Variable: +NATIVE_LIBS_TOOLCHAIN_PATH+
Value: +Same value as NDK_TOOLCHAIN_PATH in Preparing The Environement step+
Value: +Same value as NATIVE_LIBS_TOOLCHAIN_PATH in Preparing The Environement step+
Some of RetroShare modules like +retroshare-gui+ and +WebUI+ are not available
on Android so to be able to compile RetroShare without errors you will have to
@ -81,17 +82,17 @@ and add the following configurations
CONFIG+=no_retroshare_gui CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=retroshare_android_service CONFIG+=libresapilocalserver CONFIG+=no_libresapihttpserver CONFIG+=retroshare_qml_app
-------------------------------------------------------------------------------
WARNING: SQLCipher is not supported yet on RetroShare for Android. This poses a
major security concern, we are working to fix this ASAP.
WARNING: Some versions of QtCreator try to find the Android SDK in
TIP: Some versions of QtCreator try to find the Android SDK in
+/opt/android/sdk+. A workaround to this is to make a symbolic link there
pointing to your SDK installation path, like
+mkdir -p /opt/android/sdk && ln -s /home/user/android-sdk-linux
/opt/android/sdk+
== Quircks
=== Protected Apps
On some Android devices like +Huawei ALE-L21+ background applications are
killed when screen is turned off unless they are in the _protected app_ list.
At moment seems apps developers don't have a way to have the application
@ -107,6 +108,137 @@ To enable enable _protection_: +Android menu -> Settings -> Privacy & security
Other devices may offer similar _features_ please report them.
=== APK signature mismatch
If you try to install a RetroShare APK that comes from a different source
(eg: if you try to upgrade from F-Droid when you originally installed an APK
build by yourself) Android will prevent that from happening. In that case the
only solution is to uninstall the app and then install the new APK but if you do
it also the application data and your precious cryptographic keys, friend list
etc. will be lost forever.
To avoid that you can attempt to manually backup and then restore from the
command-line (+adb backup+ seems not working either) to change the app source
without erasing the appliation data.
CAUTION: Following steps require root access on your Android device
.Backup RetroShare Android application data
[source,bash]
--------------------------------------------------------------------------------
export ORIG_DIR="/data/data/org.retroshare.android.qml_app"
export BACKUP_DIR="org.retroshare.android.qml_app.backup"
adb root
adb shell am force-stop org.retroshare.android.qml_app
sleep 1s
mkdir ${BACKUP_DIR}
# Avoid adb pull failing
adb shell rm ${ORIG_DIR}/files/.retroshare/libresapi.sock
adb pull ${ORIG_DIR}/files/ ${BACKUP_DIR}/files/
--------------------------------------------------------------------------------
After this you should be able to uninstall the old APK with your preferred
method, as example from the command-line.
.Uninstall RetroShare Android from the command-line
[source,bash]
--------------------------------------------------------------------------------
adb uninstall org.retroshare.android.qml_app
--------------------------------------------------------------------------------
Now you can install a different signature APK and then restore the application
data with the following commands.
[source,bash]
--------------------------------------------------------------------------------
export ORIG_DIR="/data/data/org.retroshare.android.qml_app"
export BACKUP_DIR="org.retroshare.android.qml_app.backup"
adb root
## Launch the app to make sure the parent directory exists and has proper owner
adb shell monkey -p org.retroshare.android.qml_app -c android.intent.category.LAUNCHER 1
sleep 1s
adb shell am force-stop org.retroshare.android.qml_app
sleep 1s
APP_OWNER="$(adb shell busybox ls -lnd ${ORIG_DIR} | awk '{print $3":"$4}')"
adb shell rm -rf ${ORIG_DIR}/files
adb push ${BACKUP_DIR}/files/ ${ORIG_DIR}/files/
adb shell busybox chown -R ${APP_OWNER} ${ORIG_DIR}/files/
--------------------------------------------------------------------------------
Opening RetroShare android app now should show your old profile.
== Debugging with GDB
QtCreator actually support debugging only for the foreground activity, so to
debug what's happening in the core extra trickery is needed.
- Run the App in Debug mode from QtCreator "Start Debugging" button
- Enable QtCreator debugger console view Menu->Window->Debugger Log
- Run +show solib-search-path+ in the QtCreator GDB console
- Take note of the output you get in the right pane of the console
- Thanks https://stackoverflow.com/a/31164313 for the idea
TIP: QtCreator GDB console seems a bit buggy and easly trigger timeout
message when a command is run, in that case attempt to run the command while the
debugging is paused or at breakpoint, or with other similar tricks.
CAUTION: Following steps require root access on your Android device
Now on your phone yuo need to authorize root access to applications, then once
you plug your sacrifical Android phone run this commands
.Run gdbserver as root on Android phone
[source,bash]
--------------------------------------------------------------------------------
## Open a shell from your workstation on the connected Android phone
adb shell
## take the note of the phone IP address
ip address show
## Gain root permissions on the shell
su
## Attach with gdbserver and listen on one TCP port
gdbserver :4567 --attach $(pgrep org.retroshare.android.qml_app:rs)
--------------------------------------------------------------------------------
.Prepare and run Android NDK GDB on your workstation
[source,bash]
--------------------------------------------------------------------------------
## Setup some convenience variables
NDK_GDB="${ANDROID_NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb"
RS_BUILD_PATH="${HOME}/Builds/RetroShare-Android_for_armeabi_v7a_GCC_4_9_Qt_5_9_2_android_armv7-Debug/"
## Start Android NDK GDB of your phone architecture passing the executable
$NDK_GDB $RS_BUILD_PATH/retroshare-android-service/src/libretroshare-android-service.so
## Instruct GDB how and where to find debugging symbols
(gdb) set auto-solib-add on
(gdb) set solib-search-path THE:BIG:LIST:OF:DIRECTORIES:YOU:TAKE:NOTE:BEFORE
## Connect to the gdbserver running on the phone
(gdb) target remote $PHONE_IP:4567
## Have fun debugging
(gdb)
--------------------------------------------------------------------------------
TIP: Some time WiFi power saving on Android mess with the GDB connection,
to prevent that from appening open another +adb shell+ and live +ping+ toward
your work-station running
== Furter Readings
- link:http://doc.qt.io/qt-5/android-support.html[]
@ -115,3 +247,8 @@ Other devices may offer similar _features_ please report them.
- link:retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136[]
- link:https://groups.google.com/forum/#!topic/android-developers/srATPaL0aRU[]
- link:https://stackoverflow.com/questions/31638986/protected-apps-setting-on-huawei-phones-and-how-to-handle-it[]
- link:https://tthtlc.wordpress.com/2012/09/19/how-to-do-remote-debugging-via-gdbserver-running-inside-the-android-phone/[]
- link:https://source.android.com/devices/tech/debug/[]
- link:https://source.android.com/devices/tech/debug/gdb[]
- link:https://fw4spl-org.github.io/fw4spl-blog/2015/07/27/Native-debugging-on-Android-with-QtCreator.html[]
- link:https://fragglet.livejournal.com/19646.html[]

View File

@ -6,12 +6,16 @@ TEMPLATE = subdirs
SUBDIRS += openpgpsdk
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
SUBDIRS += libbitdht
libbitdht.file = libbitdht/src/libbitdht.pro
retrotor {
libretroshare.depends = openpgpsdk
} else {
SUBDIRS += libbitdht
libbitdht.file = libbitdht/src/libbitdht.pro
libretroshare.depends = openpgpsdk libbitdht
}
SUBDIRS += libretroshare
libretroshare.file = libretroshare/src/libretroshare.pro
libretroshare.depends = openpgpsdk libbitdht
SUBDIRS += libresapi
libresapi.file = libresapi/src/libresapi.pro
@ -24,12 +28,15 @@ retroshare_gui {
retroshare_gui.target = retroshare_gui
}
retrotor {
} else {
retroshare_nogui {
SUBDIRS += retroshare_nogui
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
retroshare_nogui.depends = libretroshare libresapi
retroshare_nogui.target = retroshare_nogui
}
}
retroshare_android_service {
SUBDIRS += retroshare_android_service

View File

@ -1,6 +1,6 @@
##Compilation on Windows
## Compilation on Windows
###Qt Installation
### Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/)
@ -12,7 +12,7 @@ Add to the PATH environment variable
Depends on wich version of Qt you use.
Change build-all-mingw32make.bat with these values too if you don't use MSys2.
###MSYS2 INSTALLATION
### MSYS2 INSTALLATION
Choose your MSYS2 installer here: [MSYS2](http://msys2.github.io/)
@ -33,7 +33,7 @@ Choose only w64-i686 if you want only compilation in 32b architecture.
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
###Install other binutils:
### Install other binutils:
pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc
pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3
pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex
@ -49,7 +49,7 @@ Add MSYS2 to PATH environment variable depends your windows
;C:\msys32\mingw32\bin
###Git Installation
### Git Installation
Install Git Gui or other client: [Git Scm](https://git-scm.com/download/win)
@ -63,7 +63,7 @@ Paste this text on git console:
git clone https://github.com/RetroShare/RetroShare.git
###Last Settings
### Last Settings
In QtCreator Option Git add its path: *C:\Program Files\Git\bin*
@ -75,7 +75,7 @@ Move to build_scripts:
cd /c/Development/GIT/RetroShare/msys2_build_libs/
###Compile missing library
### Compile missing library
make
You can now compile RS into Qt Creator

View File

@ -1,16 +1,78 @@
#!/bin/bash
## Define default value for variable, take two arguments, $1 variable name,
## $2 default variable value, if the variable is not already define define it
## with default value.
function define_default_value()
{
VAR_NAME="${1}"
DEFAULT_VALUE="${2}"
[ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}"
}
## You are supposed to provide the following variables according to your system setup
[ -z ${ANDROID_NDK_PATH+x} ] && export ANDROID_NDK_PATH="/opt/android-ndk/"
[ -z ${ANDROID_NDK_ARCH+x} ] && export ANDROID_NDK_ARCH="arm"
[ -z ${ANDROID_NDK_ABI_VER+x} ] && export ANDROID_NDK_ABI_VER="4.9"
[ -z ${ANDROID_PLATFORM_VER+x} ] && export ANDROID_PLATFORM_VER="18"
[ -z ${NDK_TOOLCHAIN_PATH+x} ] && export NDK_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}-abi${ANDROID_NDK_ABI_VER}/"
[ -z ${HOST_NUM_CPU+x} ] && export HOST_NUM_CPU=4
define_default_value ANDROID_NDK_PATH "/opt/android-ndk/"
define_default_value ANDROID_NDK_ARCH "arm"
define_default_value ANDROID_NDK_ABI_VER "4.9"
define_default_value ANDROID_PLATFORM_VER "18"
define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}-abi${ANDROID_NDK_ABI_VER}/"
define_default_value HOST_NUM_CPU $(nproc)
define_default_value BZIP2_SOURCE_VERSION "1.0.6"
define_default_value BZIP2_SOURCE_SHA256 a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
define_default_value OPENSSL_SOURCE_VERSION "1.0.2n"
define_default_value OPENSSL_SOURCE_SHA256 370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe
define_default_value SQLITE_SOURCE_YEAR "2018"
define_default_value SQLITE_SOURCE_VERSION "3220000"
define_default_value SQLITE_SOURCE_SHA256 2824ab1238b706bc66127320afbdffb096361130e23291f26928a027b885c612
define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2"
define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb
define_default_value LIBUPNP_SOURCE_VERSION "1.6.24"
define_default_value LIBUPNP_SOURCE_SHA256 7d83d79af3bb4062e5c3a58bf2e90d2da5b8b99e2b2d57c23b5b6f766288cf96
define_default_value INSTALL_QT_ANDROID "false"
define_default_value QT_VERSION "5.9.4"
define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763
## $1 filename, $2 sha256 hash
function check_sha256()
{
echo ${2} "${1}" | sha256sum -c &> /dev/null
}
## $1 filename, $2 sha256 hash, $3 url
function verified_download()
{
FILENAME="$1"
SHA256="$2"
URL="$3"
check_sha256 "${FILENAME}" "${SHA256}" ||
{
rm -rf "${FILENAME}"
wget -O "${FILENAME}" "$URL" ||
{
echo "Failed downloading ${FILENAME} from $URL"
exit 1
}
check_sha256 "${FILENAME}" "${SHA256}" ||
{
echo "SHA256 mismatch for ${FILENAME} from ${URL} expected sha256 ${SHA256} got $(sha256sum ${FILENAME} | awk '{print $1}')"
exit 1
}
}
}
runDir="$(pwd)"
## You should not edit the following variables
if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then
cArch="i686"
eABI=""
@ -18,29 +80,115 @@ else
cArch="${ANDROID_NDK_ARCH}"
eABI="eabi"
fi
export SYSROOT="${NDK_TOOLCHAIN_PATH}/sysroot"
export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot"
export PREFIX="${SYSROOT}"
export CC="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-gcc"
export CXX="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-g++"
export AR="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
export RANLIB="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-gcc"
export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-g++"
export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
export ANDROID_DEV="${ANDROID_NDK_PATH}/platforms/android-${ANDROID_PLATFORM_VER}/arch-${ANDROID_NDK_ARCH}/usr"
## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
build_toolchain()
{
rm -rf ${NDK_TOOLCHAIN_PATH}
rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH}
[ "${ANDROID_NDK_ARCH}" == "x86" ] && toolchainName="${ANDROID_NDK_ARCH}-${ANDROID_NDK_ABI_VER}" || toolchainName="${ANDROID_NDK_ARCH}-linux-androideabi-${ANDROID_NDK_ABI_VER}"
${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh --ndk-dir=${ANDROID_NDK_PATH} --arch=${ANDROID_NDK_ARCH} --install-dir=${NDK_TOOLCHAIN_PATH} --platform=android-${ANDROID_PLATFORM_VER} --toolchain=${toolchainName} --verbose
${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh --ndk-dir=${ANDROID_NDK_PATH} --arch=${ANDROID_NDK_ARCH} --install-dir=${NATIVE_LIBS_TOOLCHAIN_PATH} --platform=android-${ANDROID_PLATFORM_VER} --toolchain=${toolchainName} --verbose
}
## More information available at https://gitlab.com/relan/provisioners/merge_requests/1 and http://stackoverflow.com/a/34032216
install_qt_android()
{
QT_VERSION_CODE=$(echo $QT_VERSION | tr -d .)
QT_INSTALL_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}/Qt
QT_INSTALLER="qt-unified-linux-x64-3.0.2-online.run"
verified_download $QT_INSTALLER $QT_ANDROID_INSTALLER_SHA256 \
http://master.qt.io/archive/online_installers/3.0/${QT_INSTALLER}
chmod a+x ${QT_INSTALLER}
QT_INSTALLER_SCRIPT="qt_installer_script.js"
cat << EOF > "${QT_INSTALLER_SCRIPT}"
function Controller() {
installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
gui.clickButton(buttons.NextButton);
});
var welcomePage = gui.pageWidgetByObjectName("WelcomePage");
welcomePage.completeChanged.connect(function() {
if (gui.currentPageWidget().objectName == welcomePage.objectName)
gui.clickButton(buttons.NextButton);
});
}
Controller.prototype.WelcomePageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.CredentialsPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.IntroductionPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.TargetDirectoryPageCallback = function() {
gui.currentPageWidget().TargetDirectoryLineEdit.setText("$QT_INSTALL_PATH");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ComponentSelectionPageCallback = function() {
var widget = gui.currentPageWidget();
// You can get these component names by running the installer with the
// --verbose flag. It will then print out a resource tree.
widget.deselectComponent("qt.tools.qtcreator");
widget.deselectComponent("qt.tools.doc");
widget.deselectComponent("qt.tools.examples");
widget.selectComponent("qt.$QT_VERSION_CODE.android_armv7");
gui.clickButton(buttons.NextButton);
}
Controller.prototype.LicenseAgreementPageCallback = function() {
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
gui.clickButton(buttons.NextButton);
}
Controller.prototype.StartMenuDirectoryPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.ReadyForInstallationPageCallback = function() {
gui.clickButton(buttons.NextButton);
}
Controller.prototype.FinishedPageCallback = function() {
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox)
checkBoxForm.launchQtCreatorCheckBox.checked = false;
gui.clickButton(buttons.FinishButton);
}
EOF
QT_QPA_PLATFORM=minimal ./${QT_INSTALLER} --script ${QT_INSTALLER_SCRIPT}
}
## More information available at retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136
build_bzlib()
{
B_dir="bzip2-1.0.6"
B_dir="bzip2-${BZIP2_SOURCE_VERSION}"
rm -rf $B_dir
[ -f $B_dir.tar.gz ] || wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \
http://www.bzip.org/${BZIP2_SOURCE_VERSION}/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
tar -xf $B_dir.tar.gz
cd $B_dir
sed -i "/^CC=.*/d" Makefile
@ -59,9 +207,12 @@ build_bzlib()
## More information available at http://doc.qt.io/qt-5/opensslsupport.html
build_openssl()
{
B_dir="openssl-1.0.2h"
B_dir="openssl-${OPENSSL_SOURCE_VERSION}"
rm -rf $B_dir
[ -f $B_dir.tar.gz ] || wget https://www.openssl.org/source/$B_dir.tar.gz
verified_download $B_dir.tar.gz $OPENSSL_SOURCE_SHA256 \
https://www.openssl.org/source/$B_dir.tar.gz
tar -xf $B_dir.tar.gz
cd $B_dir
if [ "${ANDROID_NDK_ARCH}" == "arm" ]; then
@ -86,8 +237,11 @@ build_openssl()
build_sqlite()
{
B_dir="sqlite-autoconf-3130000"
[ -f $B_dir.tar.gz ] || wget https://www.sqlite.org/2016/$B_dir.tar.gz
B_dir="sqlite-autoconf-${SQLITE_SOURCE_VERSION}"
verified_download $B_dir.tar.gz $SQLITE_SOURCE_SHA256 \
https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz
tar -xf $B_dir.tar.gz
cd $B_dir
./configure --prefix="${SYSROOT}/usr" --host=${ANDROID_NDK_ARCH}-linux
@ -101,11 +255,22 @@ build_sqlite()
build_sqlcipher()
{
echo "sqlcipher not supported yet on android"
return 0
B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}"
rm -rf $B_dir
cd sqlcipher
./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${SYSROOT}/usr/lib/libcrypto.a"
T_file="${B_dir}.tar.gz"
verified_download $T_file $SQLCIPHER_SOURCE_SHA256 \
https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz
tar -xf $T_file
cd $B_dir
./configure --build=$(sh ./config.guess) \
--host=${ANDROID_NDK_ARCH}-linux \
--prefix="${SYSROOT}/usr" --with-sysroot="${SYSROOT}" \
--enable-tempstore=yes \
--disable-tcl --disable-shared \
CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${SYSROOT}/usr/lib/libcrypto.a"
make -j${HOST_NUM_CPU}
make install
cd ..
@ -113,9 +278,12 @@ build_sqlcipher()
build_libupnp()
{
B_dir="libupnp-1.6.20"
B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}"
rm -rf $B_dir
[ -f $B_dir.tar.bz2 ] || wget https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%201.6.20/$B_dir.tar.bz2
verified_download $B_dir.tar.bz2 $LIBUPNP_SOURCE_SHA256 \
https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2
tar -xf $B_dir.tar.bz2
cd $B_dir
## liupnp must be configured as static library because if not the linker will
@ -146,7 +314,11 @@ build_libmicrohttpd()
}
build_toolchain
[ "${INSTALL_QT_ANDROID}X" == "trueX" ] && install_qt_android
build_bzlib
build_openssl
build_sqlite
build_sqlcipher
build_libupnp
echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}

View File

@ -0,0 +1,3 @@
#!/bin/sh
./Recipe retrotor.yml

View File

@ -0,0 +1,20 @@
app: retroshare
union: true
ingredients:
dist: trusty
sources:
- deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse
- deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
- deb http://deb.torproject.org/torproject.org/ trusty main
ppas:
- retroshare/testing
packages:
- libqt5svg5
- tor
- retrotor
script:
- rm -rf usr/share/glib-2.0/schemas/
- sed -i -e 's|/usr/share/pixmaps/||g' retroshare.desktop
- sed -i -e 's|/usr/bin/||g' retroshare.desktop

View File

@ -1,4 +1,289 @@
retroshare (0.6.3-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
retroshare (ZZZZZZ-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
919417a csoler Sat, 3 Mar 2018 19:04:54 +0100 make sure tor executable from config path can be reached
b587ac8 csoler Sat, 3 Mar 2018 16:06:49 +0100 Merge pull request #1192 from PhenomRetroShare/Add_WarningMaxFlatViewFile
9bcff07 csoler Sat, 3 Mar 2018 15:58:11 +0100 Merge pull request #1203 from PhenomRetroShare/Fix_SharedFileDialogShowColumn
ead2aea csoler Sat, 3 Mar 2018 15:56:51 +0100 Merge pull request #1204 from csoler/v0.6-FT
dcb3f79 csoler Sat, 3 Mar 2018 15:55:52 +0100 removed some debug info in RSLink
1a1dc64 csoler Sat, 3 Mar 2018 15:49:45 +0100 fixed transfers list bug causing ghost entries to appear
58d418d Phenom Sat, 3 Mar 2018 12:08:21 +0100 Fix SharedFilesDialog show old hidden column.
ab45a97 Phenom Sat, 3 Mar 2018 12:05:13 +0100 Revert "Fix SharedFilesDialog show old hidden column."
57f87a6 csoler Fri, 2 Mar 2018 22:58:50 +0100 Merge pull request #1201 from csoler/v0.6-SecurityFixes
9386bb9 csoler Fri, 2 Mar 2018 22:57:14 +0100 tried to fix FT list bug.
952ff03 csoler Fri, 2 Mar 2018 21:28:09 +0100 Merge pull request #1200 from csoler/v0.6-SecurityFixes
e88eebf csoler Fri, 2 Mar 2018 21:26:38 +0100 attempt to fix wrong number of rows in DL list
f2a737e csoler Fri, 2 Mar 2018 18:13:09 +0100 fixed font size compilation error
ca402c2 csoler Fri, 2 Mar 2018 18:05:11 +0100 fixed column sizing in FT dialog
efa5827 csoler Fri, 2 Mar 2018 18:01:56 +0100 fixed missing peer availability maps in FT dialog
e5edea3 csoler Thu, 1 Mar 2018 14:10:30 +0100 removed precise and zesty which are obsolete
3d7be85 csoler Thu, 1 Mar 2018 11:46:47 +0100 Merge pull request #1199 from csoler/v0.6-SecurityFixes
026951f csoler Thu, 1 Mar 2018 11:45:54 +0100 added consistency check in getGroupMeta so that ADMIN/PUBLISH flags always correspond to what the key set reflects
028a246 csoler Thu, 1 Mar 2018 09:44:59 +0100 Merge pull request #1197 from csoler/v0.6-SecurityFixes
ac64d2a csoler Thu, 1 Mar 2018 09:42:47 +0100 Merge pull request #1195 from PhenomRetroShare/Fix_NoTrIconInChatWidget
0651f4a csoler Thu, 1 Mar 2018 09:42:06 +0100 Merge pull request #1198 from G10h4ck/master
0c8b3ed Gioacc Wed, 28 Feb 2018 23:32:13 +0100 Set default Mac OS X version only if macx
5d58943 csoler Wed, 28 Feb 2018 23:18:50 +0100 forced notification of type RECEIVE when creating a new group so that the GxsIFaceHelper updates the group list
29ab0e9 csoler Wed, 28 Feb 2018 22:40:04 +0100 fixed bug that would erase private publish key when a group update is received
165b241 csoler Tue, 27 Feb 2018 23:19:27 +0100 made add of publish key a meta group change, to force reload the list of groups
3bc5b45 csoler Tue, 27 Feb 2018 22:42:48 +0100 added a FeedItem to warn when publish permissions are received for a channel
aad9397 csoler Mon, 26 Feb 2018 23:37:19 +0100 fixed memory leak in p3GxsTunnel
23c389c Phenom Mon, 26 Feb 2018 23:29:06 +0100 Remove non translatable text ChatWidget.ui
dd9f67a csoler Sun, 25 Feb 2018 17:52:49 +0100 fixed version number problem
3e700ab csoler Sun, 25 Feb 2018 16:12:46 +0100 Merge pull request #1194 from G10h4ck/fixAndroidCompilation
9f0421c csoler Sun, 25 Feb 2018 14:39:29 +0100 attempt to fix large size in ConnectFriendDialog.ui
f9896a0 csoler Sun, 25 Feb 2018 11:46:18 +0100 updated ppa_upload.sh to 0.6.4
5c029c5 csoler Sun, 25 Feb 2018 11:43:30 +0100 fixed typo in changelog
31ab87c csoler Fri, 23 Feb 2018 14:06:49 +0100 added rs plugins into rules for ubuntu packaging
681f543 csoler Sat, 24 Feb 2018 22:04:26 +0100 Merge pull request #1183 from csoler/v0.6.4
05613a2 csoler Sat, 24 Feb 2018 21:58:58 +0100 Merge pull request #1193 from csoler/v0.6-SecurityFixes
39e70ed csoler Sat, 24 Feb 2018 21:51:18 +0100 ignore unknown ptags in certificates instead of causing an error, for future backward compatibility
062e00d csoler Sat, 24 Feb 2018 18:05:26 +0100 Merge pull request #1189 from csoler/v0.6-SecurityFixes
13441ff csoler Fri, 23 Feb 2018 15:13:13 +0100 removed debug info in rsgenexchange.cc
49b321d csoler Fri, 23 Feb 2018 14:39:08 +0100 fixed the text in invitation system
d8e950c csoler Fri, 23 Feb 2018 14:28:22 +0100 removed debug output from rsdataservice
5a4d0f5 csoler Fri, 23 Feb 2018 14:26:23 +0100 made the invite system non automatic, because it was confusing and could generate unwanted emails
fa84d1c csoler Fri, 23 Feb 2018 14:01:43 +0100 Merge pull request #1185 from G10h4ck/disablePluginByDefault
ff7633f csoler Fri, 23 Feb 2018 14:00:39 +0100 Merge pull request #1184 from G10h4ck/linkLocalFallback
8d5cd8a Gioacc Thu, 22 Feb 2018 15:38:20 +0100 Increase size of list of ip shared via discovery2
9dd1aef Gioacc Fri, 23 Feb 2018 01:05:35 +0100 Discovery do not distribute addresses to hidden nodes
e7facc1 Gioacc Fri, 23 Feb 2018 01:05:04 +0100 Prevent discovery to share local addresses if hidden
4fa6bdc Gioacc Wed, 21 Feb 2018 17:38:31 +0100 Improve discovery
385f44b csoler Thu, 22 Feb 2018 23:03:48 +0100 Merge pull request #1188 from PhenomRetroShare/Fix_SharedFileDialogShowColumn
c141eae Phenom Thu, 22 Feb 2018 18:54:14 +0100 Fix SharedFilesDialog show old hidden column.
2044a2c Gioacc Wed, 21 Feb 2018 04:24:12 +0100 Use retrocompatible iterators
4dfeab2 csoler Tue, 20 Feb 2018 23:30:52 +0100 Merge pull request #1187 from csoler/master
73d11e1 Phenom Thu, 15 Feb 2018 19:04:55 +0100 Fix Gcc Warning in nxsmsgsync_test.cc
737a2b4 Phenom Thu, 15 Feb 2018 18:57:16 +0100 Fix Gcc Warning in nxstesthub.cc
cfcdec4 Phenom Thu, 15 Feb 2018 18:44:03 +0100 Fix Gcc Warning in support.h
aadb9ac Phenom Fri, 8 Dec 2017 19:47:00 +0100 Fix Gcc Warning in NetworkDialog.cpp
e3d8d86 csoler Tue, 20 Feb 2018 23:03:33 +0100 updated translation files
4d7997b csoler Tue, 20 Feb 2018 21:08:09 +0100 Merge pull request #1186 from csoler/v0.6-FT
a1b378e csoler Tue, 20 Feb 2018 21:07:02 +0100 fixed ghost rows in TransfersDialog
c897962 csoler Tue, 20 Feb 2018 20:26:33 +0100 merged
11d607e csoler Tue, 20 Feb 2018 20:19:10 +0100 Merge pull request #1179 from PhenomRetroShare/Add_ChangeAddIconForChannelForum
35b54bb csoler Tue, 20 Feb 2018 20:18:31 +0100 Merge pull request #1180 from PhenomRetroShare/Add_ClearGxsGroupFrameWhenNoSelection
fec2b2e csoler Tue, 20 Feb 2018 19:20:02 +0100 Merge pull request #1182 from PhenomRetroShare/Add_SplitFileNbSize
b2217fc Gioacc Tue, 20 Feb 2018 15:56:16 +0100 Build plugin only if requested
0c99975 Gioacc Mon, 19 Feb 2018 23:23:15 +0100 Use link local address only if necessary
5667763 csoler Mon, 19 Feb 2018 21:49:06 +0100 switched version to 0.6.4
798ad15 Phenom Mon, 19 Feb 2018 20:13:38 +0100 Split Number of Files and Size in RemoteDirModel.
afc43d0 G10h4c Mon, 19 Feb 2018 15:33:28 +0100 Merge pull request #1181 from Kcchouette/patch-1
8492a40 Kcchou Mon, 19 Feb 2018 15:17:59 +0100 Update markdown to be visible on github
71e1a46 Phenom Sun, 18 Feb 2018 23:12:59 +0100 Clear GxsGroupFrame When No Selection
8710761 Phenom Sun, 18 Feb 2018 19:15:01 +0100 Change Add Channel/Forum post by Add.png
51f5d19 csoler Sun, 18 Feb 2018 18:00:24 +0100 merged uptream/master
2bc0629 csoler Sun, 18 Feb 2018 17:59:00 +0100 Merge pull request #1178 from PhenomRetroShare/Fix_BugsInRsCollectionDialog
2511934 csoler Sun, 18 Feb 2018 17:58:06 +0100 Merge pull request #1177 from csoler/v0.6-FT
7a84492 csoler Sun, 18 Feb 2018 17:57:42 +0100 Merge pull request #1176 from csoler/v0.6-SecurityFixes
7cda064 csoler Sun, 18 Feb 2018 17:56:51 +0100 merged uptream/master
931fdd0 Phenom Sun, 18 Feb 2018 17:30:01 +0100 Fix bug in processSettings in RsCollectionDialog.cpp
d87061d Phenom Sun, 18 Feb 2018 09:18:44 +0100 Fix bug when adding new items when hashing in RsCollectionDialog
6d0945f Phenom Sun, 18 Feb 2018 08:53:31 +0100 Fix bug when removing root item in RsCollectionDialog
6fe1413 csoler Sat, 17 Feb 2018 23:37:25 +0100 added limiter in number of responses forwarded back by turtle search, which should avoid bursts of bandwidth for popular requests
8708dd9 csoler Sat, 17 Feb 2018 12:04:13 +0100 fixed bug due to wrong service ID in serializer
d57f933 csoler Fri, 16 Feb 2018 23:51:43 +0100 added load/save of known channels to avoid re-displaying it in the NewsFeed after then have been deleted.
252626f csoler Fri, 16 Feb 2018 23:24:01 +0100 added load/save of known forums to avoid re-displaying it in the NewsFeed after then have been deleted.
63ddccd csoler Fri, 16 Feb 2018 13:22:19 +0100 Merge pull request #1175 from PhenomRetroShare/Fix_NewChatInvite
83b6205 Phenom Fri, 16 Feb 2018 10:22:59 +0100 Fix New Chat Invite
5e34467 csoler Thu, 15 Feb 2018 00:06:13 +0100 Merge pull request #1174 from csoler/v0.6-SecurityFixes
47f9a49 csoler Thu, 15 Feb 2018 00:02:08 +0100 improved cost of reseting search in SharedFileDialog by saving hidden indexes list
9c60ff7 csoler Wed, 14 Feb 2018 22:10:11 +0100 Merge pull request #1172 from csoler/v0.6-SecurityFixes
72124bb csoler Wed, 14 Feb 2018 22:08:07 +0100 hide advanced mode option since it is not used anywhere in the software
ede51ab csoler Wed, 14 Feb 2018 22:02:20 +0100 Merge pull request #1171 from csoler/v0.6-SecurityFixes
cf33221 csoler Wed, 14 Feb 2018 22:00:46 +0100 removed dead code in previous commit
ddb2c45 csoler Wed, 14 Feb 2018 21:56:12 +0100 disable and hide signature checkbox when key is already signed in ConnectWizard
42b8ecc csoler Wed, 14 Feb 2018 21:48:56 +0100 prevent RS from making friends with your own location
558bb9f csoler Mon, 12 Feb 2018 23:17:29 +0100 fixed retro-tor build on master branch
3f9c72e csoler Mon, 12 Feb 2018 22:42:22 +0100 Merge pull request #1170 from csoler/v0.6-FT
d8b193c csoler Mon, 12 Feb 2018 22:40:15 +0100 fixed merge with master
01cc232 csoler Mon, 12 Feb 2018 22:39:11 +0100 fixed appearing false line in Transfers
8afa127 csoler Mon, 12 Feb 2018 20:30:01 +0100 fixed crash in RsCollection creation
0491e43 csoler Sun, 11 Feb 2018 21:28:43 +0100 Merge pull request #1169 from csoler/v0.6-FT
7a2d874 csoler Sun, 11 Feb 2018 20:49:45 +0100 Merge pull request #1153 from csoler/v0.6-TorOnly
a2eb145 csoler Sun, 11 Feb 2018 20:40:38 +0100 fixed option in .pri for retrotor configuration
5f106c4 csoler Sat, 10 Feb 2018 15:42:24 +0100 fixed compilation on ubuntu precise
4beadfe csoler Sat, 10 Feb 2018 14:28:15 +0100 updated changelog
fc3beca csoler Fri, 9 Feb 2018 23:02:27 +0100 fixed performance issue (patch from sss)
faf4517 csoler Thu, 8 Feb 2018 15:26:21 +0100 proper error handlign when Tor is not available
644fce8 csoler Thu, 8 Feb 2018 11:14:12 +0100 fixed download menu from Messages
-- Retroshare Dev Team <contact@retroshare.net> Sun, 25 Feb 2018 12:00:00 +0100
retroshare (0.6.3-1.20180210~4beadfe4) xenial; urgency=low
9352a7c csoler Thu, 8 Feb 2018 10:34:46 +0100 Merge pull request #1168 from PhenomRetroShare/Add_ConnFilterInFriendSel
bf8bd4b Phenom Wed, 7 Feb 2018 19:00:08 +0100 Add Only Connected in FriendSelectionWidget.
7bb8eb0 csoler Wed, 7 Feb 2018 16:06:54 +0100 Merge pull request #1166 from PhenomRetroShare/Add_ChatRoomRSLink
02b61b2 csoler Wed, 7 Feb 2018 15:58:12 +0100 Merge pull request #1164 from aral/patch-1
a496e6f Phenom Sun, 4 Feb 2018 17:51:26 +0100 Add Chat Room RSLink
ed88b34 Aral B Sun, 4 Feb 2018 10:37:45 +0100 Fix typo in Mac install guide
b662e66 Gioacc Fri, 2 Feb 2018 00:20:14 +0100 Qml app fix disappearing sidebar buttons
6c85075 csoler Thu, 1 Feb 2018 21:35:54 +0100 lobby->room in Identities dialog
36e20db Gioacc Thu, 1 Feb 2018 21:26:36 +0100 Fix some glitches in qml app menu
6e093c7 Gioacc Thu, 1 Feb 2018 14:59:08 +0100 Qml token manager removed unuseful debug message
2d00532 Gioacc Thu, 1 Feb 2018 14:42:46 +0100 Qml app fix sidebar buttons hiding behaviour
1c698bf Gioacc Thu, 1 Feb 2018 14:31:07 +0100 Qml App add option to control DHT behaviour
9a9fcca Gioacc Thu, 1 Feb 2018 14:22:33 +0100 Qml App token manager offer unregister token API
1e3d2c2 csoler Tue, 30 Jan 2018 20:55:01 +0100 Merge pull request #1160 from G10h4ck/android_service_cleaning
6f91b93 Gioacc Tue, 30 Jan 2018 20:07:51 +0100 Add some sanity check in libresapiclient
4d60850 Gioacc Tue, 30 Jan 2018 18:25:04 +0100 More cleanup of .pro files
0012586 Gioacc Tue, 30 Jan 2018 18:24:03 +0100 Add support for SQLCipher on Android
ebfe50f Gioacc Tue, 30 Jan 2018 18:11:31 +0100 Make .pro files compiler agnostic on Android
da2fc01 Gioacc Tue, 30 Jan 2018 18:04:24 +0100 Cleanup a bit libresapi.pro
180a5b1 Gioacc Tue, 30 Jan 2018 18:02:55 +0100 Remove unnecessary dependencies in android-notify-service
feae9f5 Gioacc Tue, 30 Jan 2018 00:36:19 +0100 Fix some compiler warnings
fc5ed14 Gioacc Mon, 29 Jan 2018 22:44:04 +0100 Android toolchain builder libraries update
fa71ed2 Gioacc Mon, 29 Jan 2018 13:26:43 +0100 Install bdboot.txt in Android
2d8493f Gioacc Mon, 29 Jan 2018 10:56:12 +0100 Add link on how help confused gdb to give stacktrace
efe78f5 csoler Sun, 28 Jan 2018 21:54:56 +0100 slight optimization to showEvent() and save/restore visible items in file lists
d598a01 Gioacc Sun, 28 Jan 2018 11:38:14 +0100 ApiLocalListener do some sanity check on listen
5a63ce8 Gioacc Sun, 28 Jan 2018 11:36:51 +0100 Android service avoid shouldexit timer using all CPU available
3e5ed6a Gioacc Fri, 26 Jan 2018 00:18:31 +0100 Update Androig gdb debug instructions
c39b3e5 Gioacc Thu, 25 Jan 2018 16:20:25 +0100 Better debug messages for Android app
ac9a843 Gioacc Thu, 25 Jan 2018 15:50:12 +0100 Gracefully handle signals in retroshare-android-service
8c21bfc Gioacc Thu, 25 Jan 2018 15:18:12 +0100 Avoid crash on stop in ApiServerLocal
c1d8d6a Gioacc Thu, 25 Jan 2018 15:14:09 +0100 Properly run Qt event loop
d80a806 csoler Thu, 25 Jan 2018 09:37:31 +0100 Merge pull request #1159 from csoler/v0.6-FileLists
11eef05 csoler Wed, 24 Jan 2018 22:02:49 +0100 fixed bug causing hidden/expanded items to be reset by show() event in SharedFilesDialog
1fbd9d1 csoler Wed, 24 Jan 2018 21:26:35 +0100 fixed hiding of top level items when searching
f139685 csoler Wed, 24 Jan 2018 21:14:26 +0100 added a fair limit to search in FL in order to avoid crazy costs
d93e259 csoler Wed, 24 Jan 2018 00:26:22 +0100 fixed expanding/collapsing of items on search
1ee353c csoler Tue, 23 Jan 2018 22:18:35 +0100 improved efficiency of search in tree visualization mode. Re-enabled the search for testing purpose.
725abad csoler Tue, 23 Jan 2018 22:18:02 +0100 fixed a bug in filterItems that caused searched files to generate an error in the console
9b286c4 Gioacc Tue, 23 Jan 2018 11:13:03 +0100 add to README that DHT is not working on android
000bbbd Gioacc Tue, 23 Jan 2018 10:33:00 +0100 Add link to Android debugging documentation
7afa19e csoler Sun, 21 Jan 2018 22:23:08 +0100 removed search from tree view in file lists, until I find some way to do it more efficiently
7448ff4 csoler Sun, 21 Jan 2018 19:07:37 +0100 re-enabled search in file lists tree view
d21a5e5 csoler Sat, 20 Jan 2018 19:25:52 +0100 Merge pull request #1157 from PhenomRetroShare/Fix_IconCacheInFilesDefs
f74ee5c Phenom Sat, 20 Jan 2018 17:21:37 +0100 Move File Icon Cache in FilesDefs
7652821 Phenom Sat, 20 Jan 2018 17:18:50 +0100 Revert "patch from sss to cache TransfersDialog QIcons"
4c626e0 csoler Mon, 15 Jan 2018 23:17:09 +0100 Merge pull request #1152 from csoler/v0.6-SecurityFixes
841fee6 csoler Mon, 15 Jan 2018 23:13:42 +0100 fixed possible crash due to accessing deleted memory in database cache access
7cac367 csoler Sun, 14 Jan 2018 22:39:50 +0100 removed warnign about bad service string when the service string is actually empty
388b2c2 csoler Fri, 12 Jan 2018 22:47:42 +0100 patch from sss to cache TransfersDialog QIcons
783e918 csoler Fri, 12 Jan 2018 22:19:52 +0100 Merge pull request #1151 from csoler/v0.6-SecurityFixes
bbd8afe csoler Thu, 11 Jan 2018 18:14:20 +0100 Merge pull request #1150 from chelovechishko/unfocus_chat_text_edit
173336e csoler Thu, 11 Jan 2018 18:12:22 +0100 Merge pull request #1148 from chelovechishko/qdarkstyle_fix
b4ff14c csoler Thu, 11 Jan 2018 18:06:48 +0100 Merge pull request #1144 from PhenomRetroShare/Fix_DisableYesButtonOnInvite
bb9dcbb Phenom Fri, 5 Jan 2018 14:45:29 +0100 Disable Yes button on chat room invitation if no Id selected.
add9c1e chelov Wed, 10 Jan 2018 20:53:43 +0900 chatwidget: do not set focus to edit when it is not necessary
4eea5a8 csoler Wed, 10 Jan 2018 00:10:08 +0100 removed consts in GrpMetaCache pointers, and made it possible to always re=use cache entries, possibly updating them
553ab93 csoler Tue, 9 Jan 2018 22:18:01 +0100 Merge pull request #1149 from csoler/v0.6-SecurityFixes
506190a csoler Tue, 9 Jan 2018 22:11:11 +0100 fixed bug causing failure of flag actions on groups
ed81b4c csoler Tue, 9 Jan 2018 21:49:15 +0100 removed delete causing read of deleted memory
51c7942 csoler Mon, 8 Jan 2018 19:08:10 +0100 Merge pull request #1146 from csoler/v0.6-SecurityFixes
e261d45 chelov Mon, 8 Jan 2018 16:16:10 +0900 gui: fix networkdialog colors once more in qdarkstyle.qss
f8f61cc chelov Mon, 8 Jan 2018 16:02:40 +0900 gui: fix colors for idtree of people in qdarkstyle.qss
884bbb4 chelov Mon, 8 Jan 2018 15:58:04 +0900 gui: make friendlist more readable in some places in qdarkstyle.qss
622316a chelov Mon, 8 Jan 2018 15:49:05 +0900 gui: improve readability of sharemanager for qdarkstyle.qss
5e57cb4 csoler Sun, 7 Jan 2018 23:02:22 +0100 fixed gxs unit tests
85b94d7 csoler Sun, 7 Jan 2018 22:36:49 +0100 fixed test compilation
89c538d csoler Sun, 7 Jan 2018 22:36:38 +0100 fixed double deletion problem causing crashes
b42b8e3 csoler Sun, 7 Jan 2018 21:41:41 +0100 moved memory ownership of RsGxsGrpMetaData down into RsGxsDataAccess. Avoids many copy-constructors of RsTlvSecurityKey. Will probably spare a lot of CPU on windows
c3e300e Gioacc Sat, 6 Jan 2018 22:53:26 +0100 Merge pull request #1140 from Emotyco/libresapi_small_corrections
67fc6a3 Konrad Sat, 6 Jan 2018 19:29:56 +0100 Fixed in Libresapi: Double declaration of StateToken in FileSharingHandler
575a416 Konrad Sat, 6 Jan 2018 19:09:44 +0100 Changed in Libresapi: Used Doxigen style comments
d53993c Konrad Sat, 6 Jan 2018 18:39:47 +0100 Changed in Libresapi: Pointer to RsNotify object into reference
57f41d9 csoler Fri, 5 Jan 2018 21:27:18 +0100 Merge pull request #1145 from PhenomRetroShare/Fix_ClearPersonDetailIfNoSelection
4026040 Konrad Fri, 5 Jan 2018 20:44:48 +0100 Libresapi: Extended ChatInfo class to contain own identity used in chat
4f902bb Phenom Fri, 5 Jan 2018 17:48:18 +0100 Clear Person Detail when no selection
0078b9c csoler Wed, 3 Jan 2018 20:33:25 +0100 Merge pull request #1143 from csoler/v0.6-SecurityFixes
98d1d08 csoler Wed, 3 Jan 2018 20:32:37 +0100 removed extra links from chat widget, since normal links can be used now to DL through encrypted tunnels
ee81eef csoler Wed, 3 Jan 2018 18:42:04 +0100 Merge pull request #1142 from csoler/v0.6-SecurityFixes
ab60f49 csoler Wed, 3 Jan 2018 18:37:43 +0100 prevent sending/receiving of IP addresses to/at hidden nodes
0a92710 csoler Wed, 3 Jan 2018 15:03:23 +0100 Merge pull request #1141 from csoler/v0.6-SecurityFixes
0f6006d csoler Wed, 3 Jan 2018 15:01:04 +0100 prevent subscribing to a signed chat room without a signed identity
eea0c64 csoler Wed, 3 Jan 2018 14:05:13 +0100 require signed identity to respond to a signed chat room invite. Avoids "god mode" bug.
96e7507 Konrad Mon, 1 Jan 2018 23:38:07 +0100 Added in Libresapi: Short comment to FileSharingHandler
9bb6adc Konrad Mon, 1 Jan 2018 23:27:46 +0100 Added in Libresapi: Missing mutex locking in TransfersHandler
6a61e0a Konrad Mon, 1 Jan 2018 23:20:26 +0100 Changed in Libresapi: Locking mutex using macro instead of RsStackMutex object creation
74a56f6 Konrad Fri, 29 Dec 2017 16:07:39 +0100 Changed in Libresapi: Closing distant connection (chat) requires now ChatId that is used in other functions, instead of DistantCharPeerId
4b25684 Konrad Fri, 29 Dec 2017 16:03:45 +0100 Added in Libresapi: Functions to get and set default identity for lobby
b24d772 Konrad Wed, 27 Dec 2017 22:38:04 +0100 Added in Libresapi: Getting node name in PeersHandler
2db25d4 Konrad Wed, 27 Dec 2017 22:37:14 +0100 Added in Libresapi: StateToken refreshing to TransferHandler
53118e5 Konrad Wed, 27 Dec 2017 22:35:51 +0100 Added in Libresapi: Missing bracket in ChatHandler
92df847 Konrad Wed, 27 Dec 2017 22:33:23 +0100 Added in Libresapi: StateTokens to FileSharingHandler
55385d7 Konrad Wed, 27 Dec 2017 22:31:17 +0100 Added in Libresapi: Marking particular message as read
49cacc4 csoler Sun, 24 Dec 2017 12:04:15 +0100 fixed compilation on ubuntu precise
122f6af csoler Sun, 24 Dec 2017 11:06:03 +0100 fixed compilation on ubuntu precise
72d64c7 csoler Sun, 24 Dec 2017 10:36:08 +0100 updated changelog
-- Retroshare Dev Team <contact@retroshare.net> Sat, 10 Feb 2018 14:00:00 +0100
retroshare (0.6.3-1.20171224.72d64c7d~artful) precise; urgency=low
c2d5579 csoler Thu, 21 Dec 2017 17:06:32 +0100 storage of chat room icons in local variables to avoid re-reading them from qrc everytime (patch from sss)
acd8355 Gioacc Wed, 20 Dec 2017 18:24:28 +0100 Add some documentation on how to debug retroshare on android
c0d8333 csoler Mon, 18 Dec 2017 16:10:52 +0100 Merge pull request #1136 from csoler/v0.6-FT
ed0e280 csoler Mon, 18 Dec 2017 16:01:27 +0100 Merge pull request #1135 from PhenomRetroShare/Fix_DontSetMacOsTargetIfNotMacOs
4950ffb Phenom Fri, 15 Dec 2017 10:01:30 +0100 Don't Set Target and SDK if not MacOS
0895b3d csoler Sun, 17 Dec 2017 13:55:50 +0100 Merge pull request #1134 from PhenomRetroShare/Fix_TravisCI_MacOS_Compil
3007fec csoler Sat, 16 Dec 2017 17:46:44 +0100 fixed colors in keyring with new ModelIndex based view (patch from sss)
99e35b1 csoler Sat, 16 Dec 2017 15:04:16 +0100 rename file in partials into real name before moving it; check for destination directory before moving file
a3acd58 Phenom Fri, 8 Dec 2017 19:00:34 +0100 Fix TravisCI on MacOS compilation.
acbcba8 csoler Thu, 7 Dec 2017 17:20:27 +0100 attempt to fix icon sizes in identity dialog
d2c8ba1 csoler Mon, 4 Dec 2017 16:33:45 +0100 Merge pull request #1117 from chelovechishko/qdarkstyle_fix
22292fc csoler Mon, 4 Dec 2017 16:32:37 +0100 Merge pull request #1118 from RetroPooh/net_settings_antifreeze
621ed71 csoler Mon, 4 Dec 2017 16:31:48 +0100 Merge pull request #1120 from sehraf/pr_fixForumDownloadAll
0503f42 csoler Mon, 4 Dec 2017 16:30:29 +0100 Merge pull request #1119 from RetroPooh/chan-fix-cyr
49b4057 sehraf Sat, 2 Dec 2017 15:00:24 +0100 fix 'download all' button for forum. Now all file links are opened in one collection dialog instead of each link in one separate dialog.
98d2772 chelov Sat, 2 Dec 2017 17:10:15 +0900 gui: make forums_dialog slightly more readable sometimes
8ec69df RetroP Wed, 29 Nov 2017 19:23:52 +0300 fix cyrillic text sent wrong in channel post
a88c2ef RetroP Wed, 29 Nov 2017 17:17:49 +0300 fix freezes in network settings
b99a1a5 defnax Tue, 28 Nov 2017 19:36:39 +0100 fixed the emote file for unshown emotes on gui
d1cdba8 Chelov Mon, 27 Nov 2017 14:48:14 +0900 gui: fix probably mistake with names in qdarkstyle.qss
8c34a50 Chelov Mon, 27 Nov 2017 11:16:37 +0900 gui: fix default color of some text in friends list in qdarkstyle.qss
d566a2a Chelov Mon, 27 Nov 2017 10:54:19 +0900 gui: fix keyring background color in qdarkstyle.qss
c05dd30 Chelov Mon, 27 Nov 2017 10:40:24 +0900 gui: fix doubled semicolons in qdarkstyle.qss
63b3acb csoler Thu, 23 Nov 2017 21:27:03 +0100 Merge pull request #1113 from csoler/v0.6-SSL110Fix
1faa274 csoler Wed, 22 Nov 2017 23:46:57 +0100 simplified memory management in certificate signature verification code
669f2ba csoler Wed, 22 Nov 2017 22:56:40 +0100 fixed a few bugs in signature verification code accross versions
c8c90ab csoler Wed, 22 Nov 2017 20:31:49 +0100 Merge pull request #1115 from PhenomRetroShare/Add_CopyComment
f6d69e0 csoler Wed, 22 Nov 2017 00:02:11 +0100 ensured maximum backward compatibility for crypto changes that will occur in future v0.7
6d4c942 Gioacc Tue, 21 Nov 2017 13:28:24 +0100 Removed unnecessary executable flag on some files
49d2366 csoler Tue, 21 Nov 2017 09:29:52 +0100 fixed windows compilation
ea241f6 csoler Tue, 21 Nov 2017 09:27:21 +0100 restored plugins removed by previous commit
d905144 csoler Mon, 20 Nov 2017 23:18:53 +0100 Merge pull request #1114 from PhenomRetroShare/Fix_DisableReplyToSystemMessage
d1d66bb csoler Mon, 20 Nov 2017 23:17:16 +0100 Merge pull request #1079 from csoler/v0.6-Keyring
e2c1661 csoler Mon, 20 Nov 2017 22:44:34 +0100 fixed compilation with v0.7 defines
cd51afb csoler Mon, 20 Nov 2017 22:26:14 +0100 fixed small bug in signature and compilation
9367aa0 csoler Sun, 19 Nov 2017 20:15:36 +0100 changed #ifs into #ifdefs because it us more robust, and moved the definition of variables to retroshare.pri
ef1a613 csoler Sun, 19 Nov 2017 19:57:38 +0100 added proper debug output for signature verification
863e625 csoler Sun, 19 Nov 2017 19:34:54 +0100 centralized the defines into a single file
e72bd9f csoler Sun, 19 Nov 2017 18:38:46 +0100 fixed bug causing certificate rejection
b4fdd4e csoler Sun, 19 Nov 2017 18:21:56 +0100 added two additional non packward compatible changes for future version 0.7, and improvements of verifications of certificate signatures
46a6bdc Phenom Sat, 18 Nov 2017 19:48:38 +0100 Add Copy action for Gxs Comments.
71efb9f Phenom Sat, 18 Nov 2017 18:49:42 +0100 Disable ReplyTo if System Message.
7472f78 csoler Wed, 15 Nov 2017 23:24:43 +0100 added sha256 calculation functions, and non backward compatible SSL Id computation code to active later (0.7)
ce14219 csoler Tue, 14 Nov 2017 21:39:46 +0100 merged with upstream/master
9f8f0e9 csoler Tue, 14 Nov 2017 21:36:04 +0100 fixed column names in keyring
ba7cf49 csoler Tue, 14 Nov 2017 20:53:24 +0100 Merge pull request #1037 from RetroPooh/searchspy
556f93c csoler Tue, 14 Nov 2017 20:51:25 +0100 Merge pull request #1108 from RetroPooh/smallfixes2
2f6517a csoler Tue, 14 Nov 2017 20:50:57 +0100 Merge pull request #1112 from RetroPooh/coll_name_as_dir
fdced92 csoler Tue, 14 Nov 2017 20:41:48 +0100 Merge pull request #1111 from RetroPooh/searstr
1f207ba RetroP Tue, 14 Nov 2017 19:52:48 +0300 create collection dialog filename as dir name
919d650 RetroP Tue, 14 Nov 2017 16:09:05 +0300 in search strings change comma to space for better look
9aa6dd3 Pooh Tue, 14 Nov 2017 14:34:22 +0300 Update rsturtleitem.h
8368a76 csoler Mon, 13 Nov 2017 23:38:25 +0100 Merge pull request #1110 from csoler/v0.6-FT
5fab053 csoler Mon, 13 Nov 2017 23:37:53 +0100 added toStdString() method to search strings so as to display what is searched
7304c48 csoler Mon, 13 Nov 2017 22:32:30 +0100 Merge pull request #1109 from csoler/v0.6-Links2
5d6225a RetroP Tue, 14 Nov 2017 00:14:16 +0300 sort by time, nicer look
1669cd4 csoler Mon, 13 Nov 2017 22:08:05 +0100 use "download..." menu with RsCollectionDialog with multiple files and directories
f369ac1 RetroP Mon, 13 Nov 2017 19:05:16 +0300 fix mail fields stretching with CC BCC
45c8e9e csoler Mon, 13 Nov 2017 11:01:48 +0100 Merge pull request #1107 from csoler/v0.6-Links2
5997c10 csoler Sun, 12 Nov 2017 22:46:29 +0100 fixed bug causing RsCollection to fail on remote files. Now using RsCollectionDialog when downloading directories from friend shared files
c0951b3 csoler Sun, 12 Nov 2017 21:33:21 +0100 Merge pull request #1040 from RetroPooh/searchmultinames2
240d3a6 csoler Sat, 11 Nov 2017 16:33:30 +0100 Merge pull request #1104 from RetroPooh/linkaddrtooltips
cb77243 csoler Sat, 11 Nov 2017 16:31:33 +0100 Merge pull request #1105 from RetroPooh/smallfixes1
9b66e7e RetroP Fri, 10 Nov 2017 18:32:18 +0300 fix non-latin peer name display in bw stats
792f7ff RetroP Fri, 10 Nov 2017 18:31:41 +0300 fix status led icons for distant chat
df244fd RetroP Fri, 10 Nov 2017 16:01:11 +0300 add tooltips with address to urls
7feb630 csoler Wed, 8 Nov 2017 20:11:26 +0100 Merge pull request #1102 from csoler/v0.6-Links2
6a8bc8b csoler Wed, 8 Nov 2017 18:11:46 +0100 use of RsCollectionDialog for processing single file links. Only "extra" links still require the older processing system because RsCollections cannot have sources for each entry
-- Retroshare Dev Team <contact@retroshare.net> Thu, 24 Dec 2017 10:00:00 +0100
retroshare (0.6.3-1.20171107.c67143d4~wily) wily; urgency=low
68b35f3 Phenom Tue, 15 Aug 2017 19:45:26 +0200 Fix CppCheck in notifytxt.cc
0b8d684 Phenom Tue, 15 Aug 2017 19:11:32 +0200 Fix CppCheck in framecatcher.cpp

View File

@ -1,11 +1,11 @@
#!/bin/sh
rm -f ./libssh-0.5.4.tar.gz.*
rm -f ./retroshare_0.6.3-1.*_source.build
rm -f ./retroshare_0.6.3-1.*_source.changes
rm -f ./retroshare_0.6.3-1.*.tar.gz
rm -f ./retroshare_0.6.3-1.*.diff.gz
rm -f ./retroshare_0.6.3-1.*.dsc
rm -f ./retroshare_0.?.?-1.*_source.build
rm -f ./retroshare_0.?.?-1.*_source.changes
rm -f ./retroshare_0.?.?-1.*.tar.gz
rm -f ./retroshare_0.?.?-1.*.diff.gz
rm -f ./retroshare_0.?.?-1.*.dsc
rm -f *.upload
rm -f *~

View File

@ -0,0 +1,20 @@
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qt5-default
Standards-Version: 3.9.6
Homepage: http://retroshare.net
Package: retrotor
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring, tor (>= 0.2.6)
Conflicts: retroshare-nogui,retroshare06,retroshare
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
encrypt all communication. RetroShare provides filesharing, chat, messages,
forums and channels.

View File

@ -0,0 +1,20 @@
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qt5-default
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retrotor
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring, tor (>= 0.2.6)
Conflicts: retroshare-nogui,retroshare06,retroshare
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
encrypt all communication. RetroShare provides filesharing, chat, messages,
forums and channels.

View File

@ -0,0 +1,5 @@
debian/tmp/usr/bin/retroshare
debian/tmp/usr/share/applications/retroshare.desktop
debian/tmp/usr/share/icons/hicolor/*
debian/tmp/usr/share/pixmaps/retroshare.xpm
debian/tmp/usr/share/retroshare/*

View File

@ -3,7 +3,7 @@
configure: configure-stamp
configure-stamp:
dh_testdir
cd src && qmake "CONFIG-=debug" "CONFIG+=release" "CONFIG+=rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib RetroShare.pro
cd src && qmake "CONFIG-=debug" "CONFIG+=release" "CONFIG+=rs_autologin" "CONFIG+=retroshare_plugins" PREFIX=/usr LIB_DIR=/usr/lib RetroShare.pro
touch $@

View File

@ -1,14 +1,23 @@
#!/bin/sh
###################### PARAMETERS ####################
version="0.6.3"
gitpath="https://github.com/RetroShare/RetroShare.git"
workdir=retroshare-${version}
branch="master"
#branch="v0.6.3-official_release"
#bubba3="Y" # comment out to compile for bubba3
######################################################
RS_MAJOR_VERSION=`fgrep RS_MAJOR_VERSION ../../libretroshare/src/retroshare/rsversion.h | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1`
RS_MINOR_VERSION=`fgrep RS_MINOR_VERSION ../../libretroshare/src/retroshare/rsversion.h | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1`
RS_BUILD_NUMBER=`fgrep RS_BUILD_NUMBER ../../libretroshare/src/retroshare/rsversion.h | grep -v BUILD_NUMBER_ADD | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1`
# echo "RS_MAJOR_VERSION="${RS_MAJOR_VERSION}
# echo "RS_MINOR_VERSION="${RS_MINOR_VERSION}
# echo "RS_BUILD_NUMBER="${RS_BUILD_NUMBER}
version_number="${RS_MAJOR_VERSION}"'.'"${RS_MINOR_VERSION}"'.'"${RS_BUILD_NUMBER}"
workdir=retroshare-${version_number}
echo This script is going to build the debian source package for RetroShare, from the Git repository.
if test -d "${workdir}" ; then
@ -27,6 +36,7 @@ time=`git log --pretty=format:"%aD" | head -1 | cut -d\ -f5 | sed -e s/://g`
hhsh=`git log --pretty=format:"%H" | head -1 | cut -c1-8`
rev=${date}.${hhsh}
useretrotor="false"
while [ ${#} -gt 0 ]; do
case ${1} in
@ -34,6 +44,9 @@ while [ ${#} -gt 0 ]; do
rev=${1}
shift
;;
"-retrotor") shift
useretrotor="true"
;;
"-distribution") shift
dist=${1}
shift
@ -54,26 +67,42 @@ while [ ${#} -gt 0 ]; do
esac
done
if test "${useretrotor}" = "true"; then
if ! test "${dist}" = "trusty"; then
echo ERROR: retro-tor can only be packaged for trusty for now.
exit 1;
fi
#gitpath="https://github.com/csoler/RetroShare.git"
#branch="v0.6-TorOnly"
fi
if test "${dist}" = "" ; then
dist="precise trusty xenial zesty artful"
dist="trusty xenial artful"
fi
echo Attempting to get revision number...
ccount=`git rev-list --count --all`
ccount=`expr $ccount + 8613 - 8267`
echo " "Using PGP key id : ${gpgkey}
echo " "Using distributions: ${dist}
echo " "Commit count : ${ccount}
echo " "Date : ${date}
echo " "Time : ${time}
echo " "Hash : ${hhsh}
echo " "Using branch : ${branch}
echo " "Using revision : ${rev}
echo " Workdir :"${workdir}
echo " Version :"${version_number}
echo " Using revision :"${rev}
echo " Commit count :"${ccount}
echo " Hash :"${hhsh}
echo " Date :"${date}
echo " Time :"${time}
echo " Using branch :"${branch}
echo " Using distributions:"${dist}
echo " Using PGP key id :"${gpgkey}
if test ${useretrotor} = "true"; then
echo " "Specific flags : retrotor
fi
echo Done.
version="${version}"."${rev}"
echo Got version number ${version}.
version="${version_number}"."${rev}"
echo Got version number ${version}
echo
echo Please check that the changelog is up to date.
echo Hit ENTER if this is correct. Otherwise hit Ctrl+C
read tmp
@ -83,7 +112,7 @@ echo Extracting base archive...
mkdir -p ${workdir}/src
echo Checking out latest snapshot...
cd ${workdir}/src
git clone --depth 1 https://github.com/RetroShare/RetroShare.git --single-branch --branch $branch .
git clone --depth 1 ${gitpath} --single-branch --branch $branch .
# if ! test "$hhsh" = "" ; then
# echo Checking out revision $hhsh
@ -119,15 +148,18 @@ echo Cleaning...
echo Calling debuild...
for i in ${dist}; do
echo copying changelog for ${i}
sed -e s/XXXXXX/"${rev}"/g -e s/YYYYYY/"${i}"/g ../changelog > debian/changelog
sed -e s/XXXXXX/"${rev}"/g -e s/YYYYYY/"${i}"/g -e s/ZZZZZZ/"${version_number}"/g ../changelog > debian/changelog
if test -f ../control."${i}" ; then
if test ${useretrotor} = "true"; then
cp ../rules.retrotor debian/rules
cp ../control.trusty_retrotor debian/control
elif test -f ../control."${i}" ; then
echo \/\!\\ Using specific control file for distribution "${i}"
cp ../control."${i}" debian/control
cp ../control."${i}" debian/control
else
echo Using standard control file control."${i}" for distribution "${i}"
cp ../debian/control debian/control
fi
cp ../debian/control debian/control
fi
debuild -S -k${gpgkey}
done

View File

@ -1,4 +1,4 @@
#!/bin/sh
for i in `ls retroshare_0.6.3-1.*.changes` ; do
for i in `ls retroshare_0.6.4-1.*.changes` ; do
dput ppa:retroshare/unstable $i
done

View File

@ -0,0 +1,61 @@
#!/usr/bin/make -f
configure: configure-stamp
configure-stamp:
dh_testdir
cd src && qmake "CONFIG-=debug" "CONFIG+=release retrotor" "CONFIG+=rs_autologin" PREFIX=/usr LIB_DIR=/usr/lib RetroShare.pro
touch $@
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# Add here commands to compile the package.
# cd libssh-0.6.4 && mkdir -p build && cd build && cmake -DWITH_STATIC_LIB=ON .. && make
# cd sqlcipher && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" && make
# mkdir lib
# cp -r libssh-0.6.4 lib/
#cp -r sqlcipher lib/
#cd src/rsctrl/src && make
cd src && $(MAKE)
touch $@
clean:
dh_testdir
dh_testroot
rm -f configure-stamp build-stamp
# Add here commands to clean up after the build process.
[ ! -f src/Makefile ] || (cd src && $(MAKE) distclean)
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
#dh_installdirs
cd src && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_install --list-missing
#dh_installdocs
#dh_installexamples
#dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View File

@ -1,17 +1,17 @@
ZLIB_VERSION=1.2.3
BZIP2_VERSION=1.0.6
MINIUPNPC_VERSION=2.0
OPENSSL_VERSION=1.0.2k
OPENSSL_VERSION=1.0.2n
SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2rc3
OPENCV_VERSION=3.2.0
LIBXML2_VERSION=2.9.4
LIBXSLT_VERSION=1.1.28
CURL_VERSION=7.53.1
OPENCV_VERSION=3.4.1
LIBXML2_VERSION=2.9.7
LIBXSLT_VERSION=1.1.32
CURL_VERSION=7.58.0
TCL_VERSION=8.6.2
SQLCIPHER_VERSION=2.2.1
LIBMICROHTTPD_VERSION=0.9.52
FFMPEG_VERSION=3.2.4
LIBMICROHTTPD_VERSION=0.9.59
FFMPEG_VERSION=3.4
MAKEFILE_PATH=$(dir $(MAKEFILE_LIST))
LIBS_PATH?=$(MAKEFILE_PATH)../../../../libs
@ -137,7 +137,7 @@ libs/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar
speex: libs/speex-$(SPEEX_VERSION)
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
libs/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
# prepare
@ -158,7 +158,7 @@ libs/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
speexdsp: libs/speexdsp-$(SPEEXDSP_VERSION)
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
libs/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# prepare
@ -187,7 +187,7 @@ libs/opencv-$(OPENCV_VERSION): $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
# build
mkdir -p opencv-$(OPENCV_VERSION)/build
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs"
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install"
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_CXX11=ON -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -DSTRSAFE_NO_DEPRECATE" -DCMAKE_INSTALL_PREFIX="`pwd`/install"
cd opencv-$(OPENCV_VERSION)/build && make install
# copy files
mkdir -p libs/opencv-$(OPENCV_VERSION).tmp/include
@ -228,7 +228,6 @@ libs/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar
rm -r -f libs/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf $(MAKEFILE_PATH)libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
# build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make
@ -245,7 +244,7 @@ libs/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar
curl: libs/curl-$(CURL_VERSION)
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz:
wget --no-check-certificate http://curl.haxx.se/$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
libs/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# prepare

View File

@ -0,0 +1,27 @@
@echo off
setlocal
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env
%cecho% info "Build libraries"
call "%~dp0build-libs\build-libs.bat" auto-copy
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
%cecho% info "Build %SourceName%"
call "%~dp0build\build.bat" retrotor
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%"
call "%~dp0build\pack.bat" retrotor
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
exit /B 0
:error_env
echo Failed to initialize environment.
exit /B 1

View File

@ -13,11 +13,11 @@ call "%~dp0build-libs\build-libs.bat" auto-copy
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
%cecho% info "Build %SourceName%"
call "%~dp0build\build.bat"
call "%~dp0build\build.bat" standard
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Pack %SourceName%"
call "%~dp0build\pack.bat"
call "%~dp0build\pack.bat" standard
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
%cecho% info "Build installer"

View File

@ -21,7 +21,7 @@ set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
call "%~dp0env.bat" standard
if errorlevel 1 goto error_env
:: Build defines for script

View File

@ -21,7 +21,7 @@ set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
call "%~dp0env.bat" %*
if errorlevel 1 goto error_env
:: Check git executable
@ -36,7 +36,7 @@ echo.
echo === Version
echo.
title Build - %SourceName%-%RsBuildConfig% [Version]
title Build - %SourceName%%RsType%-%RsBuildConfig% [Version]
pushd "%SourcePath%\retroshare-gui\src\gui\images"
:: Touch resource file
@ -50,16 +50,19 @@ echo.
echo === qmake
echo.
title Build - %SourceName%-%RsBuildConfig% [qmake]
title Build - %SourceName%%RsType%-%RsBuildConfig% [qmake]
qmake "%SourcePath%\RetroShare.pro" -r "CONFIG+=%RsBuildConfig% version_detail_bash_script rs_autologin"
set RS_QMAKE_CONFIG=%RsBuildConfig% version_detail_bash_script rs_autologin retroshare_plugins
if "%RsRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retrotor
qmake "%SourcePath%\RetroShare.pro" -r "CONFIG+=%RS_QMAKE_CONFIG%"
if errorlevel 1 goto error
echo.
echo === make
echo.
title Build - %SourceName%-%RsBuildConfig% [make]
title Build - %SourceName%%RsType%-%RsBuildConfig% [make]
if exist "%EnvJomExe%" (
"%EnvJomExe%"

View File

@ -7,7 +7,7 @@ call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env
call "%~dp0env.bat"
call "%~dp0env.bat" %*
if errorlevel 1 goto error_env
if not exist "%RsBuildPath%" exit /B 0

View File

@ -1,3 +1,18 @@
if "%~1"=="standard" (
set RsRetroTor=
set RsType=
) else (
if "%~1"=="retrotor" (
set RsRetroTor=1
set RsType=-tor
) else (
echo.
echo Usage: standard^|retrotor
echo.
exit /B 1
)
)
set BuildPath=%EnvRootPath%\builds
set DeployPath=%EnvRootPath%\deploy
@ -19,8 +34,8 @@ call "%ToolsPath%\get-qt-version.bat" QtVersion
if "%QtVersion%"=="" echo Cannot get Qt version.& exit /B 1
set RsBuildConfig=release
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%-%RsBuildConfig%
set RsBuildPath=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%
set RsPackPath=%DeployPath%
set RsArchiveAdd=

View File

@ -1,19 +1,19 @@
:: Usage:
:: call git-log.bat [no-ask]
:: call git-log.bat standard|retrotor [no-ask]
@echo off
setlocal
set NoAsk=
if "%~1"=="no-ask" set NoAsk=1
if "%~2"=="no-ask" set NoAsk=1
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env.bat"
if errorlevel 1 goto error_env
call "%~dp0env.bat"
call "%~dp0env.bat" %1
if errorlevel 1 goto error_env
:: Check git executable
@ -58,7 +58,7 @@ for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
:: Get last revision
set RsLastRefFile=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%-LastRef.txt
set RsLastRefFile=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%-LastRef.txt
set RsLastRef=
if exist "%RsLastRefFile%" set /P RsLastRef=<"%RsLastRefFile%"
@ -86,9 +86,9 @@ if %errorlevel%==2 exit /B 1
:no_confirm
if "%RsBuildConfig%" NEQ "release" (
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.txt
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.txt
) else (
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.txt
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.txt
)
title %SourceName%-%RsBuildConfig% [git log]

View File

@ -23,7 +23,7 @@ set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
:: Initialize environment
call "%~dp0env.bat"
call "%~dp0env.bat" %*
if errorlevel 1 goto error_env
:: Remove deploy path
@ -65,6 +65,17 @@ set RsDate=
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
if "%RsRetroTor%"=="1" (
:: Check Retrotor
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
echo Tor binary not found. Please download Tor Expert Bundle from
echo https://www.torproject.org/download/download.html.en
echo and unpack to
echo %EnvDownloadPath%\tor
goto error
)
)
set QtMainVersion=%QtVersion:~0,1%
rem Qt 4 = QtSvg4.dll
@ -75,9 +86,9 @@ if "%QtMainVersion%"=="4" set QtMainVersion2=4
if "%QtMainVersion%"=="5" set QtMainVersion1=5
if "%RsBuildConfig%" NEQ "release" (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.7z
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
) else (
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.7z
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
)
if exist "%Archive%" del /Q "%Archive%"
@ -85,7 +96,7 @@ if exist "%Archive%" del /Q "%Archive%"
:: Create deploy path
mkdir "%RsDeployPath%"
title Pack - %SourceName%-%RsBuildConfig% [copy files]
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
set Extensions=
@ -128,6 +139,12 @@ if "%QtMainVersion%"=="5" (
copy "%QtPath%\..\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
)
if exist "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" (
echo Copy styles
mkdir "%RsDeployPath%\styles" %Quite%
copy "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
)
copy "%QtPath%\..\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite%
del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite%
@ -166,8 +183,13 @@ if exist "%SourcePath%\libresapi\src\webui" (
xcopy /S "%SourcePath%\libresapi\src\webui" "%RsDeployPath%\webui" %Quite%
)
if "%RsRetroTor%"=="1" (
echo copy tor
echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite%
)
rem pack files
title Pack - %SourceName%-%RsBuildConfig% [pack files]
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files]
"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*"

View File

@ -8,7 +8,7 @@ set SevenZipUrl=http://7-zip.org/a/7z1602.msi
set SevenZipInstall=7z1602.msi
::set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
::set CurlInstall=curl-7.50.1-win32-mingw.7z
set WgetUrl=https://eternallybored.org/misc/wget/current/wget.exe
set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
set WgetInstall=wget.exe
set JomUrl=http://download.qt.io/official_releases/jom/jom.zip
set JomInstall=jom.zip
@ -118,7 +118,7 @@ if not exist "%EnvToolsPath%\cut.exe" (
%cecho% info "Download Unix Tools installation"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
@ -134,7 +134,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
%cecho% info "Download Unix Tools installation"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"

View File

@ -195,11 +195,15 @@ Section $(Section_Main) Section_Main
; Qt audio
SetOutPath "$INSTDIR\audio"
File /r "${QTDIR}\plugins\audio\qtaudio_windows.dll"
File "${QTDIR}\plugins\audio\qtaudio_windows.dll"
; Qt platforms
SetOutPath "$INSTDIR\platforms"
File /r "${QTDIR}\plugins\platforms\qwindows.dll"
File "${QTDIR}\plugins\platforms\qwindows.dll"
; Qt styles
SetOutPath "$INSTDIR\styles"
File /NONFATAL "${QTDIR}\plugins\styles\qwindowsvistastyle.dll"
; MinGW binaries
SetOutPath "$INSTDIR"

View File

@ -46,6 +46,12 @@ unix {
INSTALLS += data_files
}
android-* {
# see https://community.kde.org/Necessitas/Assets
bdboot.files=bitdht/bdboot.txt
bdboot.path=/assets/values
INSTALLS += bdboot
}
#################### Cross compilation for windows under Linux ####################

View File

@ -236,8 +236,8 @@ public:
mForumHandler(ifaces.mGxsForums),
mServiceControlHandler(ifaces.mServiceControl),
mFileSearchHandler(sts, ifaces.mNotify, ifaces.mTurtle, ifaces.mFiles),
mFileSharingHandler(sts, ifaces.mFiles),
mTransfersHandler(sts, ifaces.mFiles, ifaces.mPeers),
mFileSharingHandler(sts, ifaces.mFiles, *ifaces.mNotify),
mTransfersHandler(sts, ifaces.mFiles, ifaces.mPeers, *ifaces.mNotify),
mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler),
mApiPluginHandler(sts, ifaces),
mChannelsHandler(ifaces.mGxsChannels),

View File

@ -16,33 +16,69 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QStringList>
#include <QStringList>
#include <QFileInfo>
#include <QDir>
#include "ApiServerLocal.h"
#include "JsonStream.h"
namespace resource_api{
ApiServerLocal::ApiServerLocal(ApiServer* server, const QString &listenPath, QObject *parent) :
ApiServerLocal::ApiServerLocal(ApiServer* server,
const QString &listenPath, QObject *parent) :
QObject(parent), serverThread(this),
localListener(server, listenPath) // Must have no parent to be movable to other thread
// Must have no parent to be movable to other thread
localListener(server, listenPath)
{
qRegisterMetaType<QAbstractSocket::SocketState>();
localListener.moveToThread(&serverThread);
serverThread.start();
}
ApiServerLocal::~ApiServerLocal() { serverThread.quit(); }
ApiServerLocal::~ApiServerLocal()
{
serverThread.quit();
serverThread.wait();
}
ApiLocalListener::ApiLocalListener(ApiServer *server,
const QString &listenPath,
QObject *parent) :
QObject(parent), mApiServer(server), mLocalServer(this)
{
mLocalServer.removeServer(listenPath);
QFileInfo fileInfo(listenPath);
if(fileInfo.exists())
{
std::cerr << __PRETTY_FUNCTION__ << listenPath.toLatin1().data()
<< " already exists. "
<< "Removing it assuming it's a past crash leftover! "
<< "Are you sure another instance is not listening there?"
<< std::endl;
mLocalServer.removeServer(listenPath);
}
#if QT_VERSION >= 0x050000
mLocalServer.setSocketOptions(QLocalServer::UserAccessOption);
#endif
connect(&mLocalServer, SIGNAL(newConnection()), this, SLOT(handleConnection()));
mLocalServer.listen(listenPath);
connect( &mLocalServer, &QLocalServer::newConnection,
this, &ApiLocalListener::handleConnection );
QDir&& lDir(fileInfo.absoluteDir());
if(!lDir.exists())
{
std::cerr << __PRETTY_FUNCTION__ << " Directory for listening socket "
<< listenPath.toLatin1().data() << " doesn't exists. "
<< " Creating it!" << std::endl;
lDir.mkpath(lDir.absolutePath());
}
if(!mLocalServer.listen(listenPath))
{
std::cerr << __PRETTY_FUNCTION__ << " mLocalServer.listen("
<< listenPath.toLatin1().data() << ") failed with: "
<< mLocalServer.errorString().toLatin1().data() << std::endl;
}
}
void ApiLocalListener::handleConnection()
@ -62,8 +98,12 @@ ApiLocalConnectionHandler::ApiLocalConnectionHandler(
ApiLocalConnectionHandler::~ApiLocalConnectionHandler()
{
mLocalSocket->close();
delete mLocalSocket;
/* Any attempt of closing the socket here also deferred method call, causes
* crash when the core is asked to stop, at least from the JSON API call.
* QMetaObject::invokeMethod(&app, "close", Qt::QueuedConnection)
* mLocalSocket->disconnectFromServer()
* mLocalSocket->close() */
mLocalSocket->deleteLater();
}
void ApiLocalConnectionHandler::handlePendingRequests()

View File

@ -45,6 +45,7 @@ StreamBase& operator << (StreamBase& left, ChatHandler::Msg& m)
{
left << makeKeyValueReference("incoming", m.incoming)
<< makeKeyValueReference("was_send", m.was_send)
<< makeKeyValueReference("read", m.read)
<< makeKeyValueReference("author_id", m.author_id)
<< makeKeyValueReference("author_name", m.author_name)
<< makeKeyValueReference("msg", m.msg)
@ -112,6 +113,8 @@ StreamBase& operator << (StreamBase& left, ChatHandler::ChatInfo& info)
{
left << makeKeyValueReference("remote_author_id", info.remote_author_id)
<< makeKeyValueReference("remote_author_name", info.remote_author_name)
<< makeKeyValueReference("own_author_id", info.own_author_id)
<< makeKeyValueReference("own_author_name", info.own_author_name)
<< makeKeyValueReference("is_broadcast", info.is_broadcast)
<< makeKeyValueReference("is_distant_chat_id", info.is_distant_chat_id)
<< makeKeyValueReference("is_lobby", info.is_lobby)
@ -174,8 +177,13 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
addResourceHandler("get_invitations_to_lobby", this, &ChatHandler::handleGetInvitationsToLobby);
addResourceHandler("answer_to_invitation", this, &ChatHandler::handleAnswerToInvitation);
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
addResourceHandler("get_default_identity_for_chat_lobby", this, &ChatHandler::handleGetDefaultIdentityForChatLobby);
addResourceHandler("set_default_identity_for_chat_lobby", this, &ChatHandler::handleSetDefaultIdentityForChatLobby);
addResourceHandler("get_identity_for_chat_lobby", this, &ChatHandler::handleGetIdentityForChatLobby);
addResourceHandler("set_identity_for_chat_lobby", this, &ChatHandler::handleSetIdentityForChatLobby);
addResourceHandler("messages", this, &ChatHandler::handleMessages);
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
addResourceHandler("mark_message_as_read", this, &ChatHandler::handleMarkMessageAsRead);
addResourceHandler("mark_chat_as_read", this, &ChatHandler::handleMarkChatAsRead);
addResourceHandler("info", this, &ChatHandler::handleInfo);
addResourceHandler("receive_status", this, &ChatHandler::handleReceiveStatus);
@ -194,13 +202,13 @@ ChatHandler::~ChatHandler()
void ChatHandler::notifyChatMessage(const ChatMessage &msg)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mRawMsgs.push_back(msg);
}
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
//Remove processed messages
std::list<Msg>& msgs = mMsgs[chat_id];
msgs.clear();
@ -219,14 +227,14 @@ void ChatHandler::notifyChatCleared(const ChatId &chat_id)
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
locked_storeTypingInfo(chat_id, status);
}
void ChatHandler::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,
const RsGxsId &nickname, const std::string& any_string)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
if(event_type == RS_CHAT_LOBBY_EVENT_PEER_STATUS)
{
locked_storeTypingInfo(ChatId(lobby_id), any_string, nickname);
@ -237,14 +245,14 @@ void ChatHandler::notifyListChange(int list, int /*type*/)
{
if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->replaceToken(mInvitationsStateToken);
}
}
void ChatHandler::tick()
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
// first fetch lobbies
std::vector<Lobby> lobbies;
@ -429,16 +437,21 @@ void ChatHandler::tick()
}
else if(msg.chat_id.isDistantChatId())
{
RsIdentityDetails details;
RsIdentityDetails detailsRemoteIdentity;
RsIdentityDetails detailsOwnIdentity;
DistantChatPeerInfo dcpinfo;
if( !gxs_id_failed &&
rsMsgs->getDistantChatStatus(
msg.chat_id.toDistantChatId(), dcpinfo ) &&
mRsIdentity->getIdDetails(dcpinfo.to_id, details) )
msg.chat_id.toDistantChatId(), dcpinfo )
&& mRsIdentity->getIdDetails(dcpinfo.to_id, detailsRemoteIdentity)
&& mRsIdentity->getIdDetails(dcpinfo.own_id, detailsOwnIdentity))
{
info.remote_author_id = details.mId.toStdString();
info.remote_author_name = details.mNickname;
info.remote_author_id = detailsRemoteIdentity.mId.toStdString();
info.remote_author_name = detailsRemoteIdentity.mNickname;
info.own_author_id = detailsOwnIdentity.mId.toStdString();
info.own_author_name = detailsOwnIdentity.mNickname;
}
else
{
@ -862,7 +875,7 @@ void ChatHandler::locked_storeTypingInfo(const ChatId &chat_id, std::string stat
void ChatHandler::handleWildcard(Request &/*req*/, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
resp.mDataStream.getStreamToMember();
for(std::map<ChatId, std::list<Msg> >::iterator mit = mMsgs.begin(); mit != mMsgs.end(); ++mit)
{
@ -876,7 +889,7 @@ void ChatHandler::handleLobbies(Request &/*req*/, Response &resp)
tick();
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
resp.mDataStream.getStreamToMember();
for(std::vector<Lobby>::iterator vit = mLobbies.begin(); vit != mLobbies.end(); ++vit)
{
@ -1015,7 +1028,7 @@ void ChatHandler::handleAnswerToInvitation(Request& req, Response& resp)
ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
ChatId id(req.mPath.top());
if(!id.isLobbyId())
@ -1032,6 +1045,83 @@ ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
return new SendLobbyParticipantsTask(mRsIdentity, mit->second);
}
void ChatHandler::handleGetDefaultIdentityForChatLobby(Request& /*req*/,
Response& resp)
{
RsGxsId gxsId;
mRsMsgs->getDefaultIdentityForChatLobby(gxsId);
resp.mDataStream << makeKeyValue("gxs_id", gxsId.toStdString());
resp.setOk();
}
void ChatHandler::handleSetDefaultIdentityForChatLobby(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsGxsId gxsId(gxs_id);
if(gxsId.isNull())
{
resp.setFail("Error: gxs_id must not be null");
return;
}
if(mRsMsgs->setDefaultIdentityForChatLobby(gxsId))
resp.setOk();
else
resp.setFail("Failure to change default identity for chat lobby");
}
void ChatHandler::handleGetIdentityForChatLobby(Request& req, Response& resp)
{
RsGxsId gxsId;
std::string chat_id;
req.mStream << makeKeyValueReference("chat_id", chat_id);
ChatId chatId(chat_id);
if(chatId.isNotSet())
{
resp.setFail("Error: chat_id must not be null");
return;
}
if(mRsMsgs->getIdentityForChatLobby(chatId.toLobbyId(), gxsId))
{
resp.mDataStream << makeKeyValue("gxs_id", gxsId.toStdString());
resp.setOk();
}
else
resp.setFail();
}
void ChatHandler::handleSetIdentityForChatLobby(Request& req, Response& resp)
{
std::string chat_id;
req.mStream << makeKeyValueReference("chat_id", chat_id);
ChatId chatId(chat_id);
if(chatId.isNotSet())
{
resp.setFail("Error: chat_id must not be null");
return;
}
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsGxsId gxsId(gxs_id);
if(gxsId.isNull())
{
resp.setFail("Error: gxs_id must not be null");
return;
}
if(mRsMsgs->setIdentityForChatLobby(chatId.toLobbyId(), gxsId))
resp.setOk();
else
resp.setFail();
}
void ChatHandler::handleMessages(Request &req, Response &resp)
{
/* G10h4ck: Whithout this the request processing won't happen, copied from
@ -1040,7 +1130,7 @@ void ChatHandler::handleMessages(Request &req, Response &resp)
tick();
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
ChatId id(req.mPath.top());
// make response a list
@ -1082,9 +1172,47 @@ void ChatHandler::handleSendMessage(Request &req, Response &resp)
resp.setFail("failed to send message");
}
void ChatHandler::handleMarkMessageAsRead(Request &req, Response &resp)
{
std::string chat_id_string;
std::string msg_id;
req.mStream << makeKeyValueReference("chat_id", chat_id_string)
<< makeKeyValueReference("msg_id", msg_id);
ChatId chatId(chat_id_string);
if(chatId.isNotSet())
{
resp.setFail(chat_id_string + " is not a valid chat id");
return;
}
std::map<ChatId, std::list<Msg> >::iterator mit = mMsgs.find(chatId);
if(mit == mMsgs.end())
{
resp.setFail("chat not found. Maybe this chat does not have messages yet?");
return;
}
std::list<Msg>& msgs = mit->second;
for(std::list<Msg>::iterator lit = msgs.begin(); lit != msgs.end(); ++lit)
{
if(id((*lit)) == msg_id)
(*lit).read = true;
}
// lobby list contains unread msgs, so update it
if(chatId.isLobbyId())
mStateTokenServer->replaceToken(mLobbiesStateToken);
if(chatId.isPeerId() && mUnreadMsgNotify)
mUnreadMsgNotify->notifyUnreadMsgCountChanged(chatId.toPeerId(), 0);
mStateTokenServer->replaceToken(mMsgStateToken);
mStateTokenServer->replaceToken(mUnreadMsgsStateToken);
}
void ChatHandler::handleMarkChatAsRead(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
ChatId id(req.mPath.top());
if(id.isNotSet())
@ -1109,12 +1237,13 @@ void ChatHandler::handleMarkChatAsRead(Request &req, Response &resp)
if(id.isPeerId() && mUnreadMsgNotify)
mUnreadMsgNotify->notifyUnreadMsgCountChanged(id.toPeerId(), 0);
mStateTokenServer->replaceToken(mMsgStateToken);
mStateTokenServer->replaceToken(mUnreadMsgsStateToken);
}
void ChatHandler::handleInfo(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
ChatId id(req.mPath.top());
if(id.isNotSet())
{
@ -1150,7 +1279,8 @@ protected:
// lobby and distant require to fetch a gxs_id
if(mId.isLobbyId())
{
requestGxsId(mInfo.author_id);
if(!mInfo.author_id.isNull())
requestGxsId(mInfo.author_id);
}
else if(mId.isDistantChatId())
{
@ -1163,6 +1293,7 @@ protected:
else
{
std::string name = "BUG: case not handled in SendTypingLabelInfo";
RsGxsId author_id = mInfo.author_id;
if(mId.isPeerId())
{
name = mPeers->getPeerName(mId.toPeerId());
@ -1172,6 +1303,7 @@ protected:
DistantChatPeerInfo dcpinfo ;
rsMsgs->getDistantChatStatus(mId.toDistantChatId(), dcpinfo);
name = getName(dcpinfo.to_id);
author_id = dcpinfo.to_id;
}
else if(mId.isLobbyId())
{
@ -1183,6 +1315,7 @@ protected:
}
uint32_t ts = mInfo.timestamp;
resp.mDataStream << makeKeyValueReference("author_name", name)
<< makeKeyValue("author_id", author_id.toStdString())
<< makeKeyValueReference("timestamp", ts)
<< makeKeyValueReference("status_string", mInfo.status);
resp.mStateToken = mInfo.state_token;
@ -1194,7 +1327,7 @@ protected:
ResponseTask* ChatHandler::handleReceiveStatus(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
ChatId id(req.mPath.top());
if(id.isNotSet())
{
@ -1207,6 +1340,7 @@ ResponseTask* ChatHandler::handleReceiveStatus(Request &req, Response &resp)
locked_storeTypingInfo(id, "");
mit = mTypingLabelInfo.find(id);
}
return new SendTypingLabelInfo(mRsIdentity, mRsPeers, id, mit->second);
}
@ -1228,7 +1362,7 @@ void ChatHandler::handleSendStatus(Request &req, Response &resp)
void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
resp.mDataStream.getStreamToMember();
for( std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin();
@ -1309,10 +1443,12 @@ void ChatHandler::handleCloseDistantChatConnexion(Request& req, Response& resp)
{
std::string distant_chat_hex;
req.mStream << makeKeyValueReference("distant_chat_hex", distant_chat_hex);
ChatId chatId(distant_chat_hex);
DistantChatPeerId chat_id(distant_chat_hex);
if (mRsMsgs->closeDistantChatConnexion(chat_id)) resp.setOk();
else resp.setFail("Failed to close distant chat");
if (mRsMsgs->closeDistantChatConnexion(chatId.toDistantChatId()))
resp.setOk();
else
resp.setFail("Failed to close distant chat");
}
void ChatHandler::handleCreateLobby(Request& req, Response& resp)

View File

@ -104,6 +104,8 @@ public:
bool is_distant_chat_id;
bool is_lobby;
bool is_peer;
std::string own_author_id;
std::string own_author_name;
std::string remote_author_id;
std::string remote_author_name;
};
@ -129,8 +131,13 @@ private:
void handleAnswerToInvitation(Request& req, Response& resp);
void handleClearLobby(Request& req, Response& resp);
ResponseTask* handleLobbyParticipants(Request& req, Response& resp);
void handleGetDefaultIdentityForChatLobby(Request& req, Response& resp);
void handleSetDefaultIdentityForChatLobby(Request& req, Response& resp);
void handleGetIdentityForChatLobby(Request& req, Response& resp);
void handleSetIdentityForChatLobby(Request& req, Response& resp);
void handleMessages(Request& req, Response& resp);
void handleSendMessage(Request& req, Response& resp);
void handleSendMessage(Request& req, Response& resp);
void handleMarkMessageAsRead(Request& req, Response& resp);
void handleMarkChatAsRead(Request& req, Response& resp);
void handleInfo(Request& req, Response& resp);
ResponseTask *handleReceiveStatus(Request& req, Response& resp);

View File

@ -31,7 +31,7 @@ FileSearchHandler::~FileSearchHandler()
void FileSearchHandler::notifyTurtleSearchResult(uint32_t search_id, const std::list<TurtleFileInfo>& files)
{
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
std::map<uint32_t, Search>::iterator mit = mSearches.find(search_id);
if(mit == mSearches.end())
return;
@ -85,7 +85,7 @@ void FileSearchHandler::handleWildcard(Request &req, Response &resp)
}
{
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
std::map<uint32_t, Search>::iterator mit = mSearches.find(id);
if(mit == mSearches.end())
{
@ -115,7 +115,7 @@ void FileSearchHandler::handleWildcard(Request &req, Response &resp)
else
{
// list searches
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
resp.mDataStream.getStreamToMember();
for(std::map<uint32_t, Search>::iterator mit = mSearches.begin(); mit != mSearches.end(); ++mit)
{
@ -221,7 +221,7 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp)
}
{
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
Search& search = mSearches[search_id];
search.mStateToken = mStateTokenServer->getNewToken();
@ -262,7 +262,7 @@ void FileSearchHandler::handleGetSearchResult(Request& req, Response& resp)
}
{
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
std::map<uint32_t, Search>::iterator mit = mSearches.find(id);
if(mit == mSearches.end())
{

View File

@ -21,8 +21,10 @@
namespace resource_api
{
FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files):
mStateTokenServer(sts), mRsFiles(files)
FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files,
RsNotify& notify):
mStateTokenServer(sts), mMtx("FileSharingHandler Mtx"), mRsFiles(files),
mNotify(notify)
{
addResourceHandler("*", this, &FileSharingHandler::handleWildcard);
addResourceHandler("force_check", this, &FileSharingHandler::handleForceCheck);
@ -40,7 +42,30 @@ FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files):
addResourceHandler("download", this, &FileSharingHandler::handleDownload);
mStateToken = mStateTokenServer->getNewToken();
mLocalDirStateToken = mStateTokenServer->getNewToken();
mRemoteDirStateToken = mStateTokenServer->getNewToken();
mNotify.registerNotifyClient(this);
}
FileSharingHandler::~FileSharingHandler()
{
mNotify.unregisterNotifyClient(this);
}
void FileSharingHandler::notifyListChange(int list, int /* type */)
{
if(list == NOTIFY_LIST_DIRLIST_LOCAL)
{
RS_STACK_MUTEX(mMtx);
mStateTokenServer->discardToken(mLocalDirStateToken);
mLocalDirStateToken = mStateTokenServer->getNewToken();
}
else if(list == NOTIFY_LIST_DIRLIST_FRIENDS)
{
RS_STACK_MUTEX(mMtx);
mStateTokenServer->discardToken(mRemoteDirStateToken);
mRemoteDirStateToken = mStateTokenServer->getNewToken();
}
}
void FileSharingHandler::handleWildcard(Request & /*req*/, Response & /*resp*/)
@ -54,7 +79,7 @@ void FileSharingHandler::handleForceCheck(Request&, Response& resp)
resp.setOk();
}
void FileSharingHandler::handleGetSharedDir(Request& req, Response& resp)
void FileSharingHandler::handleGetSharedDir(Request& /*req*/, Response& resp)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails(NULL, dirDetails, RS_FILE_HINTS_LOCAL);
@ -104,6 +129,7 @@ void FileSharingHandler::handleGetSharedDir(Request& req, Response& resp)
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("peer_id", dirDetails.id.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
@ -140,6 +166,8 @@ void FileSharingHandler::handleGetSharedDir(Request& req, Response& resp)
<< makeKeyValueReference("contain_folders", contain_folders);
}
}
resp.mStateToken = mLocalDirStateToken;
}
void FileSharingHandler::handleSetSharedDir(Request& req, Response& resp)
@ -231,10 +259,16 @@ void FileSharingHandler::handleGetDirectoryParent(Request& req, Response& resp)
FileSearchFlags flags;
if(remote)
{
flags |= RS_FILE_HINTS_REMOTE;
resp.mStateToken = mRemoteDirStateToken;
}
if(local)
{
flags |= RS_FILE_HINTS_LOCAL;
resp.mStateToken = mLocalDirStateToken;
}
DirDetails dirDetails;
mRsFiles->RequestDirDetails(ref, dirDetails, flags);
@ -282,6 +316,7 @@ void FileSharingHandler::handleGetDirectoryParent(Request& req, Response& resp)
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("peer_id", dirDetails.id.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
@ -334,10 +369,16 @@ void FileSharingHandler::handleGetDirectoryChilds(Request& req, Response& resp)
FileSearchFlags flags;
if(remote)
{
flags |= RS_FILE_HINTS_REMOTE;
resp.mStateToken = mRemoteDirStateToken;
}
if(local)
{
flags |= RS_FILE_HINTS_LOCAL;
resp.mStateToken = mLocalDirStateToken;
}
DirDetails dirDetails;
mRsFiles->RequestDirDetails(ref, dirDetails, flags);
@ -385,6 +426,7 @@ void FileSharingHandler::handleGetDirectoryChilds(Request& req, Response& resp)
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("peer_id", dirDetails.id.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
@ -458,7 +500,7 @@ void FileSharingHandler::handleDownload(Request& req, Response& resp)
FileInfo finfo;
mRsFiles->FileDetails(hash, RS_FILE_HINTS_REMOTE, finfo);
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
for(std::vector<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
srcIds.push_back((*it).peerId);
if(!mRsFiles->FileRequest(name, hash, static_cast<uint64_t>(size), "",

View File

@ -22,14 +22,23 @@
#include "StateTokenServer.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rsnotify.h>
#include <util/rsthreads.h>
namespace resource_api
{
class FileSharingHandler: public ResourceRouter
class FileSharingHandler: public ResourceRouter, NotifyClient
{
public:
FileSharingHandler(StateTokenServer* sts, RsFiles* files);
FileSharingHandler(StateTokenServer* sts, RsFiles* files, RsNotify& notify);
~FileSharingHandler();
/**
Derived from NotifyClient
This function may be called from foreign thread
*/
virtual void notifyListChange(int list, int type);
private:
void handleWildcard(Request& req, Response& resp);
@ -48,10 +57,22 @@ private:
void handleDownload(Request& req, Response& resp);
StateToken mStateToken;
/// Token indicating change in local shared files
StateToken mLocalDirStateToken;
/// Token indicating change in remote (friends') shared files
StateToken mRemoteDirStateToken;
StateTokenServer* mStateTokenServer;
/**
Protects mLocalDirStateToken and mRemoteDirStateToken that may be changed in foreign thread
@see FileSharingHandler::notifyListChange(...)
*/
RsMutex mMtx;
RsFiles* mRsFiles;
RsNotify& mNotify;
};
} // namespace resource_api

View File

@ -374,7 +374,7 @@ void IdentityHandler::handleAddContact(Request& req, Response& resp)
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), true);
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->replaceToken(mStateToken);
}
@ -389,7 +389,7 @@ void IdentityHandler::handleRemoveContact(Request& req, Response& resp)
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), false);
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->replaceToken(mStateToken);
}

View File

@ -250,6 +250,7 @@ PeersHandler::PeersHandler( StateTokenServer* sts, RsNotify* notify,
addResourceHandler("set_network_options", this, &PeersHandler::handleSetNetworkOptions);
addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions);
addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions);
addResourceHandler("get_node_name", this, &PeersHandler::handleGetNodeName);
addResourceHandler("get_node_options", this, &PeersHandler::handleGetNodeOptions);
addResourceHandler("set_node_options", this, &PeersHandler::handleSetNodeOptions);
addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert);
@ -266,9 +267,9 @@ PeersHandler::~PeersHandler()
void PeersHandler::notifyListChange(int list, int /* type */)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
if(list == NOTIFY_LIST_FRIENDS)
{
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->discardToken(mStateToken);
mStateToken = mStateTokenServer->getNewToken();
}
@ -276,13 +277,13 @@ void PeersHandler::notifyListChange(int list, int /* type */)
void PeersHandler::notifyPeerStatusChanged(const std::string& /*peer_id*/, uint32_t /*state*/)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->replaceToken(mStateToken);
}
void PeersHandler::notifyPeerHasNewAvatar(std::string /*peer_id*/)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->replaceToken(mStateToken);
}
@ -294,7 +295,7 @@ void PeersHandler::tick()
{
mOnlinePeers = online;
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->discardToken(mStateToken);
mStateToken = mStateTokenServer->getNewToken();
}
@ -305,7 +306,7 @@ void PeersHandler::tick()
{
status = statusInfo.status;
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->discardToken(mStringStateToken);
mStringStateToken = mStateTokenServer->getNewToken();
}
@ -315,7 +316,7 @@ void PeersHandler::tick()
{
custom_state_string = custom_state;
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->discardToken(mCustomStateToken);
mCustomStateToken = mStateTokenServer->getNewToken();
}
@ -323,7 +324,7 @@ void PeersHandler::tick()
void PeersHandler::notifyUnreadMsgCountChanged(const RsPeerId &peer, uint32_t count)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mUnreadMsgsCounts[peer] = count;
mStateTokenServer->replaceToken(mStateToken);
}
@ -459,7 +460,7 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
{
std::map<RsPeerId, uint32_t> unread_msgs;
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
unread_msgs = mUnreadMsgsCounts;
}
std::list<StatusInfo> statusInfo;
@ -1139,6 +1140,28 @@ void PeersHandler::handleSetPGPOptions(Request& req, Response& resp)
resp.setOk();
}
void PeersHandler::handleGetNodeName(Request& req, Response& resp)
{
std::string peer_id;
req.mStream << makeKeyValueReference("peer_id", peer_id);
RsPeerId peerId(peer_id);
RsPeerDetails detail;
if(!mRsPeers->getPeerDetails(peerId, detail))
{
resp.setFail();
return;
}
resp.mDataStream << makeKeyValue("peer_id", detail.id.toStdString());
resp.mDataStream << makeKeyValue("name", detail.name);
resp.mDataStream << makeKeyValue("location", detail.location);
resp.mDataStream << makeKeyValue("pgp_id", detail.gpg_id.toStdString());
resp.mDataStream << makeKeyValue("last_contact", detail.lastConnect);
resp.setOk();
}
void PeersHandler::handleGetNodeOptions(Request& req, Response& resp)
{
std::string peer_id;
@ -1258,7 +1281,7 @@ void PeersHandler::handleSetNodeOptions(Request& req, Response& resp)
StateToken PeersHandler::getCurrentStateToken()
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
if(mStateToken.isNull())
mStateToken = mStateTokenServer->getNewToken();
return mStateToken;

View File

@ -70,6 +70,7 @@ private:
void handleGetPGPOptions(Request& req, Response& resp);
void handleSetPGPOptions(Request& req, Response& resp);
void handleGetNodeName(Request& req, Response& resp);
void handleGetNodeOptions(Request& req, Response& resp);
void handleSetNodeOptions(Request& req, Response& resp);

View File

@ -57,7 +57,7 @@ RsControlModule::~RsControlModule()
bool RsControlModule::processShouldExit()
{
RsStackMutex stack(mExitFlagMtx);
RS_STACK_MUTEX(mExitFlagMtx); // ********** LOCKED **********
return mProcessShouldExit;
}
@ -158,7 +158,7 @@ void RsControlModule::run()
std::cerr << "RsControlModule::run() reseting passwd." << std::endl;
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mPassword = "";
}
@ -182,7 +182,7 @@ void RsControlModule::run()
std::cerr << "RsControlModule::run() while(wait_for_account_select) mLoadPeerId=" << mLoadPeerId << std::endl;
#endif
usleep(500*1000);
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
if(!mLoadPeerId.isNull())
{
@ -238,7 +238,7 @@ void RsControlModule::run()
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mLoadPeerId.clear();
}
}
@ -247,7 +247,7 @@ void RsControlModule::run()
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mFixedPassword = mPassword;
std::cerr << "***Reseting mPasswd " << std::endl;
@ -279,7 +279,7 @@ void RsControlModule::run()
void RsControlModule::handleRunState(Request &, Response &resp)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
std::string state;
switch(mRunState)
{
@ -311,7 +311,7 @@ void RsControlModule::handleRunState(Request &, Response &resp)
void RsControlModule::handleIdentities(Request &, Response &resp)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
if(mRunState == WAITING_INIT || mRunState == FATAL_ERROR)
{
resp.setFail("Retroshare is not initialised. Operation not possible.");
@ -337,7 +337,7 @@ void RsControlModule::handleIdentities(Request &, Response &resp)
void RsControlModule::handleLocations(Request &, Response &resp)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
if(mRunState == WAITING_INIT || mRunState == FATAL_ERROR)
{
resp.setFail("Retroshare is not initialised. Operation not possible.");
@ -370,7 +370,7 @@ void RsControlModule::handleLocations(Request &, Response &resp)
void RsControlModule::handlePassword(Request &req, Response &resp)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
std::string passwd;
req.mStream << makeKeyValueReference("password", passwd);
if(passwd != "")// && mWantPassword)
@ -398,7 +398,7 @@ void RsControlModule::handlePassword(Request &req, Response &resp)
void RsControlModule::handleLogin(Request &req, Response &resp)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
if(mRunState != WAITING_ACCOUNT_SELECT)
{
resp.setFail("Operation not allowed in this runstate. Login is only allowed rigth after initialisation.");
@ -411,7 +411,7 @@ void RsControlModule::handleLogin(Request &req, Response &resp)
void RsControlModule::handleShutdown(Request &, Response &resp)
{
RsStackMutex stack(mExitFlagMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mExitFlagMtx); // ********** LOCKED **********
mProcessShouldExit = true;
resp.setOk();
}
@ -514,7 +514,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
std::string err_string;
// give the password to the password callback
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mPassword = pgp_password;
mFixedPassword = pgp_password;
}
@ -522,7 +522,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
// clear fixed password to restore normal password operation
// {
// RsStackMutex stack(mDataMtx); // ********** LOCKED **********
// RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
// mFixedPassword = "";
// }
@ -532,7 +532,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
RsInit::LoadPassword(ssl_password);
// trigger login in init thread
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mLoadPeerId = ssl_id;
}
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id)
@ -561,7 +561,7 @@ bool RsControlModule::askForDeferredSelfSignature(const void *data, const uint32
void RsControlModule::setRunState(RunState s, std::string errstr)
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mRunState = s;
mLastErrorString = errstr;
mStateTokenServer->replaceToken(mStateToken);

View File

@ -64,19 +64,19 @@ StateTokenServer::StateTokenServer():
StateToken StateTokenServer::getNewToken()
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
return locked_getNewToken();
}
void StateTokenServer::discardToken(StateToken token)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
locked_discardToken(token);
}
void StateTokenServer::replaceToken(StateToken &token)
{
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
locked_discardToken(token);
token = locked_getNewToken();
}
@ -89,13 +89,13 @@ void StateTokenServer::registerTickClient(Tickable *c)
// avoid double registration
unregisterTickClient(c);
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
mTickClients.push_back(c);
}
void StateTokenServer::unregisterTickClient(Tickable *c)
{
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
std::vector<Tickable*>::iterator vit = std::find(mTickClients.begin(), mTickClients.end(), c);
if(vit != mTickClients.end())
mTickClients.erase(vit);
@ -104,14 +104,14 @@ void StateTokenServer::unregisterTickClient(Tickable *c)
void StateTokenServer::handleWildcard(Request &req, Response &resp)
{
{
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
for(std::vector<Tickable*>::iterator vit = mTickClients.begin(); vit != mTickClients.end(); ++vit)
{
(*vit)->tick();
}
}
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
// want to lookpup many tokens at once, return a list of invalid tokens
// TODO: make generic list serialiser/deserialiser
resp.mDataStream.getStreamToMember();

View File

@ -6,8 +6,10 @@
namespace resource_api
{
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeers *peers):
mStateTokenServer(sts), mFiles(files), mRsPeers(peers), mLastUpdateTS(0)
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeers *peers,
RsNotify& notify):
mStateTokenServer(sts), mFiles(files), mRsPeers(peers), mNotify(notify),
mMtx("TransfersHandler"), mLastUpdateTS(0)
{
addResourceHandler("*", this, &TransfersHandler::handleWildcard);
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
@ -15,11 +17,23 @@ TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeer
addResourceHandler("control_download", this, &TransfersHandler::handleControlDownload);
mStateToken = mStateTokenServer->getNewToken();
mStateTokenServer->registerTickClient(this);
mNotify.registerNotifyClient(this);
}
TransfersHandler::~TransfersHandler()
{
mStateTokenServer->unregisterTickClient(this);
mNotify.unregisterNotifyClient(this);
}
void TransfersHandler::notifyListChange(int list, int /* type */)
{
if(list == NOTIFY_LIST_TRANSFERLIST)
{
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
mStateTokenServer->discardToken(mStateToken);
mStateToken = mStateTokenServer->getNewToken();
}
}
const int UPDATE_PERIOD_SECONDS = 5;
@ -77,7 +91,7 @@ void TransfersHandler::handleControlDownload(Request &req, Response &resp)
FileInfo finfo;
mFiles->FileDetails(hash, RS_FILE_HINTS_REMOTE, finfo);
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
for(std::vector<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
srcIds.push_back((*it).peerId);
bool ok = req.mStream.isOK();
@ -199,8 +213,7 @@ void TransfersHandler::handleUploads(Request & /* req */, Response &resp)
FileInfo fi;
if(mFiles->FileDetails(*lit, RS_FILE_HINTS_UPLOAD, fi))
{
std::list<TransferInfo>::iterator pit;
for(pit = fi.peers.begin(); pit != fi.peers.end(); ++pit)
for( std::vector<TransferInfo>::iterator pit = fi.peers.begin(); pit != fi.peers.end(); ++pit)
{
if (pit->peerId == ownId) //don't display transfer to ourselves
continue ;

View File

@ -5,18 +5,26 @@
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsnotify.h>
namespace resource_api
{
class TransfersHandler: public ResourceRouter, Tickable
class TransfersHandler: public ResourceRouter, Tickable, NotifyClient
{
public:
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers);
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers, RsNotify& notify);
virtual ~TransfersHandler();
/**
Derived from NotifyClient
This function may be called from foreign thread
*/
virtual void notifyListChange(int list, int type);
// from Tickable
virtual void tick();
private:
void handleWildcard(Request& req, Response& resp);
void handleControlDownload(Request& req, Response& resp);
@ -26,6 +34,13 @@ private:
StateTokenServer* mStateTokenServer;
RsFiles* mFiles;
RsPeers* mRsPeers;
RsNotify& mNotify;
/**
Protects mStateToken that may be changed in foreign thread
@see TransfersHandler::notifyListChange(...)
*/
RsMutex mMtx;
StateToken mStateToken;
time_t mLastUpdateTS;

View File

@ -8,8 +8,10 @@ TARGET = resapi
TARGET_PRL = libresapi
DESTDIR = lib
DEPENDPATH += ../../libretroshare/src/
INCLUDEPATH += ../../libretroshare/src
retroshare_android_service {
win32 {
OBJECTS_DIR = temp/obj
@ -39,9 +41,6 @@ retroshare_android_service {
QMAKE_RC += --include-dir=$$_PRO_FILE_PWD_/../../libretroshare/src
}
}
DEPENDPATH += . ../../libretroshare/src/
INCLUDEPATH += ../../libretroshare/src/
}
libresapihttpserver {

View File

@ -1403,13 +1403,34 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
return false;
}
//std::map<ChatLobbyId,VisibleChatLobbyRecord>::const_iterator vid = _visible_lobbies.find(lobby_id) ;
//When invited to new Lobby, it is not visible.
//if(_visible_lobbies.end() == vid)
//{
// std::cerr << " (EE) Cannot subscribe a non visible chat lobby!!" << std::endl;
// return false ;
//}
RsIdentityDetails det ;
if( (!rsIdentity->getIdDetails(identity,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID))
{
std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is not ours! Something's wrong here." << std::endl;
return false ;
}
if( (it->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
{
std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is unsigned and the lobby requires signed ids only." << std::endl;
return false ;
}
if(_chat_lobbys.find(lobby_id) != _chat_lobbys.end())
{
std::cerr << " (II) Lobby already exists. Weird." << std::endl;
return true ;
}
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << " Creating new Lobby entry." << std::endl;
#endif
@ -1417,8 +1438,8 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
ChatLobbyEntry entry ;
entry.participating_friends.insert(it->second.peer_id) ;
entry.lobby_flags = it->second.lobby_flags ;
entry.gxs_id = identity ;
entry.lobby_flags = it->second.lobby_flags ;
entry.gxs_id = identity ;
entry.lobby_id = lobby_id ;
entry.lobby_name = it->second.lobby_name ;
entry.lobby_topic = it->second.lobby_topic ;
@ -1491,11 +1512,12 @@ void DistributedChatService::denyLobbyInvite(const ChatLobbyId& lobby_id)
bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,const RsGxsId& gxs_id)
{
if(!mGixs->isOwnId(gxs_id))
{
std::cerr << "(EE) Cannot lobby using gxs id " << gxs_id << std::endl;
return false ;
}
RsIdentityDetails det ;
if( (!rsIdentity->getIdDetails(gxs_id,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID))
{
std::cerr << " (EE) Cannot subscribe with identity " << gxs_id << " because it is not ours! Something's wrong here." << std::endl;
return false ;
}
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << "Joining public chat lobby " << std::hex << lobby_id << std::dec << std::endl;
@ -1527,6 +1549,12 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
return true ;
}
if( (it->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
{
std::cerr << " (EE) Cannot subscribe with identity " << gxs_id << " because it is unsigned and the lobby requires signed ids only." << std::endl;
return false ;
}
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << " Creating new lobby entry." << std::endl;
#endif

View File

@ -38,7 +38,7 @@
#include "crypto/chacha20.h"
#include "util/rsprint.h"
#include "util/rsrandom.h"
#include "util/rsscopetimer.h"
#include "util/rstime.h"
#define rotl(x,n) { x = (x << n) | (x >> (-n & 31)) ;}
@ -1385,27 +1385,27 @@ bool perform_tests()
uint8_t received_tag[16] ;
{
RsScopeTimer s("AEAD1") ;
rstime::RsScopeTimer s("AEAD1") ;
chacha20_encrypt_rs(key, 1, nonce, ten_megabyte_data,SIZE) ;
std::cerr << " Chacha20 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
{
RsScopeTimer s("AEAD2") ;
rstime::RsScopeTimer s("AEAD2") ;
AEAD_chacha20_poly1305_rs(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
std::cerr << " AEAD/poly1305 own encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
#if OPENSSL_VERSION_NUMBER >= 0x010100000L && !defined(LIBRESSL_VERSION_NUMBER)
{
RsScopeTimer s("AEAD3") ;
rstime::RsScopeTimer s("AEAD3") ;
AEAD_chacha20_poly1305_openssl(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
std::cerr << " AEAD/poly1305 openssl encryption speed: " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
#endif
{
RsScopeTimer s("AEAD4") ;
rstime::RsScopeTimer s("AEAD4") ;
AEAD_chacha20_sha256(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
std::cerr << " AEAD/sha256 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;

View File

@ -23,6 +23,7 @@
*
*/
#include "util/folderiterator.h"
#include "util/rstime.h"
#include "rsserver/p3face.h"
#include "directory_storage.h"
@ -92,7 +93,7 @@ void LocalDirectoryUpdater::data_tick()
for(uint32_t i=0;i<10;++i)
{
usleep(1*1000*1000);
rstime::rs_usleep(1*1000*1000);
{
if(mForceUpdate)

View File

@ -24,7 +24,7 @@
*/
#include "util/rsdir.h"
#include "util/rsprint.h"
#include "util/rsscopetimer.h"
#include "util/rstime.h"
#include "rsserver/p3face.h"
#include "pqi/authssl.h"
#include "hash_cache.h"
@ -125,7 +125,7 @@ void HashStorage::data_tick()
std::cerr << "nothing to hash. Sleeping for " << st << " us" << std::endl;
#endif
usleep(st); // when no files to hash, just wait for 2 secs. This avoids a dramatic loop.
rstime::rs_usleep(st); // when no files to hash, just wait for 2 secs. This avoids a dramatic loop.
if(st > MAX_INACTIVITY_SLEEP_TIME)
{
@ -163,7 +163,7 @@ void HashStorage::data_tick()
if(paused) // we need to wait off mutex!!
{
usleep(MAX_INACTIVITY_SLEEP_TIME) ;
rstime::rs_usleep(MAX_INACTIVITY_SLEEP_TIME) ;
std::cerr << "Hashing process currently paused." << std::endl;
return;
}
@ -190,7 +190,7 @@ void HashStorage::data_tick()
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
double seconds_origin = RsScopeTimer::currentTime() ;
double seconds_origin = rstime::RsScopeTimer::currentTime() ;
if(RsDirUtil::getFileHash(job.full_path, hash,size, this))
{
@ -215,7 +215,7 @@ void HashStorage::data_tick()
else
std::cerr << "ERROR: cannot hash file " << job.full_path << std::endl;
mHashingTime += RsScopeTimer::currentTime() - seconds_origin ;
mHashingTime += rstime::RsScopeTimer::currentTime() - seconds_origin ;
mHashedBytes += size ;
if(mHashingTime > 3)

View File

@ -1155,6 +1155,8 @@ int p3FileDatabase::SearchKeywords(const std::list<std::string>& keywords, std::
if(flags & RS_FILE_HINTS_LOCAL)
{
std::list<EntryIndex> firesults;
std::list<void *> pointers;
{
RS_STACK_MUTEX(mFLSMtx) ;
@ -1164,16 +1166,16 @@ int p3FileDatabase::SearchKeywords(const std::list<std::string>& keywords, std::
{
void *p=NULL;
convertEntryIndexToPointer<sizeof(void*)>(*it,0,p);
*it = (intptr_t)p ;
pointers.push_back(p) ;
}
}
filterResults(firesults,results,flags,client_peer_id) ;
filterResults(pointers,results,flags,client_peer_id) ;
}
if(flags & RS_FILE_HINTS_REMOTE)
{
std::list<EntryIndex> firesults;
std::list<void*> pointers ;
{
RS_STACK_MUTEX(mFLSMtx) ;
@ -1188,21 +1190,21 @@ int p3FileDatabase::SearchKeywords(const std::list<std::string>& keywords, std::
{
void *p=NULL;
convertEntryIndexToPointer<sizeof(void*)>(*it,i+1,p);
firesults.push_back((intptr_t)p) ;
}
pointers.push_back(p) ;
}
}
}
for(std::list<EntryIndex>::const_iterator rit ( firesults.begin()); rit != firesults.end(); ++rit)
{
DirDetails dd;
for(auto it(pointers.begin());it!=pointers.end();++it)
{
DirDetails dd;
if(!RequestDirDetails ((void*)(intptr_t)*rit,dd,RS_FILE_HINTS_REMOTE))
continue ;
results.push_back(dd);
}
if(!RequestDirDetails (*it,dd,RS_FILE_HINTS_REMOTE))
continue ;
results.push_back(dd);
}
}
return !results.empty() ;
@ -1213,6 +1215,7 @@ int p3FileDatabase::SearchBoolExp(RsRegularExpression::Expression *exp, std::lis
if(flags & RS_FILE_HINTS_LOCAL)
{
std::list<EntryIndex> firesults;
std::list<void*> pointers;
{
RS_STACK_MUTEX(mFLSMtx) ;
@ -1222,17 +1225,16 @@ int p3FileDatabase::SearchBoolExp(RsRegularExpression::Expression *exp, std::lis
{
void *p=NULL;
convertEntryIndexToPointer<sizeof(void*)>(*it,0,p);
*it = (intptr_t)p ;
pointers.push_back(p);
}
}
filterResults(firesults,results,flags,client_peer_id) ;
filterResults(pointers,results,flags,client_peer_id) ;
}
if(flags & RS_FILE_HINTS_REMOTE)
{
std::list<EntryIndex> firesults;
std::list<void*> pointers ;
{
RS_STACK_MUTEX(mFLSMtx) ;
@ -1246,21 +1248,20 @@ int p3FileDatabase::SearchBoolExp(RsRegularExpression::Expression *exp, std::lis
{
void *p=NULL;
convertEntryIndexToPointer<sizeof(void*)>(*it,i+1,p);
firesults.push_back((intptr_t)p) ;
}
pointers.push_back(p) ;
}
}
}
for(std::list<EntryIndex>::const_iterator rit ( firesults.begin()); rit != firesults.end(); ++rit)
{
DirDetails dd;
for(auto it(pointers.begin());it!=pointers.end();++it)
{
DirDetails dd;
if(!RequestDirDetails ((void*)(intptr_t)*rit,dd,RS_FILE_HINTS_REMOTE))
continue ;
if(!RequestDirDetails (*it,dd,RS_FILE_HINTS_REMOTE))
continue ;
results.push_back(dd);
}
results.push_back(dd);
}
}
return !results.empty() ;
@ -1312,7 +1313,7 @@ bool p3FileDatabase::search(const RsFileHash &hash, FileSearchFlags hintflags, F
return false;
}
int p3FileDatabase::filterResults(const std::list<EntryIndex>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const
int p3FileDatabase::filterResults(const std::list<void*>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const
{
results.clear();
@ -1320,17 +1321,17 @@ int p3FileDatabase::filterResults(const std::list<EntryIndex>& firesults,std::li
/* translate/filter results */
for(std::list<EntryIndex>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit)
for(std::list<void*>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit)
{
DirDetails cdetails ;
if(!RequestDirDetails ((void*)(intptr_t)*rit,cdetails,RS_FILE_HINTS_LOCAL))
if(!RequestDirDetails (*rit,cdetails,RS_FILE_HINTS_LOCAL))
{
P3FILELISTS_ERROR() << "(EE) Cannot get dir details for entry " << (void*)(intptr_t)*rit << std::endl;
P3FILELISTS_ERROR() << "(EE) Cannot get dir details for entry " << *rit << std::endl;
continue ;
}
#ifdef DEBUG_P3FILELISTS
P3FILELISTS_DEBUG() << "Filtering candidate " << (void*)(intptr_t)(*rit) << ", flags=" << cdetails.flags << ", peer=" << peer_id ;
P3FILELISTS_DEBUG() << "Filtering candidate " << *rit << ", flags=" << cdetails.flags << ", peer=" << peer_id ;
#endif
if(!peer_id.isNull())

View File

@ -159,7 +159,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
protected:
int filterResults(const std::list<EntryIndex>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const;
int filterResults(const std::list<void*>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const;
std::string makeRemoteFileName(const RsPeerId& pid) const;
// Derived from p3Config

View File

@ -40,6 +40,7 @@
#endif
#include "util/rsdiscspace.h"
#include "util/rsmemory.h"
#include "util/rstime.h"
#include "ft/ftcontroller.h"
@ -219,7 +220,7 @@ void ftController::data_tick()
/* check the queues */
//Waiting 1 sec before start
usleep(1*1000*1000); // 1 sec
rstime::rs_usleep(1*1000*1000); // 1 sec
#ifdef CONTROL_DEBUG
//std::cerr << "ftController::run()";
@ -301,7 +302,7 @@ void ftController::searchForDirectSources()
FileInfo info ; // Info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
if( mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info) )
for( std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
for( std::vector<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
{
bool bAllowDirectDL = false;
switch (mFilePermDirectDLPolicy) {
@ -734,13 +735,39 @@ bool ftController::completeFile(const RsFileHash& hash)
fc->mState = ftFileControl::COMPLETED;
std::string dst_dir,src_dir,src_file,dst_file ;
RsDirUtil::splitDirFromFile(fc->mCurrentPath,src_dir,src_file) ;
RsDirUtil::splitDirFromFile(fc->mDestination,dst_dir,dst_file) ;
// We use this intermediate file in case the destination directory is not available, so as to not keep the partial file name.
std::string intermediate_file_name = src_dir+'/'+dst_file ;
// I don't know how the size can be zero, but believe me, this happens,
// and it causes an error on linux because then the file may not even exist.
//
if( fc->mSize > 0 && RsDirUtil::moveFile(fc->mCurrentPath,fc->mDestination) )
fc->mCurrentPath = fc->mDestination;
else
if( fc->mSize == 0)
fc->mState = ftFileControl::ERROR_COMPLETION;
else
{
std::cerr << "CompleteFile(): renaming " << fc->mCurrentPath << " into " << fc->mDestination << std::endl;
std::cerr << "CompleteFile(): 1 - renaming " << fc->mCurrentPath << " info " << intermediate_file_name << std::endl;
if(RsDirUtil::moveFile(fc->mCurrentPath,intermediate_file_name) )
{
fc->mCurrentPath = intermediate_file_name ;
std::cerr << "CompleteFile(): 2 - renaming/copying " << intermediate_file_name << " into " << fc->mDestination << std::endl;
if(RsDirUtil::moveFile(intermediate_file_name,fc->mDestination) )
fc->mCurrentPath = fc->mDestination;
else
fc->mState = ftFileControl::ERROR_COMPLETION;
}
else
fc->mState = ftFileControl::ERROR_COMPLETION;
}
/* for extralist additions */
path = fc->mDestination;
@ -1003,7 +1030,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
}
std::list<RsPeerId>::const_iterator it;
std::list<TransferInfo>::const_iterator pit;
std::vector<TransferInfo>::const_iterator pit;
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileRequest(" << fname << ",";
@ -1596,6 +1623,8 @@ bool ftController::FileDetails(const RsFileHash &hash, FileInfo &info)
bool isDownloading = false;
bool isSuspended = false;
info.peers.clear();
for(pit = peerIds.begin(); pit != peerIds.end(); ++pit)
{
if (it->second->mTransfer->getPeerState(*pit, state, tfRate))

View File

@ -32,6 +32,7 @@
#include "ft/ftextralist.h"
#include "rsitems/rsconfigitems.h"
#include "util/rsdir.h"
#include "util/rstime.h"
#include <stdio.h>
#include <unistd.h> /* for (u)sleep() */
#include <time.h>
@ -64,12 +65,8 @@ void ftExtraList::data_tick()
/* Hash a file */
hashAFile();
#ifdef WIN32
Sleep(1);
#else
/* microsleep */
usleep(10);
#endif
rstime::rs_usleep(10);
}
else
{
@ -513,16 +510,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
delete (*it);
/* short sleep */
#ifndef WINDOWS_SYS
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
usleep(1000); /* 1000 per second */
#else
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
Sleep(1);
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
rstime::rs_usleep(1000) ;
}
load.clear() ;
return true;

View File

@ -35,10 +35,11 @@
#include <algorithm>
#ifdef RS_DATA_SERVICE_DEBUG_TIME
#include <util/rsscopetimer.h>
#include <util/rstime.h>
#endif
#include "rsdataservice.h"
#include "retroshare/rsgxsflags.h"
#include "util/rsstring.h"
#define MSG_TABLE_NAME std::string("MESSAGES")
@ -113,6 +114,8 @@ const std::string RsGeneralDataService::MSG_META_STATUS = KEY_MSG_STATUS;
const uint32_t RsGeneralDataService::GXS_MAX_ITEM_SIZE = 1572864; // 1.5 Mbytes
static const uint32_t CACHE_ENTRY_GRACE_PERIOD = 600 ; // 10 minutes
static int addColumn(std::list<std::string> &list, const std::string &attribute)
{
list.push_back(attribute);
@ -486,15 +489,13 @@ bool RsDataService::finishReleaseUpdate(int release, bool result)
return result;
}
RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset)
RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset,bool use_cache)
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::locked_getGrpMeta()";
std::cerr << std::endl;
#endif
RsGxsGrpMetaData* grpMeta = new RsGxsGrpMetaData();
bool ok = true;
// for extracting raw data
@ -505,6 +506,25 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset
// grpId
std::string tempId;
c.getString(mColGrpMeta_GrpId + colOffset, tempId);
RsGxsGrpMetaData* grpMeta ;
RsGxsGroupId grpId(tempId) ;
if(use_cache)
{
auto it = mGrpMetaDataCache.find(grpId) ;
if(it != mGrpMetaDataCache.end())
grpMeta = it->second ;
else
{
grpMeta = new RsGxsGrpMetaData();
mGrpMetaDataCache[grpId] = grpMeta ;
}
}
else
grpMeta = new RsGxsGrpMetaData();
grpMeta->mGroupId = RsGxsGroupId(tempId);
c.getString(mColGrpMeta_NxsIdentity + colOffset, tempId);
grpMeta->mAuthorId = RsGxsId(tempId);
@ -553,12 +573,46 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset
c.getString(mColGrpMeta_ParentGrpId, tempId);
grpMeta->mParentGrpId = RsGxsGroupId(tempId);
// make sure that flags and keys are actually consistent
bool have_private_admin_key = false ;
bool have_private_publish_key = false ;
for(auto mit = grpMeta->keys.private_keys.begin(); mit != grpMeta->keys.private_keys.end();++mit)
{
if(mit->second.keyFlags == (RSTLV_KEY_DISTRIB_PUBLISH | RSTLV_KEY_TYPE_FULL)) have_private_publish_key = true ;
if(mit->second.keyFlags == (RSTLV_KEY_DISTRIB_ADMIN | RSTLV_KEY_TYPE_FULL)) have_private_admin_key = true ;
}
if(have_private_admin_key && !(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
{
std::cerr << "(WW) inconsistency in group " << grpMeta->mGroupId << ": group does not have flag ADMIN but an admin key was found. Updating the flags." << std::endl;
grpMeta->mSubscribeFlags |= GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
}
if(!have_private_admin_key && (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
{
std::cerr << "(WW) inconsistency in group " << grpMeta->mGroupId << ": group has flag ADMIN but no admin key found. Updating the flags." << std::endl;
grpMeta->mSubscribeFlags &= ~GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
}
if(have_private_publish_key && !(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH))
{
std::cerr << "(WW) inconsistency in group " << grpMeta->mGroupId << ": group does not have flag PUBLISH but an admin key was found. Updating the flags." << std::endl;
grpMeta->mSubscribeFlags |= GXS_SERV::GROUP_SUBSCRIBE_PUBLISH;
}
if(!have_private_publish_key && (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH))
{
std::cerr << "(WW) inconsistency in group " << grpMeta->mGroupId << ": group has flag PUBLISH but no admin key found. Updating the flags." << std::endl;
grpMeta->mSubscribeFlags &= ~GXS_SERV::GROUP_SUBSCRIBE_PUBLISH;
}
if(ok)
return grpMeta;
else
delete grpMeta;
return NULL;
{
if(!use_cache)
delete grpMeta;
return NULL;
}
}
RsNxsGrp* RsDataService::locked_getGroup(RetroCursor &c)
@ -876,7 +930,7 @@ int RsDataService::storeGroup(const std::list<RsNxsGrp*>& grp)
cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus);
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
locked_updateGrpMetaCache(*grpMetaPtr);
if (!mDb->sqlInsert(GRP_TABLE_NAME, "", cv))
{
@ -892,10 +946,50 @@ int RsDataService::storeGroup(const std::list<RsNxsGrp*>& grp)
return ret;
}
void RsDataService::locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta)
{
auto it = mGrpMetaDataCache.find(meta.mGroupId) ;
if(it != mGrpMetaDataCache.end())
*(it->second) = meta ;
}
void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
{
mGrpMetaDataCache.erase(gid) ; // cleans existing cache entry
mGrpMetaDataCache_ContainsAllDatabase = false;
time_t now = time(NULL) ;
auto it = mGrpMetaDataCache.find(gid) ;
// We dont actually delete the item, because it might be used by a calling client.
// In this case, the memory will not be used for long, so we keep it into a list for a safe amount
// of time and delete it later. Using smart pointers here would be more elegant, but that would need
// to be implemented thread safe, which is difficult in this case.
if(it != mGrpMetaDataCache.end())
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "(II) moving database cache entry " << (void*)(*it).second << " to dead list." << std::endl;
#endif
mOldCachedItems.push_back(std::make_pair(now,it->second)) ;
mGrpMetaDataCache.erase(it) ;
mGrpMetaDataCache_ContainsAllDatabase = false;
}
// We also take that opportunity to delete old entries.
auto it2(mOldCachedItems.begin());
while(it2!=mOldCachedItems.end() && (*it2).first + CACHE_ENTRY_GRACE_PERIOD < now)
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "(II) deleting old GXS database cache entry " << (void*)(*it2).second << ", " << now - (*it2).first << " seconds old." << std::endl;
#endif
delete (*it2).second ;
it2 = mOldCachedItems.erase(it2) ;
}
}
int RsDataService::updateGroup(const std::list<RsNxsGrp *> &grp)
@ -966,7 +1060,7 @@ int RsDataService::updateGroup(const std::list<RsNxsGrp *> &grp)
mDb->sqlUpdate(GRP_TABLE_NAME, "grpId='" + grpPtr->grpId.toStdString() + "'", cv);
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
locked_updateGrpMetaCache(*grpMetaPtr);
}
// finish transaction
bool ret = mDb->commitTransaction();
@ -1009,7 +1103,7 @@ bool RsDataService::validSize(RsNxsGrp* grp) const
int RsDataService::retrieveNxsGrps(std::map<RsGxsGroupId, RsNxsGrp *> &grp, bool withMeta, bool /* cache */)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
int requestedGroups = grp.size();
#endif
@ -1097,7 +1191,7 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>
if(g)
{
if (metaOffset) {
g->metaData = locked_getGrpMeta(*c, metaOffset);
g->metaData = locked_getGrpMeta(*c, metaOffset,false);
}
grps.push_back(g);
}
@ -1109,7 +1203,7 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector<RsNxsGrp*>
int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, bool /* cache */, bool withMeta)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1197,7 +1291,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1274,7 +1368,7 @@ void RsDataService::locked_retrieveMsgMeta(RetroCursor *c, std::vector<RsGxsMsgM
}
}
int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData *>& grp)
int RsDataService::retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp)
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::retrieveGxsGrpMetaData()";
@ -1284,7 +1378,7 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
int requestedGroups = grp.size();
#endif
@ -1297,100 +1391,101 @@ int RsDataService::retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaDat
std::cerr << (void*)this << ": RsDataService::retrieveGxsGrpMetaData() retrieving all from cache!" << std::endl;
#endif
for(std::map<RsGxsGroupId,RsGxsGrpMetaData>::const_iterator it(mGrpMetaDataCache.begin());it!=mGrpMetaDataCache.end();++it)
grp[it->first] = new RsGxsGrpMetaData(it->second);
grp = mGrpMetaDataCache ;
}
else
{
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all" << std::endl;
std::cerr << "RsDataService::retrieveGxsGrpMetaData() retrieving all" << std::endl;
#endif
// clear the cache
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "", "");
if(c)
{
bool valid = c->moveToFirst();
if(c)
{
bool valid = c->moveToFirst();
while(valid)
{
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
if(g)
{
grp[g->mGroupId] = g;
mGrpMetaDataCache[g->mGroupId] = *g ;
while(valid)
{
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0,true);
if(g)
{
grp[g->mGroupId] = g;
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
std::cerr << (void *)this << ": Retrieving (all) Grp metadata grpId=" << g->mGroupId << std::endl;
#endif
}
valid = c->moveToNext();
}
valid = c->moveToNext();
#ifdef RS_DATA_SERVICE_DEBUG_TIME
++resultCount;
++resultCount;
#endif
}
delete c;
}
}
delete c;
}
mGrpMetaDataCache_ContainsAllDatabase = true ;
}
mGrpMetaDataCache_ContainsAllDatabase = true ;
}
}else
else
{
std::map<RsGxsGroupId, RsGxsGrpMetaData *>::iterator mit = grp.begin();
std::map<RsGxsGroupId, RsGxsGrpMetaData *>::iterator mit = grp.begin();
for(; mit != grp.end(); ++mit)
{
std::map<RsGxsGroupId, RsGxsGrpMetaData>::const_iterator itt = mGrpMetaDataCache.find(mit->first) ;
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::const_iterator itt = mGrpMetaDataCache.find(mit->first) ;
if(itt != mGrpMetaDataCache.end())
{
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
std::cerr << "Retrieving Grp metadata grpId=" << mit->first << " from cache!" << std::endl;
#endif
grp[mit->first] = new RsGxsGrpMetaData(itt->second) ;
grp[mit->first] = itt->second ;
}
else
{
{
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
std::cerr << "Retrieving Grp metadata grpId=" << mit->first ;
#endif
const RsGxsGroupId& grpId = mit->first;
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
const RsGxsGroupId& grpId = mit->first;
RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpMetaColumns, "grpId='" + grpId.toStdString() + "'", "");
if(c)
{
bool valid = c->moveToFirst();
if(c)
{
bool valid = c->moveToFirst();
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
if(!valid)
std::cerr << " Empty query! GrpId " << grpId << " is not in database" << std::endl;
if(!valid)
std::cerr << " Empty query! GrpId " << grpId << " is not in database" << std::endl;
#endif
while(valid)
{
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0);
while(valid)
{
RsGxsGrpMetaData* g = locked_getGrpMeta(*c, 0,true);
if(g)
{
grp[g->mGroupId] = g;
mGrpMetaDataCache[g->mGroupId] = *g ;
if(g)
{
grp[g->mGroupId] = g;
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
std::cerr << ". Got it. Updating cache." << std::endl;
std::cerr << ". Got it. Updating cache." << std::endl;
#endif
}
valid = c->moveToNext();
}
valid = c->moveToNext();
#ifdef RS_DATA_SERVICE_DEBUG_TIME
++resultCount;
++resultCount;
#endif
}
delete c;
}
}
delete c;
}
#ifdef RS_DATA_SERVICE_DEBUG_CACHE
else
std::cerr << ". not found!" << std::endl;
else
std::cerr << ". not found!" << std::endl;
#endif
}
}
}
}
@ -1491,7 +1586,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
RsStackMutex stack(mDbMutex);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1528,7 +1623,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
{
#ifdef RS_DATA_SERVICE_DEBUG_TIME
RsScopeTimer timer("");
rstime::RsScopeTimer timer("");
int resultCount = 0;
#endif
@ -1607,7 +1702,7 @@ bool RsDataService::locked_removeGroupEntries(const std::vector<RsGxsGroupId>& g
mDb->sqlDelete(GRP_TABLE_NAME, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
// also remove the group meta from cache.
mGrpMetaDataCache.erase(*vit) ;
locked_clearGrpMetaCache(*vit) ;
}
ret &= mDb->commitTransaction();

View File

@ -71,7 +71,7 @@ public:
* @param cache whether to store retrieval in mem for faster later retrieval
* @return error code
*/
int retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData*>& grp);
int retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp);
/*!
* Retrieves meta data of all groups stored (most current versions only)
@ -208,7 +208,7 @@ private:
* extracts a grp meta item from a cursor at its
* current position
*/
RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c, int colOffset);
RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c, int colOffset, bool use_cache);
/*!
* extracts a msg item from a cursor at its
@ -346,8 +346,11 @@ private:
// the entre list of grp metadata is requested (which happens quite often)
void locked_clearGrpMetaCache(const RsGxsGroupId& gid);
void locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta);
std::map<RsGxsGroupId,RsGxsGrpMetaData*> mGrpMetaDataCache ;
std::list<std::pair<time_t,RsGxsGrpMetaData*> > mOldCachedItems ;
std::map<RsGxsGroupId,RsGxsGrpMetaData> mGrpMetaDataCache ;
bool mGrpMetaDataCache_ContainsAllDatabase ;
};

View File

@ -36,9 +36,9 @@
#include "rsitems/rsnxsitems.h"
#include "gxs/rsgxsdata.h"
#include "rsgxs.h"
#include "rsgxsutil.h"
#include "util/contentvalue.h"
class RsGxsSearchModule {
public:
@ -61,6 +61,8 @@ public:
ContentValue val;
};
typedef std::map<RsGxsGroupId,RsGxsGrpMetaData*> RsGxsGrpMetaTemporaryMap;
/*!
* This allows modification of local
* meta data items of a group
@ -168,7 +170,7 @@ public:
* , if grpId is failed to be retrieved it will be erased from map
* @return error code
*/
virtual int retrieveGxsGrpMetaData(std::map<RsGxsGroupId, RsGxsGrpMetaData*>& grp) = 0;
virtual int retrieveGxsGrpMetaData(RsGxsGrpMetaTemporaryMap& grp) = 0;
/*!
* Retrieves meta data of all groups stored (most current versions only)

View File

@ -31,6 +31,7 @@
#include "gxssecurity.h"
#include "util/contentvalue.h"
#include "util/rsprint.h"
#include "util/rstime.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsgxscircles.h"
#include "retroshare/rsgrouter.h"
@ -138,7 +139,7 @@ void RsGenExchange::data_tick()
static const double timeDelta = 0.1; // slow tick in sec
tick();
usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
rstime::rs_usleep((int) (timeDelta * 1000 *1000)); // timeDelta sec
}
void RsGenExchange::tick()
@ -533,7 +534,7 @@ int RsGenExchange::createGroupSignatures(RsTlvKeySignatureSet& signSet, RsTlvBin
}
int RsGenExchange::createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinaryData& msgData,
const RsGxsMsgMetaData& msgMeta, RsGxsGrpMetaData& grpMeta)
const RsGxsMsgMetaData& msgMeta, const RsGxsGrpMetaData& grpMeta)
{
bool needPublishSign = false, needIdentitySign = false;
uint32_t grpFlag = grpMeta.mGroupFlags;
@ -714,8 +715,7 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::createMessage() " << std::endl;
#endif
std::map<RsGxsGroupId, RsGxsGrpMetaData*> metaMap;
RsGxsGrpMetaTemporaryMap metaMap ;
metaMap.insert(std::make_pair(id, (RsGxsGrpMetaData*)(NULL)));
mDataStore->retrieveGxsGrpMetaData(metaMap);
@ -730,7 +730,7 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
else
{
// get publish key
RsGxsGrpMetaData* grpMeta = metaMap[id];
const RsGxsGrpMetaData* grpMeta = metaMap[id];
uint32_t metaDataLen = meta.serial_size();
uint32_t allMsgDataLen = metaDataLen + msg->msg.bin_len;
@ -763,8 +763,6 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
delete[] metaData;
delete[] allMsgData;
delete grpMeta;
}
if(ret_val == SIGN_FAIL)
@ -1196,14 +1194,14 @@ bool RsGenExchange::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResult
bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
{
std::list<RsGxsGrpMetaData*> metaL;
std::list<const RsGxsGrpMetaData*> metaL;
bool ok = mDataAccess->getGroupSummary(token, metaL);
RsGroupMetaData m;
for( std::list<RsGxsGrpMetaData*>::iterator lit = metaL.begin(); lit != metaL.end(); ++lit)
for( auto lit = metaL.begin(); lit != metaL.end(); ++lit)
{
RsGxsGrpMetaData& gMeta = *(*lit);
const RsGxsGrpMetaData& gMeta = *(*lit);
m = gMeta;
RsGroupNetworkStats sts ;
@ -1223,7 +1221,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list<RsGroupMetaDat
}
groupInfo.push_back(m);
delete (*lit);
}
return ok;
@ -1646,7 +1643,7 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISHKEY, false);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISHKEY, true);
gc->mGrpIdList.push_back(grpId);
mNotifications.push_back(gc);
}
@ -2080,10 +2077,10 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
// first find out which mask is involved
int32_t value, mask, currValue;
std::string key;
RsGxsGrpMetaData* grpMeta = NULL;
const RsGxsGrpMetaData* grpMeta = NULL;
bool ok = false;
std::map<RsGxsGroupId, RsGxsGrpMetaData* > grpMetaMap;
RsGxsGrpMetaTemporaryMap grpMetaMap;
std::map<RsGxsGroupId, RsGxsGrpMetaData* >::iterator mit;
grpMetaMap.insert(std::make_pair(grpId, (RsGxsGrpMetaData*)(NULL)));
@ -2092,6 +2089,7 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
if((mit = grpMetaMap.find(grpId)) != grpMetaMap.end())
{
grpMeta = mit->second;
if (!grpMeta)
{
#ifdef GEN_EXCH_DEBUG
@ -2112,12 +2110,9 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
{
key = RsGeneralDataService::GRP_META_SUBSCRIBE_FLAG;
currValue = grpMeta->mSubscribeFlags;
}else
{
if(grpMeta)
delete grpMeta;
return !(grpCv.empty());
}
else
return !(grpCv.empty());
ok &= grpCv.getAsInt32(key+GXS_MASK, mask);
@ -2129,9 +2124,6 @@ bool RsGenExchange::processGrpMask(const RsGxsGroupId& grpId, ContentValue &grpC
grpCv.put(key, value);
if(grpMeta)
delete grpMeta;
return ok;
}
@ -2350,7 +2342,7 @@ void RsGenExchange::processGroupUpdatePublish()
// get keys for group update publish
// first build meta request map for groups to be updated
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
std::vector<GroupUpdatePublish>::iterator vit = mGroupUpdatePublish.begin();
for(; vit != mGroupUpdatePublish.end(); ++vit)
@ -2360,8 +2352,8 @@ void RsGenExchange::processGroupUpdatePublish()
grpMeta.insert(std::make_pair(groupId, (RsGxsGrpMetaData*)(NULL)));
}
if(grpMeta.empty())
return;
if(grpMeta.empty())
return;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
@ -2373,18 +2365,16 @@ void RsGenExchange::processGroupUpdatePublish()
const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId;
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMeta.find(groupId);
RsGxsGrpMetaData* meta = NULL;
const RsGxsGrpMetaData* meta = NULL;
if(mit == grpMeta.end() || mit->second == NULL)
{
std::cerr << "Error! could not find meta of old group to update!" << std::endl;
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
delete gup.grpItem;
continue;
}else
{
meta = mit->second;
}
else
meta = mit->second;
//gup.grpItem->meta = *meta;
GxsGrpPendingSign ggps(gup.grpItem, gup.mToken);
@ -2402,14 +2392,13 @@ void RsGenExchange::processGroupUpdatePublish()
ggps.mToken = gup.mToken;
mGrpsToPublish.push_back(ggps);
}
else
else
{
std::cerr << "(EE) publish group fails because RS cannot find the private publish and author keys" << std::endl;
delete gup.grpItem;
mDataAccess->updatePublicRequestStatus(gup.mToken, RsTokenService::GXS_REQUEST_V2_STATUS_FAILED);
}
delete meta;
}
mGroupUpdatePublish.clear();
@ -2591,7 +2580,11 @@ void RsGenExchange::publishGrps()
ggps.mKeys = fullKeySet;
}
else
{
// We should just merge the keys instead of overwriting them, because the update may not contain private parts.
fullKeySet = ggps.mKeys;
}
// find private admin key
RsTlvPrivateRSAKey privAdminKey;
@ -2767,7 +2760,7 @@ void RsGenExchange::publishGrps()
if(!grpChanged.empty())
{
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISH, false);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
gc->mGrpIdList = grpChanged;
mNotifications.push_back(gc);
#ifdef GEN_EXCH_DEBUG
@ -2781,8 +2774,8 @@ void RsGenExchange::publishGrps()
// This is done off-mutex to avoid possible cross deadlocks with the net service.
if(mNetService!=NULL)
for(std::list<RsGxsGroupId>::const_iterator it(groups_to_subscribe.begin());it!=groups_to_subscribe.end();++it)
mNetService->subscribeStatusChanged((*it),true) ;
for(std::list<RsGxsGroupId>::const_iterator it(groups_to_subscribe.begin());it!=groups_to_subscribe.end();++it)
mNetService->subscribeStatusChanged((*it),true) ;
}
@ -2814,23 +2807,20 @@ bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet
RS_STACK_MUTEX(mGenMtx) ;
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
grpMeta[grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
if(grpMeta.empty())
return false;
RsGxsGrpMetaData* meta = grpMeta[grpId];
const RsGxsGrpMetaData* meta = grpMeta[grpId];
if(meta == NULL)
return false;
keySet = meta->keys;
GxsSecurity::createPublicKeysFromPrivateKeys(keySet) ;
for(std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator it=grpMeta.begin();it!=grpMeta.end();++it)
delete it->second ;
GxsSecurity::createPublicKeysFromPrivateKeys(keySet) ;
return true;
}
@ -2900,7 +2890,9 @@ void RsGenExchange::processRecvdMessages()
if(!accept_new_msg || gpsi.mFirstTryTS + VALIDATE_MAX_WAITING_TIME < now)
{
#ifdef GEN_EXCH_DEBUG
std::cerr << "Pending validation grp=" << gpsi.mId.first << ", msg=" << gpsi.mId.second << ", has exceeded validation time limit. The author's key can probably not be obtained. This is unexpected." << std::endl;
#endif
delete gpsi.mItem;
pend_it = mMsgPendingValidate.erase(pend_it);
@ -2958,11 +2950,12 @@ void RsGenExchange::processRecvdMessages()
continue ;
}
RsGxsGrpMetaData *grpMeta = mit->second;
const RsGxsGrpMetaData *grpMeta = mit->second;
RsTlvSecurityKeySet keys = grpMeta->keys ;
GxsSecurity::createPublicKeysFromPrivateKeys(grpMeta->keys); // make sure we have the public keys that correspond to the private ones, as it happens. Most of the time this call does nothing.
GxsSecurity::createPublicKeysFromPrivateKeys(keys); // make sure we have the public keys that correspond to the private ones, as it happens. Most of the time this call does nothing.
int validateReturn = validateMsg(msg, grpMeta->mGroupFlags, grpMeta->mSignFlags, grpMeta->keys);
int validateReturn = validateMsg(msg, grpMeta->mGroupFlags, grpMeta->mSignFlags, keys);
#ifdef GEN_EXCH_DEBUG
std::cerr << " grpMeta.mSignFlags: " << std::hex << grpMeta->mSignFlags << std::dec << std::endl;
@ -3176,7 +3169,7 @@ void RsGenExchange::processRecvdGroups()
void RsGenExchange::performUpdateValidation()
{
RS_STACK_MUTEX(mGenMtx) ;
RS_STACK_MUTEX(mGenMtx) ;
if(mGroupUpdates.empty())
return;
@ -3185,7 +3178,7 @@ void RsGenExchange::performUpdateValidation()
std::cerr << "RsGenExchange::performUpdateValidation() " << std::endl;
#endif
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMetas;
RsGxsGrpMetaTemporaryMap grpMetas;
std::vector<GroupUpdate>::iterator vit = mGroupUpdates.begin();
for(; vit != mGroupUpdates.end(); ++vit)
@ -3200,8 +3193,7 @@ void RsGenExchange::performUpdateValidation()
for(; vit != mGroupUpdates.end(); ++vit)
{
GroupUpdate& gu = *vit;
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit =
grpMetas.find(gu.newGrp->grpId);
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(gu.newGrp->grpId);
gu.oldGrpMeta = mit->second;
gu.validUpdate = updateValid(*(gu.oldGrpMeta), *(gu.newGrp));
}
@ -3223,51 +3215,57 @@ void RsGenExchange::performUpdateValidation()
if(gu.newGrp->metaData->mCircleType == GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY)
gu.newGrp->metaData->mOriginator = gu.newGrp->PeerId();
// Keep subscriptionflag to what it was. This avoids clearing off the flag when updates to group meta information
// is received.
gu.newGrp->metaData->mSubscribeFlags = gu.oldGrpMeta->mSubscribeFlags ;
// Keep subscriptionflag to what it was. This avoids clearing off the flag when updates to group meta information
// is received.
gu.newGrp->metaData->mSubscribeFlags = gu.oldGrpMeta->mSubscribeFlags ;
// Also keep private keys if present
if(!gu.newGrp->metaData->keys.private_keys.empty())
std::cerr << "(EE) performUpdateValidation() group " <<gu.newGrp->metaData->mGroupId << " has been received with private keys. This is very unexpected!" << std::endl;
else
gu.newGrp->metaData->keys.private_keys = gu.oldGrpMeta->keys.private_keys ;
grps.push_back(gu.newGrp);
}
else
{
delete gu.newGrp;
gu.newGrp = NULL ;
gu.newGrp = NULL ;
}
delete gu.oldGrpMeta;
gu.oldGrpMeta = NULL ;
gu.oldGrpMeta = NULL ;
}
// notify the client
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
for(uint32_t i=0;i<mGroupUpdates.size();++i)
if(mGroupUpdates[i].newGrp != NULL)
{
c->mGrpIdList.push_back(mGroupUpdates[i].newGrp->grpId) ;
// notify the client
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
for(uint32_t i=0;i<mGroupUpdates.size();++i)
if(mGroupUpdates[i].newGrp != NULL)
{
c->mGrpIdList.push_back(mGroupUpdates[i].newGrp->grpId) ;
#ifdef GEN_EXCH_DEBUG
std::cerr << " " << mGroupUpdates[i].newGrp->grpId << std::endl;
std::cerr << " " << mGroupUpdates[i].newGrp->grpId << std::endl;
#endif
}
mNotifications.push_back(c);
// Warning: updateGroup will destroy the objects in grps. Dont use it afterwards!
}
mNotifications.push_back(c);
// Warning: updateGroup will destroy the objects in grps. Dont use it afterwards!
mDataStore->updateGroup(grps);
#ifdef GEN_EXCH_DEBUG
std::cerr << " adding the following grp ids to notification: " << std::endl;
std::cerr << " adding the following grp ids to notification: " << std::endl;
#endif
// cleanup
// cleanup
mGroupUpdates.clear();
}
bool RsGenExchange::updateValid(RsGxsGrpMetaData& oldGrpMeta, RsNxsGrp& newGrp) const
bool RsGenExchange::updateValid(const RsGxsGrpMetaData& oldGrpMeta, const RsNxsGrp& newGrp) const
{
std::map<SignType, RsTlvKeySignature>& signSet = newGrp.metaData->signSet.keySignSet;
std::map<SignType, RsTlvKeySignature>::iterator mit = signSet.find(INDEX_AUTHEN_ADMIN);
@ -3283,10 +3281,11 @@ bool RsGenExchange::updateValid(RsGxsGrpMetaData& oldGrpMeta, RsNxsGrp& newGrp)
}
RsTlvKeySignature adminSign = mit->second;
RsTlvSecurityKeySet old_keys = oldGrpMeta.keys ;
GxsSecurity::createPublicKeysFromPrivateKeys(oldGrpMeta.keys); // make sure we have the public keys that correspond to the private ones, as it happens. Most of the time this call does nothing.
GxsSecurity::createPublicKeysFromPrivateKeys(old_keys); // make sure we have the public keys that correspond to the private ones, as it happens. Most of the time this call does nothing.
std::map<RsGxsId, RsTlvPublicRSAKey>& keys = oldGrpMeta.keys.public_keys;
std::map<RsGxsId, RsTlvPublicRSAKey>& keys = old_keys.public_keys;
std::map<RsGxsId, RsTlvPublicRSAKey>::iterator keyMit = keys.find(RsGxsId(oldGrpMeta.mGroupId));
if(keyMit == keys.end())

View File

@ -223,7 +223,7 @@ public:
* @param groupInfo
* @return false if could not redeem token
*/
bool getGroupMeta(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo);
bool getGroupMeta(const uint32_t &token, std::list<RsGroupMetaData>& groupInfo);
/*!
* retrieves message meta data associated to a request token
@ -765,7 +765,7 @@ private:
* SIGN_FAIL_TRY_LATER for Id sign key not avail (but requested), try later
*/
int createMsgSignatures(RsTlvKeySignatureSet& signSet, RsTlvBinaryData& msgData,
const RsGxsMsgMetaData& msgMeta, RsGxsGrpMetaData& grpMeta);
const RsGxsMsgMetaData& msgMeta, const RsGxsGrpMetaData& grpMeta);
/*!
* convenience function to create sign for groups
@ -835,7 +835,7 @@ private:
* @param newGrp the new group that updates the old group (must have meta data member initialised)
* @return
*/
bool updateValid(RsGxsGrpMetaData& oldGrp, RsNxsGrp& newGrp) const;
bool updateValid(const RsGxsGrpMetaData& oldGrp, const RsNxsGrp& newGrp) const;
/*!
* convenience function for checking private publish and admin keys are present
@ -915,7 +915,6 @@ private:
std::vector<MsgDeletePublish> mMsgDeletePublish;
std::map<RsGxsId,std::set<RsPeerId> > mRoutingClues ;
std::list<std::pair<RsGxsMessageId,RsPeerId> > mTrackingClues ;
};
#endif // RSGENEXCHANGE_H

View File

@ -186,7 +186,8 @@ class RsGixsReputation
{
public:
// get Reputation.
virtual RsReputations::ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL) = 0;
virtual RsReputations::ReputationLevel overallReputationLevel(const RsGxsId& id,uint32_t *identity_flags=NULL) = 0;
virtual ~RsGixsReputation(){}
};
/*** This Class pulls all the GXS Interfaces together ****/
@ -210,6 +211,7 @@ virtual ~RsGxsIdExchange() { return; }
class RsGcxs
{
public:
virtual ~RsGcxs(){}
/* GXS Interface - for working out who can receive */
virtual bool isLoaded(const RsGxsCircleId &circleId) = 0;

View File

@ -33,7 +33,7 @@ RsGxsGrpMetaData::RsGxsGrpMetaData()
clear();
}
uint32_t RsGxsGrpMetaData::serial_size(uint32_t api_version)
uint32_t RsGxsGrpMetaData::serial_size(uint32_t api_version) const
{
uint32_t s = 8; // header size

View File

@ -51,7 +51,7 @@ public:
RsGxsGrpMetaData();
bool deserialise(void *data, uint32_t &pktsize);
bool serialise(void* data, uint32_t &pktsize, uint32_t api_version);
uint32_t serial_size(uint32_t api_version);
uint32_t serial_size(uint32_t api_version) const;
void clear();
void operator =(const RsGroupMetaData& rMeta);

View File

@ -25,6 +25,7 @@
#include <time.h>
#include "rsgxsutil.h"
#include "rsgxsdataaccess.h"
#include "retroshare/rsgxsflags.h"
@ -377,7 +378,7 @@ bool RsGxsDataAccess::clearRequest(const uint32_t& token)
return true;
}
bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<RsGxsGrpMetaData*>& groupInfo)
bool RsGxsDataAccess::getGroupSummary(const uint32_t& token, std::list<const RsGxsGrpMetaData*>& groupInfo)
{
RS_STACK_MUTEX(mDataMutex);
@ -1000,18 +1001,17 @@ bool RsGxsDataAccess::getGroupData(GroupDataReq* req)
bool RsGxsDataAccess::getGroupSummary(GroupMetaReq* req)
{
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
std::list<RsGxsGroupId> grpIdsOut;
std::list<RsGxsGroupId> grpIdsOut;
getGroupList(req->mGroupIds, req->Options, grpIdsOut);
getGroupList(req->mGroupIds, req->Options, grpIdsOut);
if(grpIdsOut.empty())
return true;
if(grpIdsOut.empty())
return true;
std::list<RsGxsGroupId>::const_iterator lit = grpIdsOut.begin();
std::list<RsGxsGroupId>::const_iterator lit = grpIdsOut.begin();
for(; lit != grpIdsOut.end(); ++lit)
for(; lit != grpIdsOut.end(); ++lit)
grpMeta[*lit] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
@ -1033,29 +1033,18 @@ bool RsGxsDataAccess::getGroupList(GroupIdReq* req)
bool RsGxsDataAccess::getGroupList(const std::list<RsGxsGroupId>& grpIdsIn, const RsTokReqOptions& opts, std::list<RsGxsGroupId>& grpIdsOut)
{
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
std::list<RsGxsGroupId>::const_iterator lit = grpIdsIn.begin();
for(; lit != grpIdsIn.end(); ++lit)
grpMeta[*lit] = NULL;
for(auto lit = grpIdsIn.begin(); lit != grpIdsIn.end(); ++lit)
grpMeta[*lit] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMeta.begin();
for(; mit != grpMeta.end(); ++mit)
{
grpIdsOut.push_back(mit->first);
}
for(auto mit = grpMeta.begin() ; mit != grpMeta.end(); ++mit)
grpIdsOut.push_back(mit->first);
filterGrpList(grpIdsOut, opts, grpMeta);
for(mit = grpMeta.begin(); mit != grpMeta.end(); ++mit)
{
delete mit->second; // so wasteful!!
}
return true;
}
@ -1622,12 +1611,10 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req)
// potentially very expensive!
bool RsGxsDataAccess::getServiceStatistic(ServiceStatisticRequest *req)
{
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta ;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMeta.begin();
req->mServiceStatistic.mNumGrps = grpMeta.size();
req->mServiceStatistic.mNumMsgs = 0;
req->mServiceStatistic.mSizeOfGrps = 0;
@ -1638,9 +1625,9 @@ bool RsGxsDataAccess::getServiceStatistic(ServiceStatisticRequest *req)
req->mServiceStatistic.mNumChildMsgsNew = 0;
req->mServiceStatistic.mNumChildMsgsUnread = 0;
for(; mit != grpMeta.end(); ++mit)
for(auto mit = grpMeta.begin(); mit != grpMeta.end(); ++mit)
{
RsGxsGrpMetaData* m = mit->second;
const RsGxsGrpMetaData* m = mit->second;
req->mServiceStatistic.mSizeOfGrps += m->mGrpSize + m->serial_size(RS_GXS_GRP_META_DATA_CURRENT_API_VERSION);
if (IS_GROUP_SUBSCRIBED(m->mSubscribeFlags))
@ -1658,8 +1645,6 @@ bool RsGxsDataAccess::getServiceStatistic(ServiceStatisticRequest *req)
req->mServiceStatistic.mNumChildMsgsNew += gr.mGroupStatistic.mNumChildMsgsNew;
req->mServiceStatistic.mNumChildMsgsUnread += gr.mGroupStatistic.mNumChildMsgsUnread;
}
delete m;
}
req->mServiceStatistic.mSizeStore = req->mServiceStatistic.mSizeOfGrps + req->mServiceStatistic.mSizeOfMsgs;

View File

@ -209,7 +209,7 @@ public:
* @param token request token to be redeemed
* @param groupInfo
*/
bool getGroupSummary(const uint32_t &token, std::list<RsGxsGrpMetaData*> &groupInfo);
bool getGroupSummary(const uint32_t &token, std::list<const RsGxsGrpMetaData*>& groupInfo);
/*!
*

View File

@ -255,6 +255,7 @@
#include "retroshare/rspeers.h"
#include "pgp/pgpauxutils.h"
#include "util/rsdir.h"
#include "util/rstime.h"
#include "util/rsmemory.h"
#include "util/stacktrace.h"
@ -433,6 +434,8 @@ int RsGxsNetService::tick()
should_notify = should_notify || !mNewGroupsToNotify.empty() ;
should_notify = should_notify || !mNewMessagesToNotify.empty() ;
should_notify = should_notify || !mNewPublishKeysToNotify.empty() ;
should_notify = should_notify || !mNewStatsToNotify.empty() ;
}
if(should_notify)
@ -495,8 +498,11 @@ void RsGxsNetService::processObserverNotifications()
if(!grps_copy.empty()) mObserver->notifyNewGroups (grps_copy);
if(!msgs_copy.empty()) mObserver->notifyNewMessages(msgs_copy);
for(std::set<RsGxsGroupId>::const_iterator it(keys_copy.begin());it!=keys_copy.end();++it) mObserver->notifyReceivePublishKey(*it);
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it) mObserver->notifyChangedGroupStats(*it);
for(std::set<RsGxsGroupId>::const_iterator it(keys_copy.begin());it!=keys_copy.end();++it)
mObserver->notifyReceivePublishKey(*it);
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it)
mObserver->notifyChangedGroupStats(*it);
}
void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
@ -734,7 +740,7 @@ void RsGxsNetService::syncGrpStatistics()
time_t now = time(NULL) ;
for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it)
for(auto it(grpMeta.begin());it!=grpMeta.end();++it)
{
const RsGxsGrpConfig& rec = locked_getGrpConfig(it->first) ;
@ -800,7 +806,7 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
mDataStore->retrieveGxsGrpMetaData(grpMetas);
RsGxsGrpMetaData* grpMeta = grpMetas[grs->grpId];
const RsGxsGrpMetaData* grpMeta = grpMetas[grs->grpId];
if(grpMeta == NULL)
{
@ -1832,7 +1838,7 @@ void RsGxsNetService::data_tick()
static const double timeDelta = 0.5;
//Start waiting as nothing to do in runup
usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
rstime::rs_usleep((int) (timeDelta * 1000 * 1000)); // timeDelta sec
if(mUpdateCounter >= 120) // 60 seconds
{
@ -1996,7 +2002,7 @@ void RsGxsNetService::updateServerSyncTS()
// finally, update timestamps.
bool change = false;
for(std::map<RsGxsGroupId, RsGxsGrpMetaData*>::const_iterator mit = gxsMap.begin();mit != gxsMap.end(); ++mit)
for(auto mit = gxsMap.begin();mit != gxsMap.end(); ++mit)
{
// Check if the group is subscribed and restricted to a circle. If the circle has changed, update the
// global TS to reflect that change to clients who may be able to see/subscribe to that particular group.
@ -2767,7 +2773,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
grpMetaMap[grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
RsGxsGrpMetaData* grpMeta = grpMetaMap[grpId];
const RsGxsGrpMetaData* grpMeta = grpMetaMap[grpId];
if(grpMeta == NULL) // this should not happen, but just in case...
{
@ -3870,9 +3876,9 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
GXSNETDEBUG_P_(peer) << " Group list beings being sent: " << std::endl;
#endif
for(std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grp.begin(); mit != grp.end(); ++mit)
for(auto mit = grp.begin(); mit != grp.end(); ++mit)
{
RsGxsGrpMetaData* grpMeta = mit->second;
const RsGxsGrpMetaData* grpMeta = mit->second;
// Only send info about subscribed groups.
@ -3944,7 +3950,7 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& /* toVet */, bool& should_encrypt)
bool RsGxsNetService::canSendGrpId(const RsPeerId& sslId, const RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& /* toVet */, bool& should_encrypt)
{
#ifdef NXS_NET_DEBUG_4
GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendGrpId()"<< std::endl;
@ -4137,7 +4143,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
grpMetas[item->grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetas);
RsGxsGrpMetaData* grpMeta = grpMetas[item->grpId];
const RsGxsGrpMetaData* grpMeta = grpMetas[item->grpId];
if(grpMeta == NULL)
{
@ -4678,7 +4684,7 @@ void RsGxsNetService::sharePublishKeysPending()
// Find the publish keys in the retrieved info
RsGxsGrpMetaData *grpMeta = grpMetaMap[mit->first] ;
const RsGxsGrpMetaData *grpMeta = grpMetaMap[mit->first] ;
if(grpMeta == NULL)
{
@ -4763,7 +4769,7 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
// update the publish keys in this group meta info
RsGxsGrpMetaData *grpMeta = grpMetaMap[item->grpId] ;
const RsGxsGrpMetaData *grpMeta = grpMetaMap[item->grpId] ;
if (!grpMeta) {
std::cerr << "(EE) RsGxsNetService::handleRecvPublishKeys() grpMeta not found." << std::endl;
return ;
@ -4800,14 +4806,16 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
#ifdef NXS_NET_DEBUG_3
GXSNETDEBUG_PG(item->PeerId(),item->grpId)<< " (EE) Publish key already present in database. Discarding message." << std::endl;
#endif
mNewPublishKeysToNotify.insert(item->grpId) ;
return ;
}
// Store/update the info.
grpMeta->keys.private_keys[item->private_key.keyId] = item->private_key ;
RsTlvSecurityKeySet keys = grpMeta->keys ;
keys.private_keys[item->private_key.keyId] = item->private_key ;
bool ret = mDataStore->updateGroupKeys(item->grpId,grpMeta->keys, grpMeta->mSubscribeFlags | GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) ;
bool ret = mDataStore->updateGroupKeys(item->grpId,keys, grpMeta->mSubscribeFlags | GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) ;
if(ret)
{

View File

@ -370,7 +370,7 @@ private:
* @param toVet groupid/peer to vet are stored here if their circle id is not cached
* @return false, if you cannot send to this peer, true otherwise
*/
bool canSendGrpId(const RsPeerId& sslId, RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet, bool &should_encrypt);
bool canSendGrpId(const RsPeerId& sslId, const RsGxsGrpMetaData& grpMeta, std::vector<GrpIdCircleVet>& toVet, bool &should_encrypt);
bool canSendMsgIds(std::vector<RsGxsMsgMetaData*>& msgMetas, const RsGxsGrpMetaData&, const RsPeerId& sslId, RsGxsCircleId &should_encrypt_id);
/*!

View File

@ -28,7 +28,8 @@
GroupMetaReq::~GroupMetaReq()
{
rsstd::delete_all(mGroupMetaData.begin(), mGroupMetaData.end());
//rsstd::delete_all(mGroupMetaData.begin(), mGroupMetaData.end()); // now memory ownership is kept by the cache.
mGroupMetaData.clear();
}
GroupDataReq::~GroupDataReq()

View File

@ -52,7 +52,7 @@ public:
public:
std::list<RsGxsGroupId> mGroupIds;
std::list<RsGxsGrpMetaData*> mGroupMetaData;
std::list<const RsGxsGrpMetaData*> mGroupMetaData;
};
class GroupIdReq : public GxsRequest

View File

@ -42,13 +42,10 @@ static const uint32_t MAX_GXS_IDS_REQUESTS_NET = 10 ; // max number of reques
RsGxsMessageCleanUp::RsGxsMessageCleanUp(RsGeneralDataService* const dataService, RsGenExchange *genex, uint32_t chunkSize)
: mDs(dataService), mGenExchangeClient(genex), CHUNK_SIZE(chunkSize)
{
std::map<RsGxsGroupId, RsGxsGrpMetaData*> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
mDs->retrieveGxsGrpMetaData(grpMeta);
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator cit = grpMeta.begin();
for(;cit != grpMeta.end(); ++cit)
for(auto cit=grpMeta.begin();cit != grpMeta.end(); ++cit)
mGrpMeta.push_back(cit->second);
}
@ -64,7 +61,7 @@ bool RsGxsMessageCleanUp::clean()
#endif
while(!mGrpMeta.empty())
{
RsGxsGrpMetaData* grpMeta = mGrpMeta.back();
const RsGxsGrpMetaData* grpMeta = mGrpMeta.back();
const RsGxsGroupId& grpId = grpMeta->mGroupId;
mGrpMeta.pop_back();
GxsMsgReq req;
@ -137,8 +134,6 @@ bool RsGxsMessageCleanUp::clean()
mDs->removeMsgs(req);
delete grpMeta;
i++;
if(i > CHUNK_SIZE) break;
}

View File

@ -32,6 +32,7 @@
class RsGixs ;
class RsGenExchange ;
class RsGeneralDataService ;
// temporary holds a map of pointers to class T, and destroys all pointers on delete.
@ -104,7 +105,7 @@ public:
}
};
typedef t_RsGxsGenericDataTemporaryMap<RsGxsGroupId,RsGxsGrpMetaData> RsGxsGrpMetaTemporaryMap;
typedef std::map<RsGxsGroupId,RsGxsGrpMetaData*> RsGxsGrpMetaTemporaryMap;
typedef t_RsGxsGenericDataTemporaryMap<RsGxsGroupId,RsNxsGrp> RsNxsGrpDataTemporaryMap;
typedef t_RsGxsGenericDataTemporaryMapVector<RsGxsMsgMetaData> RsGxsMsgMetaTemporaryMap ;
@ -178,7 +179,7 @@ private:
RsGeneralDataService* const mDs;
RsGenExchange *mGenExchangeClient;
uint32_t CHUNK_SIZE;
std::vector<RsGxsGrpMetaData*> mGrpMeta;
std::vector<const RsGxsGrpMetaData*> mGrpMeta;
};
/*!
@ -226,7 +227,7 @@ class GroupUpdate
public:
GroupUpdate() : oldGrpMeta(NULL), newGrp(NULL), validUpdate(false)
{}
RsGxsGrpMetaData* oldGrpMeta;
const RsGxsGrpMetaData* oldGrpMeta;
RsNxsGrp* newGrp;
bool validUpdate;
};

View File

@ -143,7 +143,10 @@ void p3GxsTunnelService::flush()
for(std::list<RsGxsTunnelDHPublicKeyItem*>::iterator it=pendingDHItems.begin();it!=pendingDHItems.end();)
if(locked_sendClearTunnelData(*it) )
{
delete *it ;
it = pendingDHItems.erase(it) ;
}
else
++it ;
}
@ -155,7 +158,10 @@ void p3GxsTunnelService::flush()
for(std::list<RsGxsTunnelItem*>::iterator it=pendingGxsTunnelItems.begin();it!=pendingGxsTunnelItems.end();)
if(locked_sendEncryptedTunnelData(*it) )
{
delete *it ;
it = pendingGxsTunnelItems.erase(it) ;
}
else
{
++it ;
@ -744,6 +750,8 @@ void p3GxsTunnelService::receiveTurtleData(RsTurtleGenericTunnelItem *gitem,cons
}
else
std::cerr << "(EE) Deserialiased item has unexpected type." << std::endl;
delete citem ;
}
}

View File

@ -1,7 +1,7 @@
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
TEMPLATE = lib
CONFIG += staticlib bitdht
CONFIG += staticlib
CONFIG += create_prl
CONFIG -= qt
TARGET = retroshare
@ -10,7 +10,14 @@ DESTDIR = lib
#CONFIG += dsdv
# the dht stunner is used to obtain RS' external ip addr. when it is natted
retrotor {
DEFINES *= RETROTOR
CONFIG -= bitdht
} else {
CONFIG += bitdht
}
# the dht stunner is used to obtain RS external ip addr. when it is natted
# this system is unreliable and rs supports a newer and better one (asking connected peers)
# CONFIG += useDhtStunner
@ -90,6 +97,7 @@ HEADERS += tcponudp/udppeer.h \
tcponudp/tcpstream.h \
tcponudp/tou.h \
tcponudp/udprelay.h \
pqi/pqissludp.h \
SOURCES += tcponudp/udppeer.cc \
tcponudp/tcppacket.cc \
@ -97,6 +105,7 @@ SOURCES += tcponudp/udppeer.cc \
tcponudp/tou.cc \
tcponudp/bss_tou.c \
tcponudp/udprelay.cc \
pqi/pqissludp.cc \
useDhtStunner {
HEADERS += dht/stunaddrassist.h \
@ -434,7 +443,6 @@ HEADERS += pqi/authssl.h \
pqi/pqissllistener.h \
pqi/pqisslpersongrp.h \
pqi/pqissli2pbob.h \
pqi/pqissludp.h \
pqi/pqisslproxy.h \
pqi/pqistore.h \
pqi/pqistreamer.h \
@ -539,7 +547,7 @@ HEADERS += util/folderiterator.h \
util/rsmemcache.h \
util/rstickevent.h \
util/rsrecogn.h \
util/rsscopetimer.h \
util/rstime.h \
util/stacktrace.h \
util/rsdeprecate.h \
util/cxx11retrocompat.h
@ -590,7 +598,6 @@ SOURCES += pqi/authgpg.cc \
pqi/pqissllistener.cc \
pqi/pqisslpersongrp.cc \
pqi/pqissli2pbob.cpp \
pqi/pqissludp.cc \
pqi/pqisslproxy.cc \
pqi/pqistore.cc \
pqi/pqistreamer.cc \
@ -688,7 +695,7 @@ SOURCES += util/folderiterator.cc \
util/rsrandom.cc \
util/rstickevent.cc \
util/rsrecogn.cc \
util/rsscopetimer.cc
util/rstime.cc
upnp_miniupnpc {
@ -919,24 +926,28 @@ test_bitdht {
################################# Android #####################################
android-g++ {
android-* {
## ifaddrs is missing on Android to add them don't use the one from
## https://github.com/morristech/android-ifaddrs
## because they crash, use QNetworkInterface from Qt instead
## because it crash, use QNetworkInterface from Qt instead
CONFIG *= qt
QT *= network
## Add this here and not in retroshare.pri because static library are very
## sensible to order in command line, has to be in the end of file for the
## same reason
DEFINES *= "fopen64=fopen"
DEFINES *= "fseeko64=fseeko"
DEFINES *= "ftello64=ftello"
LIBS *= -lbz2 -lupnp -lixml -lthreadutil -lsqlite3
## Static library are verysensible to order in command line, has to be in the
## end of file for this reason
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lsqlcipher
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libsqlcipher.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
INCLUDEPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
INCLUDEPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
HEADERS += util/androiddebug.h

View File

@ -35,6 +35,7 @@
class PgpAuxUtils
{
public:
virtual ~PgpAuxUtils(){}
virtual const RsPgpId &getPGPOwnId() = 0;
virtual RsPgpId getPGPId(const RsPeerId& sslid) = 0;

View File

@ -360,8 +360,9 @@ bool RsCertificate::initFromString(const std::string& instr,uint32_t& err_code)
}
break ;
default:
err_code = CERTIFICATE_PARSING_ERROR_UNKNOWN_SECTION_PTAG ;
return false ;
std::cerr << "(WW) unknwown PTAG 0x" << std::hex << ptag << std::dec << " in certificate! Ignoring it." << std::endl;
buf = &buf[s] ;
break ;
}
total_s += s ;

View File

@ -35,6 +35,7 @@
#include "pgp/pgphandler.h"
#include <util/rsdir.h>
#include <util/rstime.h>
#include <pgp/pgpkeyutil.h>
#include <unistd.h> /* for (u)sleep() */
#include <iostream>
@ -187,7 +188,7 @@ int AuthGPG::GPGInit(const RsPgpId &ownId)
void AuthGPG::data_tick()
{
usleep(100 * 1000); //100 msec
rstime::rs_usleep(100 * 1000); //100 msec
/// every 100 milliseconds
processServices();

View File

@ -3,7 +3,8 @@
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2007-2011 by Robert Fernie.
* Copyright (C) 2007-2011 Robert Fernie
* Copyright (C) 2015-2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -24,6 +25,7 @@
*/
#include <time.h>
#include <vector>
#include "pqi/p3netmgr.h"
@ -37,8 +39,7 @@
#include "util/extaddrfinder.h"
#include "util/dnsresolver.h"
//#include "util/rsprint.h"
//#include "util/rsdebug.h"
struct RsLog::logInfo p3netmgrzoneInfo = {RsLog::Default, "p3netmgr"};
#define p3netmgrzone &p3netmgrzoneInfo
@ -165,11 +166,6 @@ void p3NetMgrIMPL::setManagers(p3PeerMgr *peerMgr, p3LinkMgr *linkMgr)
mLinkMgr = linkMgr;
}
//void p3NetMgrIMPL::setDhtMgr(p3DhtMgr *dhtMgr)
//{
// mDhtMgr = dhtMgr;
//}
#ifdef RS_USE_DHT_STUNNER
void p3NetMgrIMPL::setAddrAssist(pqiAddrAssist *dhtStun, pqiAddrAssist *proxyStun)
{
@ -718,7 +714,7 @@ void p3NetMgrIMPL::netExtCheck()
#endif
if(sockaddr_storage_isValidNet(tmpip))
{
if(rsBanList->isAddressAccepted(tmpip,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
if( (rsBanList==NULL) || rsBanList->isAddressAccepted(tmpip,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
{
// must be stable???
isStable = true;
@ -761,7 +757,7 @@ void p3NetMgrIMPL::netExtCheck()
/* input network bits */
if (mDhtStunner->getExternalAddr(tmpaddr, isstable))
{
if(rsBanList->isAddressAccepted(tmpaddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
if((rsBanList == NULL) || rsBanList->isAddressAccepted(tmpaddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
{
// must be stable???
isStable = (isstable == 1);
@ -1020,19 +1016,41 @@ bool p3NetMgrIMPL::checkNetAddress()
}
else
{
// TODO: Sat Oct 24 15:51:24 CEST 2015 The fact of having just one local address is a flawed assumption, this should be redesigned soon.
std::list<sockaddr_storage> addrs;
std::list<sockaddr_storage>::iterator it;
/* TODO: Sat Oct 24 15:51:24 CEST 2015 The fact of having just one local
* address is a flawed assumption, this should be redesigned as soon as
* possible. It will require complete reenginering of the network layer
* code. */
std::vector<sockaddr_storage> addrs;
if (getLocalAddresses(addrs))
for(it = addrs.begin(); (it != addrs.end() && !validAddr); ++it)
if(sockaddr_storage_isValidNet(*it) && !sockaddr_storage_isLoopbackNet(*it))
{
for (auto it = addrs.begin(); it!=addrs.end(); ++it)
{
sockaddr_storage& addr(*it);
if( sockaddr_storage_isValidNet(addr) &&
!sockaddr_storage_isLoopbackNet(addr) &&
!sockaddr_storage_isLinkLocalNet(addr))
{
prefAddr = *it;
prefAddr = addr;
validAddr = true;
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
std::cout << "p3NetMgrIMPL::checkNetAddress() prefAddr: " << sockaddr_storage_iptostring(prefAddr) << std::endl;
#endif
break;
}
}
/* If no satisfactory local address has been found yet relax and
* accept also link local addresses */
if(!validAddr) for (auto it = addrs.begin(); it!=addrs.end(); ++it)
{
sockaddr_storage& addr(*it);
if( sockaddr_storage_isValidNet(addr) &&
!sockaddr_storage_isLoopbackNet(addr) )
{
prefAddr = addr;
validAddr = true;
break;
}
}
}
}

View File

@ -519,6 +519,25 @@ uint32_t p3PeerMgrIMPL::getHiddenType(const RsPeerId &ssl_id)
return (it->second).hiddenType;
}
bool p3PeerMgrIMPL::isHiddenNode(const RsPeerId& id)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
if (id == AuthSSL::getAuthSSL()->OwnId())
return mOwnState.hiddenNode ;
else
{
std::map<RsPeerId,peerState>::const_iterator it = mFriendList.find(id);
if (it == mFriendList.end())
{
std::cerr << "p3PeerMgrIMPL::isHiddenNode() Peer Not Found" << std::endl;
return false;
}
return it->second.hiddenNode ;
}
}
/**
* @brief sets hidden domain and port for a given ssl ID
* @param ssl_id peer to set domain and port for
@ -1218,7 +1237,7 @@ bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_storage &localAddr,
std::cerr << ")" << std::endl;
#endif
if(!rsBanList->isAddressAccepted(localAddr, RSBANLIST_CHECKING_FLAGS_BLACKLIST))
if((rsBanList != NULL) && !rsBanList->isAddressAccepted(localAddr, RSBANLIST_CHECKING_FLAGS_BLACKLIST))
{
std::cerr << "(SS) Trying to set own IP to a banned IP " << sockaddr_storage_iptostring(localAddr) << ". This probably means that a friend in under traffic re-routing attack." << std::endl;
return false ;
@ -1357,7 +1376,7 @@ bool p3PeerMgrIMPL::setExtAddress(const RsPeerId &id, const struct sockaddr_s
bool changed = false;
uint32_t check_res = 0 ;
if(!rsBanList->isAddressAccepted(addr,RSBANLIST_CHECKING_FLAGS_BLACKLIST,&check_res))
if(rsBanList!=NULL && !rsBanList->isAddressAccepted(addr,RSBANLIST_CHECKING_FLAGS_BLACKLIST,&check_res))
{
std::cerr << "(SS) trying to set external contact address for peer " << id << " to a banned address " << sockaddr_storage_iptostring(addr )<< std::endl;
return false ;
@ -1531,7 +1550,7 @@ bool p3PeerMgrIMPL::addCandidateForOwnExternalAddress(const RsPeerId &from, cons
// Notify for every friend that has reported a wrong external address, except if that address is in the IP whitelist.
if((!rsBanList->isAddressAccepted(addr_filtered,RSBANLIST_CHECKING_FLAGS_WHITELIST)) && (!sockaddr_storage_sameip(own_addr,addr_filtered)))
if((rsBanList!=NULL && !rsBanList->isAddressAccepted(addr_filtered,RSBANLIST_CHECKING_FLAGS_WHITELIST)) && (!sockaddr_storage_sameip(own_addr,addr_filtered)))
{
std::cerr << " Peer " << from << " reports a connection address (" << sockaddr_storage_iptostring(addr_filtered) <<") that is not your current external address (" << sockaddr_storage_iptostring(own_addr) << "). This is weird." << std::endl;
@ -1632,6 +1651,8 @@ bool p3PeerMgrIMPL::updateAddressList(const RsPeerId& id, const pqiIpAddrSet
cleanIpList(clean_set.mExt.mAddrs,id,mLinkMgr) ;
cleanIpList(clean_set.mLocal.mAddrs,id,mLinkMgr) ;
bool am_I_a_hidden_node = isHiddenNode(getOwnId()) ;
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
/* check if it is our own ip */
@ -1655,7 +1676,12 @@ bool p3PeerMgrIMPL::updateAddressList(const RsPeerId& id, const pqiIpAddrSet
}
/* "it" points to peer */
it->second.ipAddrs.updateAddrs(clean_set);
if(!am_I_a_hidden_node)
it->second.ipAddrs.updateAddrs(clean_set);
else
it->second.ipAddrs.clear();
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setLocalAddress() Updated Address for: " << id;
std::cerr << std::endl;
@ -2173,6 +2199,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
#endif
RsPeerId ownId = getOwnId();
bool am_I_a_hidden_node = isHiddenNode(ownId) ;
/* load the list of peers */
std::list<RsItem *>::iterator it;
@ -2220,16 +2247,20 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
}
else
{
setLocalAddress(peer_id, pitem->localAddrV4.addr);
setExtAddress(peer_id, pitem->extAddrV4.addr);
setDynDNS (peer_id, pitem->dyndns);
/* convert addresses */
pqiIpAddrSet addrs;
addrs.mLocal.extractFromTlv(pitem->localAddrList);
addrs.mExt.extractFromTlv(pitem->extAddrList);
updateAddressList(peer_id, addrs);
if(!am_I_a_hidden_node) // clear IPs if w're a hidden node. Friend's clear node IPs where previously sent.
{
setLocalAddress(peer_id, pitem->localAddrV4.addr);
setExtAddress(peer_id, pitem->extAddrV4.addr);
setDynDNS (peer_id, pitem->dyndns);
/* convert addresses */
addrs.mLocal.extractFromTlv(pitem->localAddrList);
addrs.mExt.extractFromTlv(pitem->extAddrList);
}
updateAddressList(peer_id, addrs);
}
delete(*it);
@ -2774,7 +2805,7 @@ bool p3PeerMgrIMPL::removeBannedIps()
if(cleanIpList(it->second.ipAddrs.mExt.mAddrs,it->first,mLinkMgr)) changed = true ;
if(cleanIpList(it->second.ipAddrs.mLocal.mAddrs,it->first,mLinkMgr)) changed = true ;
if(!rsBanList->isAddressAccepted(it->second.serveraddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
if(rsBanList!=NULL && !rsBanList->isAddressAccepted(it->second.serveraddr,RSBANLIST_CHECKING_FLAGS_BLACKLIST))
{
sockaddr_storage_clear(it->second.serveraddr) ;
std::cerr << "(SS) Peer " << it->first << " has a banned server address. Wiping it out." << std::endl;

View File

@ -171,6 +171,7 @@ virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht)
virtual bool setLocation(const RsPeerId &pid, const std::string &location) = 0;
virtual bool setHiddenDomainPort(const RsPeerId &id, const std::string &domain_addr, const uint16_t domain_port) = 0;
virtual bool isHiddenNode(const RsPeerId& id) = 0 ;
virtual bool updateCurrentAddress(const RsPeerId& id, const pqiIpAddress &addr) = 0;
virtual bool updateLastContact(const RsPeerId& id) = 0;
@ -284,6 +285,7 @@ public:
virtual bool setLocation(const RsPeerId &pid, const std::string &location);
virtual bool setHiddenDomainPort(const RsPeerId &id, const std::string &domain_addr, const uint16_t domain_port);
virtual bool isHiddenNode(const RsPeerId& id);
virtual bool updateCurrentAddress(const RsPeerId& id, const pqiIpAddress &addr);
virtual bool updateLastContact(const RsPeerId& id);

View File

@ -29,7 +29,7 @@
#include "util/rsnet.h"
#include "serialiser/rstlvaddrs.h"
#define MAX_ADDRESS_LIST_SIZE 4
#define MAX_ADDRESS_LIST_SIZE 10
class pqiIpAddress
{
@ -68,6 +68,12 @@ class pqiIpAddrSet
void printAddrs(std::string &out) const;
pqiIpAddrList mLocal;
pqiIpAddrList mExt;
void clear()
{
mLocal.mAddrs.clear();
mExt.mAddrs.clear();
}
};

View File

@ -4,7 +4,9 @@
#include "pqi/pqinetstatebox.h"
#include "time.h"
#ifdef RS_USE_BITDHT
#include "bitdht/bdiface.h"
#endif
// External Interface.

View File

@ -3,7 +3,8 @@
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
* Copyright (C) 2004-2006 Robert Fernie.
* Copyright (C) 2015-2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -284,7 +285,7 @@ int inet_aton(const char *name, struct in_addr *addr)
# include <net/if.h>
#endif // WINDOWS_SYS
bool getLocalAddresses(std::list<sockaddr_storage> & addrs)
bool getLocalAddresses(std::vector<sockaddr_storage>& addrs)
{
addrs.clear();

View File

@ -3,7 +3,8 @@
*
* 3P/PQI network interface for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
* Copyright (C) 2004-2006 Robert Fernie.
* Copyright (C) 2015-2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -24,10 +25,10 @@
*/
#ifndef MRK_PQI_NETWORKING_HEADER
#define MRK_PQI_NETWORKING_HEADER
#include <vector>
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
#ifndef WINDOWS_SYS
@ -95,7 +96,7 @@ void showSocketError(std::string &out);
std::string socket_errorType(int err);
bool getLocalAddresses(std::list<struct sockaddr_storage> & addrs);
bool getLocalAddresses(std::vector<sockaddr_storage> & addrs);
/* universal socket interface */

View File

@ -1321,14 +1321,14 @@ int pqissl::Authorise_SSL_Connection()
if (rsPeers->servicePermissionFlags(PeerId()) & RS_NODE_PERM_REQUIRE_WL)
checking_flags |= RSBANLIST_CHECKING_FLAGS_WHITELIST;
if(!rsBanList->isAddressAccepted(remote_addr,checking_flags,&check_result))
if(rsBanList!=NULL && !rsBanList->isAddressAccepted(remote_addr,checking_flags,&check_result))
{
std::cerr << "(SS) refusing connection attempt from IP address " << sockaddr_storage_iptostring(remote_addr) << ". Reason: " <<
std::cerr << "(SS) refusing connection attempt from IP address " << sockaddr_storage_iptostring(remote_addr) << ". Reason: " <<
((check_result == RSBANLIST_CHECK_RESULT_NOT_WHITELISTED)?"not whitelisted (peer requires whitelist)":"blacklisted") << std::endl;
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_BLACKLISTED, PeerId().toStdString(), sockaddr_storage_iptostring(remote_addr), "", "", check_result);
reset_locked();
return 0 ;
reset_locked();
return 0 ;
}
// check it's the right one.
if (certCorrect)
@ -1371,12 +1371,12 @@ int pqissl::accept_locked(SSL *ssl, int fd, const struct sockaddr_storage &forei
if (rsPeers->servicePermissionFlags(PeerId()) & RS_NODE_PERM_REQUIRE_WL)
checking_flags |= RSBANLIST_CHECKING_FLAGS_WHITELIST;
if(!rsBanList->isAddressAccepted(foreign_addr,checking_flags,&check_result))
if(rsBanList!=NULL && !rsBanList->isAddressAccepted(foreign_addr,checking_flags,&check_result))
{
std::cerr << "(SS) refusing incoming SSL connection from blacklisted foreign address " << sockaddr_storage_iptostring(foreign_addr)
<< ". Reason: " << check_result << "." << std::endl;
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_IP_BLACKLISTED, PeerId().toStdString(), sockaddr_storage_iptostring(foreign_addr), "", "", check_result);
reset_locked();
reset_locked();
return -1;
}
if (waiting != WAITING_NOT)

View File

@ -36,6 +36,9 @@ static struct RsLog::logInfo pqipersongrpzoneInfo = {RsLog::Default, "pqipersong
/****
* #define PQI_DISABLE_UDP 1
***/
#ifdef RETROTOR
#define PQI_DISABLE_UDP 1
#endif
/********************************** SSL Specific features ***************************/

View File

@ -35,6 +35,7 @@
#include "util/rsdebug.h"
#include "util/rsnet.h"
#include "util/rstime.h"
#include "util/rsstring.h"
#include "pqi/p3linkmgr.h"
@ -571,7 +572,7 @@ bool pqissludp::moretoread(uint32_t usec)
{
return true;
}
usleep(usec);
rstime::rs_usleep(usec);
}
/* check for more to read first ... if nothing... check error
@ -655,7 +656,7 @@ bool pqissludp::cansend(uint32_t usec)
return true;
}
usleep(usec);
rstime::rs_usleep(usec);
}
rslog(RSL_DEBUG_ALL, pqissludpzone,

View File

@ -24,6 +24,7 @@
*/
#include "util/rstime.h"
#include "pqi/pqithreadstreamer.h"
#include <unistd.h>
@ -69,7 +70,7 @@ void pqithreadstreamer::data_tick()
if (!isactive)
{
usleep(DEFAULT_STREAMER_IDLE_SLEEP);
rstime::rs_usleep(DEFAULT_STREAMER_IDLE_SLEEP);
return ;
}
@ -92,7 +93,7 @@ void pqithreadstreamer::data_tick()
if (sleep_period)
{
usleep(sleep_period);
rstime::rs_usleep(sleep_period);
}
}

View File

@ -368,6 +368,7 @@ public:
virtual bool setHiddenNode(const RsPeerId &id, const std::string &hidden_node_address) = 0;
virtual bool setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port) = 0;
virtual bool isHiddenNode(const RsPeerId &id) = 0;
virtual bool setLocalAddress(const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;
virtual bool setExtAddress( const RsPeerId &ssl_id, const std::string &addr, uint16_t port) = 0;

View File

@ -52,13 +52,20 @@ struct TurtleFileInfo
std::string name ;
uint64_t size ;
};
struct TurtleRequestDisplayInfo
struct TurtleTunnelRequestDisplayInfo
{
uint32_t request_id ; // Id of the request
RsPeerId source_peer_id ; // Peer that relayed the request
uint32_t age ; // Age in seconds
uint32_t depth ; // Depth of the request. Might be altered.
uint32_t request_id ; // Id of the request
RsPeerId source_peer_id ; // Peer that relayed the request
uint32_t age ; // Age in seconds
uint32_t depth ; // Depth of the request. Might be altered.
};
struct TurtleSearchRequestDisplayInfo
{
uint32_t request_id ; // Id of the request
RsPeerId source_peer_id ; // Peer that relayed the request
uint32_t age ; // Age in seconds
uint32_t depth ; // Depth of the request. Might be altered.
uint32_t hits ;
std::string keywords;
};
@ -135,7 +142,7 @@ class RsTurtle
// Get info from the turtle router. I use std strings to hide the internal structs.
//
virtual void getInfo(std::vector<std::vector<std::string> >&,std::vector<std::vector<std::string> >&,
std::vector<TurtleRequestDisplayInfo>&,std::vector<TurtleRequestDisplayInfo>&) const = 0;
std::vector<TurtleSearchRequestDisplayInfo>&,std::vector<TurtleTunnelRequestDisplayInfo>&) const = 0;
// Get info about turtle traffic. See TurtleTrafficStatisticsInfo members for details.
//

View File

@ -208,7 +208,7 @@ class FileInfo
uint64_t transfered;
double tfRate; /* in kbytes */
uint32_t downloadStatus; // FT_STATE_DOWNLOADING & co. See rstypes.h
std::list<TransferInfo> peers;
std::vector<TransferInfo> peers;
DwlSpeed priority ;
time_t lastTS;

View File

@ -1,6 +1,6 @@
#define RS_MAJOR_VERSION 0
#define RS_MINOR_VERSION 6
#define RS_BUILD_NUMBER 3
#define RS_BUILD_NUMBER 4
#define RS_BUILD_NUMBER_ADD "" // <-- do we need this?
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:
// git log --pretty="%H" | head -1 | cut -c1-8

View File

@ -1,6 +1,6 @@
#define RS_MAJOR_VERSION 0
#define RS_MINOR_VERSION 6
#define RS_BUILD_NUMBER 3
#define RS_BUILD_NUMBER 4
#define RS_BUILD_NUMBER_ADD ""
// The revision number should be the 4 first bytes of the git revision hash, which is obtained using:

View File

@ -84,6 +84,9 @@ const uint16_t RS_SERVICE_GXS_TYPE_REPUTATION = 0x0219;
const uint16_t RS_SERVICE_TYPE_GXS_RECOGN = 0x0220;
const uint16_t RS_SERVICE_TYPE_GXS_TRANS = 0x0230;
const uint16_t RS_SERVICE_GXS_TYPE_FORUMS_CONFIG = 0x0315;
const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS_CONFIG = 0x0317;
// Experimental Services.
/* DSDV Testing at the moment - Service Only */
const uint16_t RS_SERVICE_TYPE_DSDV = 0x1010;

View File

@ -25,6 +25,7 @@
*/
#include "util/rstime.h"
#include "rsserver/p3face.h"
#include "retroshare/rsplugin.h"
@ -134,11 +135,7 @@ RsServer::~RsServer()
/* Thread Fn: Run the Core */
void RsServer::data_tick()
{
#ifndef WINDOWS_SYS
usleep((int) (mTimeDelta * 1000000));
#else
Sleep((int) (mTimeDelta * 1000));
#endif
rstime::rs_usleep(mTimeDelta * 1000000);
double ts = getCurrentTS();
double delta = ts - mLastts;

View File

@ -882,6 +882,11 @@ bool p3Peers::setHiddenNode(const RsPeerId &id, const std::string &hidden_node_
}
bool p3Peers::isHiddenNode(const RsPeerId &id)
{
return mPeerMgr->isHiddenNode(id) ;
}
bool p3Peers::setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port)
{
#ifdef P3PEERS_DEBUG

View File

@ -94,6 +94,7 @@ public:
virtual bool setLocation(const RsPeerId &ssl_id, const std::string &location);//location is shown in the gui to differentiate ssl certs
virtual bool setHiddenNode(const RsPeerId &id, const std::string &hidden_node_address);
virtual bool setHiddenNode(const RsPeerId &id, const std::string &address, uint16_t port);
virtual bool isHiddenNode(const RsPeerId &id);
virtual bool setLocalAddress(const RsPeerId &id, const std::string &addr, uint16_t port);
virtual bool setExtAddress(const RsPeerId &id, const std::string &addr, uint16_t port);

View File

@ -71,8 +71,11 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
bool RsAccountsDetail::loadAccounts()
{
int failing_accounts ;
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys);
#ifdef RETROTOR
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true);
#else
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false);
#endif
loadPreferredAccount();
checkPreferredId();
@ -512,7 +515,7 @@ bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun)
/* directories with valid certificates in the expected location */
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys,bool hidden_only)
{
failing_accounts = 0 ;
/* get the directories */
@ -615,6 +618,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
continue;
}
if(hidden_only && !hidden_location)
continue ;
if(valid_prefix && isHexaString(lochex) && (lochex).length() == 32)
{
std::string accountdir = mBaseDirectory + "/" + *it;

View File

@ -142,9 +142,9 @@ class RsAccountsDetail
static bool defaultBaseDirectory();
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
int& failing_accounts,
std::map<std::string,std::vector<std::string> >& unsupported_keys);
std::map<std::string,std::vector<std::string> >& unsupported_keys, bool hidden_only=false);
bool setupAccount(const std::string& accountdir);

View File

@ -35,6 +35,11 @@
#include "util/rswin.h"
#endif
#ifdef __ANDROID__
# include <QFile> // To install bdboot.txt
# include <QString> // for String::fromStdString(...)
#endif
#include "util/argstream.h"
#include "util/rsdebug.h"
#include "util/rsdir.h"
@ -65,6 +70,11 @@
#include <sys/param.h>
#endif
// This needs to be defined here, because when USE_BITDHT is unset, the variable, that is defined in libbitdht (not compiled!) will be missing.
#ifndef RS_USE_BITDHT
RsDht *rsDht = NULL ;
#endif
// for blocking signals
#include <signal.h>
@ -825,9 +835,10 @@ RsGRouter *rsGRouter = NULL ;
#include "pqi/p3linkmgr.h"
#include "pqi/p3netmgr.h"
#ifndef RETROTOR
#include "tcponudp/tou.h"
#include "tcponudp/rsudpstack.h"
#endif
#ifdef RS_USE_BITDHT
@ -1042,7 +1053,32 @@ int RsServer::StartupRetroShare()
uint64_t tmp_size ;
if (!RsDirUtil::checkFile(bootstrapfile,tmp_size,true))
{
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile << std::endl;
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile
<< std::endl;
#ifdef __ANDROID__
QFile bdbootRF("assets:/values/bdboot.txt");
if(!bdbootRF.open(QIODevice::ReadOnly | QIODevice::Text))
std::cerr << __PRETTY_FUNCTION__
<< " bdbootRF(assets:/values/bdboot.txt).open(...) fail: "
<< bdbootRF.errorString().toStdString() << std::endl;
else
{
QFile bdbootCF(QString::fromStdString(bootstrapfile));
if(!bdbootCF.open(QIODevice::WriteOnly | QIODevice::Text))
std::cerr << __PRETTY_FUNCTION__ << " bdbootCF("
<< bootstrapfile << ").open(...) fail: "
<< bdbootRF.errorString().toStdString() << std::endl;
else
{
bdbootCF.write(bdbootRF.readAll());
bdbootCF.close();
std::cerr << "Installed DHT bootstrap file not in ConfigDir: "
<< bootstrapfile << std::endl;
}
bdbootRF.close();
}
#else
std::string installfile = rsAccounts->PathDataDirectory();
installfile += "/";
installfile += BITDHT_BOOTSTRAP_FILENAME;
@ -1064,6 +1100,7 @@ int RsServer::StartupRetroShare()
{
std::cerr << "No Installation DHT bootstrap file to copy" << std::endl;
}
#endif // def __ANDROID__
}
/* construct the rest of the stack, important to build them in the correct order! */
@ -1155,9 +1192,9 @@ int RsServer::StartupRetroShare()
#ifdef RS_USE_DHT_STUNNER
mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner));
#endif // RS_USE_DHT_STUNNER
#else //RS_USE_BITDHT
/* install NULL Pointer for rsDht Interface */
rsDht = NULL;
// #else //RS_USE_BITDHT
// /* install NULL Pointer for rsDht Interface */
// rsDht = NULL;
#endif //RS_USE_BITDHT
@ -1474,7 +1511,11 @@ int RsServer::StartupRetroShare()
interfaces.mMsgs = rsMsgs;
interfaces.mTurtle = rsTurtle;
interfaces.mDisc = rsDisc;
#ifdef RS_USE_BITDHT
interfaces.mDht = rsDht;
#else
interfaces.mDht = NULL;
#endif
interfaces.mNotify = mNotify;
interfaces.mServiceControl = serviceCtrl;
interfaces.mPluginHandler = mPluginsManager;
@ -1508,10 +1549,17 @@ int RsServer::StartupRetroShare()
#endif
// new services to test.
#ifndef RETROTOR
p3BanList *mBanList = new p3BanList(serviceCtrl, mNetMgr);
rsBanList = mBanList ;
pqih -> addService(mBanList, true);
#else
rsBanList = NULL ;
#endif
#ifdef RS_USE_BITDHT
mBitDht->setupPeerSharer(mBanList);
#endif
p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih);
pqih -> addService(mBwCtrl, true);
@ -1577,7 +1625,9 @@ int RsServer::StartupRetroShare()
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
mConfigMgr->addConfiguration("turtle.cfg", tr);
#ifndef RETROTOR
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
#endif
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
mConfigMgr->addConfiguration("reputations.cfg", mReputations);
#ifdef ENABLE_GROUTER
@ -1599,7 +1649,9 @@ int RsServer::StartupRetroShare()
mConfigMgr->addConfiguration("identity.cfg", gxsid_ns);
mConfigMgr->addConfiguration("gxsforums.cfg", gxsforums_ns);
mConfigMgr->addConfiguration("gxsforums_srv.cfg", mGxsForums);
mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns);
mConfigMgr->addConfiguration("gxschannels_srv.cfg", mGxsChannels);
mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns);
mConfigMgr->addConfiguration("posted.cfg", posted_ns);
#ifdef RS_USE_WIKI

View File

@ -8,6 +8,7 @@
#include "util/radix32.h"
#include "util/radix64.h"
#include "util/rsdebug.h"
#include "util/rstime.h"
#include "util/rsprint.h"
#include "util/rsrandom.h"
@ -39,7 +40,7 @@ static struct RsLog::logInfo i2pBobLogInfo = {RsLog::Default, "p3I2pBob"};
static const time_t selfCheckPeroid = 30;
void doSleep(useconds_t timeToSleepMS) {
usleep((useconds_t) (timeToSleepMS * 1000));
rstime::rs_usleep((useconds_t) (timeToSleepMS * 1000));
}
p3I2pBob::p3I2pBob(p3PeerMgr *peerMgr)

View File

@ -1,6 +1,7 @@
#include "rsautoproxymonitor.h"
#include <unistd.h> /* for usleep() */
#include "util/rstime.h"
rsAutoProxyMonitor *rsAutoProxyMonitor::mInstance = NULL;
@ -93,7 +94,7 @@ void rsAutoProxyMonitor::stopAllRSShutdown()
// wait for shutdown of all services
uint32_t t = 0, timeout = 15;
do {
usleep(1000 * 1000);
rstime::rs_usleep(1000 * 1000);
RS_STACK_MUTEX(mLock);
std::cout << "(II) waiting for auto proxy service(s) to shut down " << t << "/" << timeout << " (remaining: " << mProxies.size() << ")" << std::endl;
if (mProxies.empty())

View File

@ -3,7 +3,8 @@
*
* Services for RetroShare.
*
* Copyright 2004-2013 by Robert Fernie.
* Copyright (C) 2004-2013 Robert Fernie.
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -25,11 +26,15 @@
#include "services/p3discovery2.h"
#include "pqi/p3peermgr.h"
#include "pqi/pqinetwork.h" // for getLocalAddresses
#include "util/rsversioninfo.h"
#include "retroshare/rsiface.h"
#include "rsserver/p3face.h"
#include <vector> // for std::vector
#include <algorithm> // for std::random_shuffle
// Interface pointer.
RsDisc *rsDisc = NULL;
@ -38,7 +43,9 @@ RsDisc *rsDisc = NULL;
* #define P3DISC_DEBUG 1
****/
bool populateContactInfo(const peerState &detail, RsDiscContactItem *pkt)
static bool populateContactInfo( const peerState &detail,
RsDiscContactItem *pkt,
bool include_ip_information )
{
pkt->clear();
@ -62,14 +69,24 @@ bool populateContactInfo(const peerState &detail, RsDiscContactItem *pkt)
{
pkt->isHidden = false;
pkt->localAddrV4.addr = detail.localaddr;
pkt->extAddrV4.addr = detail.serveraddr;
sockaddr_storage_clear(pkt->localAddrV6.addr);
sockaddr_storage_clear(pkt->extAddrV6.addr);
if(include_ip_information)
{
pkt->localAddrV4.addr = detail.localaddr;
pkt->extAddrV4.addr = detail.serveraddr;
sockaddr_storage_clear(pkt->localAddrV6.addr);
sockaddr_storage_clear(pkt->extAddrV6.addr);
pkt->dyndns = detail.dyndns;
detail.ipAddrs.mLocal.loadTlv(pkt->localAddrList);
detail.ipAddrs.mExt.loadTlv(pkt->extAddrList);
pkt->dyndns = detail.dyndns;
detail.ipAddrs.mLocal.loadTlv(pkt->localAddrList);
detail.ipAddrs.mExt.loadTlv(pkt->extAddrList);
}
else
{
sockaddr_storage_clear(pkt->localAddrV6.addr);
sockaddr_storage_clear(pkt->extAddrV6.addr);
sockaddr_storage_clear(pkt->localAddrV4.addr);
sockaddr_storage_clear(pkt->extAddrV4.addr);
}
}
return true;
@ -331,12 +348,57 @@ void p3discovery2::sendOwnContactInfo(const SSLID &sslid)
std::cerr << std::endl;
#endif
peerState detail;
if (mPeerMgr->getOwnNetStatus(detail))
if (mPeerMgr->getOwnNetStatus(detail))
{
RsDiscContactItem *pkt = new RsDiscContactItem();
populateContactInfo(detail, pkt);
pkt->version = RsUtil::retroshareVersion();
/* Workaround to spread multiple local ip addresses when presents. This
* is needed because RS wrongly assumes that there is just one active
* local ip address at time. */
std::vector<sockaddr_storage> addrs;
if(!detail.hiddenNode && getLocalAddresses(addrs))
{
/* To work around MAX_ADDRESS_LIST_SIZE addresses limitation,
* let's shuffle the list of
* local addresses in the hope that with enough time every local
* address is advertised to trusted nodes so they may try to
* connect to all of them including the most convenient if a local
* connection exists.*/
std::random_shuffle(addrs.begin(), addrs.end());
for (auto it = addrs.begin(); it!=addrs.end(); ++it)
{
sockaddr_storage& addr(*it);
if( sockaddr_storage_isValidNet(addr) &&
!sockaddr_storage_isLoopbackNet(addr) &&
!sockaddr_storage_sameip(addr, detail.localaddr) )
{
pqiIpAddress pqiIp;
sockaddr_storage_clear(pqiIp.mAddr);
pqiIp.mAddr.ss_family = addr.ss_family;
sockaddr_storage_copyip(pqiIp.mAddr, addr);
sockaddr_storage_setport(
pqiIp.mAddr,
sockaddr_storage_port(detail.localaddr) );
pqiIp.mSeenTime = time(nullptr);
pqiIp.mSrc = 0;
detail.ipAddrs.updateLocalAddrs(pqiIp);
}
}
}
RsDiscContactItem *pkt = new RsDiscContactItem();
/* Cyril: we dont send our own IP to an hidden node. It will not use it
* anyway. */
populateContactInfo(detail, pkt, !rsPeers->isHiddenNode(sslid));
/* G10h4ck: sending IP information also to hidden nodes has proven very
* helpful in the usecase of non hidden nodes, that share a common
* hidden trusted node, to discover each other IP.
* Advanced/corner case non hidden node users that want to hide their
* IP to a specific hidden ~trusted~ node can do it through the
* permission matrix. Disabling this instead will make life more
* difficult for average user, that moreover whould have no way to
* revert an hardcoded policy. */
//populateContactInfo(detail, pkt, true);
pkt->version = RsUtil::retroshareVersion();
pkt->PeerId(sslid);
#ifdef P3DISC_DEBUG
@ -372,6 +434,7 @@ void p3discovery2::recvOwnContactInfo(const SSLID &fromId, const RsDiscContactIt
mPeerMgr->setVisState(fromId, item->vs_disc, item->vs_dht);
setPeerVersion(fromId, item->version);
updatePeerAddresses(item);
// This information will be sent out to online peers, at the receipt of their PGPList.
@ -423,13 +486,11 @@ void p3discovery2::recvOwnContactInfo(const SSLID &fromId, const RsDiscContactIt
void p3discovery2::updatePeerAddresses(const RsDiscContactItem *item)
{
if (item->isHidden)
{
mPeerMgr->setHiddenDomainPort(item->sslId, item->hiddenAddr, item->hiddenPort);
}
mPeerMgr->setHiddenDomainPort(item->sslId, item->hiddenAddr,
item->hiddenPort);
else
{
mPeerMgr->setDynDNS(item->sslId, item->dyndns);
mPeerMgr->setDynDNS(item->sslId, item->dyndns);
updatePeerAddressList(item);
}
}
@ -440,8 +501,19 @@ void p3discovery2::updatePeerAddressList(const RsDiscContactItem *item)
if (item->isHidden)
{
}
else
else if(!mPeerMgr->isHiddenNode(rsPeers->getOwnId()))
{
/* Cyril: we don't store IP addresses if we're a hidden node.
* Normally they should not be sent to us, except for old peers. */
/* G10h4ck: sending IP information also to hidden nodes has proven very
* helpful in the usecase of non hidden nodes, that share a common
* hidden trusted node, to discover each other IP.
* Advanced/corner case non hidden node users that want to hide their
* IP to a specific hidden ~trusted~ node can do it through the
* permission matrix. Disabling this instead will make life more
* difficult for average user, that moreover whould have no way to
* revert an hardcoded policy. */
pqiIpAddrSet addrsFromPeer;
addrsFromPeer.mLocal.extractFromTlv(item->localAddrList);
addrsFromPeer.mExt.extractFromTlv(item->extAddrList);
@ -464,13 +536,12 @@ void p3discovery2::updatePeerAddressList(const RsDiscContactItem *item)
void p3discovery2::sendPGPList(const SSLID &toId)
{
updatePgpFriendList();
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mDiscMtx);
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::sendPGPList() to " << toId;
std::cerr << std::endl;
std::cerr << "p3discovery2::sendPGPList() to " << toId << std::endl;
#endif
RsDiscPgpListItem *pkt = new RsDiscPgpListItem();
@ -501,7 +572,7 @@ void p3discovery2::updatePgpFriendList()
std::cerr << std::endl;
#endif
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mDiscMtx);
#define PGP_MAX_UPDATE_PERIOD 300
@ -817,7 +888,7 @@ void p3discovery2::sendContactInfo_locked(const PGPID &aboutId, const SSLID &toI
if (mPeerMgr->getFriendNetStatus(sit->first, detail))
{
RsDiscContactItem *pkt = new RsDiscContactItem();
populateContactInfo(detail, pkt);
populateContactInfo(detail, pkt,!mPeerMgr->isHiddenNode(toId));// never send IPs to an hidden node. The node will not use them anyway.
pkt->PeerId(toId);
// send to each peer its own connection address.
@ -856,26 +927,20 @@ void p3discovery2::sendContactInfo_locked(const PGPID &aboutId, const SSLID &toI
void p3discovery2::processContactInfo(const SSLID &fromId, const RsDiscContactItem *item)
{
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
(void) fromId; // remove unused parameter warnings, debug only
RS_STACK_MUTEX(mDiscMtx);
if (item->sslId == rsPeers->getOwnId())
{
if(sockaddr_storage_isExternalNet(item->currentConnectAddress.addr))
mPeerMgr->addCandidateForOwnExternalAddress(item->PeerId(), item->currentConnectAddress.addr) ;
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::processContactInfo(" << fromId << ") PGPID: ";
std::cerr << item->pgpId << " Ignoring Info on self";
std::cerr << std::endl;
#else
/* remove unused parameter warnings */
(void) fromId;
#endif
delete item;
{
if(sockaddr_storage_isExternalNet(item->currentConnectAddress.addr))
mPeerMgr->addCandidateForOwnExternalAddress(
item->PeerId(), item->currentConnectAddress.addr);
delete item;
return;
}
/* */
std::map<PGPID, DiscPgpInfo>::iterator it;
it = mFriendList.find(item->pgpId);
if (it == mFriendList.end())
@ -888,7 +953,8 @@ void p3discovery2::processContactInfo(const SSLID &fromId, const RsDiscContactIt
std::cerr << std::endl;
#endif
/* THESE ARE OUR FRIEND OF FRIENDS ... pass this information along to NetMgr & DHT...
/* THESE ARE OUR FRIEND OF FRIENDS ... pass this information along to
* NetMgr & DHT...
* as we can track FOF and use them as potential Proxies / Relays
*/
@ -934,7 +1000,10 @@ void p3discovery2::processContactInfo(const SSLID &fromId, const RsDiscContactIt
// set last seen to RS_PEER_OFFLINE_NO_DISC minus 1 so that it won't be shared with other friends
// until a first connection is established
mPeerMgr->addFriend(item->sslId, item->pgpId, item->netMode, RS_VS_DISC_OFF, RS_VS_DHT_FULL, time(NULL) - RS_PEER_OFFLINE_NO_DISC - 1, RS_NODE_PERM_ALL);
mPeerMgr->addFriend( item->sslId, item->pgpId, item->netMode,
RS_VS_DISC_OFF, RS_VS_DHT_FULL,
time(NULL) - RS_PEER_OFFLINE_NO_DISC - 1,
RS_NODE_PERM_ALL );
updatePeerAddresses(item);
}
}

Some files were not shown because too many files have changed in this diff Show More