mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
merged upstream/master
This commit is contained in:
commit
21a92d69b4
@ -19,8 +19,8 @@ before_install:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 libxapian-dev qttools5-dev; fi
|
||||
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd sqlcipher xapian; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt55 ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt openssl miniupnpc libmicrohttpd sqlcipher xapian; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt ; fi
|
||||
|
||||
- wget https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
|
||||
- tar -xf v1.1.0.tar.gz
|
||||
|
@ -252,3 +252,4 @@ your work-station running
|
||||
- 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[]
|
||||
- link:https://github.com/android-ndk/ndk/issues/773[How to build without using standalone toolchain?]
|
||||
|
@ -23,7 +23,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS += openpgpsdk
|
||||
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
|
||||
|
||||
rs_jsonapi {
|
||||
rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) {
|
||||
SUBDIRS += jsonapi-generator
|
||||
jsonapi-generator.file = jsonapi-generator/src/jsonapi-generator.pro
|
||||
libretroshare.depends += jsonapi-generator
|
||||
@ -36,22 +36,34 @@ libretroshare.depends = openpgpsdk libbitdht
|
||||
SUBDIRS += libretroshare
|
||||
libretroshare.file = libretroshare/src/libretroshare.pro
|
||||
|
||||
SUBDIRS += libresapi
|
||||
libresapi.file = libresapi/src/libresapi.pro
|
||||
libresapi.depends = libretroshare
|
||||
libresapi {
|
||||
SUBDIRS += libresapi
|
||||
libresapi.file = libresapi/src/libresapi.pro
|
||||
libresapi.depends = libretroshare
|
||||
}
|
||||
|
||||
retroshare_gui {
|
||||
SUBDIRS += retroshare_gui
|
||||
retroshare_gui.file = retroshare-gui/src/retroshare-gui.pro
|
||||
retroshare_gui.depends = libretroshare libresapi
|
||||
retroshare_gui.target = retroshare_gui
|
||||
|
||||
libresapi {
|
||||
retroshare_gui.depends = libresapi
|
||||
} else {
|
||||
retroshare_gui.depends = libretroshare
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_nogui {
|
||||
SUBDIRS += retroshare_nogui
|
||||
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
|
||||
retroshare_nogui.depends = libretroshare libresapi
|
||||
retroshare_nogui.target = retroshare_nogui
|
||||
|
||||
libresapi {
|
||||
retroshare_nogui.depends = libresapi
|
||||
} else {
|
||||
retroshare_nogui.depends = libretroshare
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_android_service {
|
||||
@ -79,6 +91,13 @@ retroshare_qml_app {
|
||||
}
|
||||
}
|
||||
|
||||
retroshare_service {
|
||||
SUBDIRS += retroshare_service
|
||||
retroshare_service.file = retroshare-service/src/retroshare-service.pro
|
||||
retroshare_service.depends = libretroshare
|
||||
retroshare_service.target = retroshare_service
|
||||
}
|
||||
|
||||
retroshare_plugins {
|
||||
SUBDIRS += plugins
|
||||
plugins.file = plugins/plugins.pro
|
||||
|
378
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
378
build_scripts/Android/prepare-toolchain-clang.sh
Executable file
@ -0,0 +1,378 @@
|
||||
#!/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
|
||||
define_default_value ANDROID_NDK_PATH "/opt/android-ndk/"
|
||||
define_default_value ANDROID_NDK_ARCH "arm"
|
||||
define_default_value ANDROID_PLATFORM_VER "16"
|
||||
define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}/"
|
||||
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.1.1"
|
||||
define_default_value OPENSSL_SOURCE_SHA256 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d
|
||||
|
||||
define_default_value SQLITE_SOURCE_YEAR "2018"
|
||||
define_default_value SQLITE_SOURCE_VERSION "3250200"
|
||||
define_default_value SQLITE_SOURCE_SHA256 da9a1484423d524d3ac793af518cdf870c8255d209e369bd6a193e9f9d0e3181
|
||||
|
||||
define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2"
|
||||
define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb
|
||||
|
||||
define_default_value LIBUPNP_SOURCE_VERSION "1.6.25"
|
||||
define_default_value LIBUPNP_SOURCE_SHA256 c5a300b86775435c076d58a79cc0d5a977d76027d2a7d721590729b7f369fa43
|
||||
|
||||
define_default_value INSTALL_QT_ANDROID "false"
|
||||
define_default_value QT_VERSION "5.12.0"
|
||||
define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763
|
||||
|
||||
define_default_value RESTBED_SOURCE_VERSION "4.6"
|
||||
|
||||
define_default_value XAPIAN_SOURCE_VERSION "1.4.7"
|
||||
define_default_value XAPIAN_SOURCE_SHA256 13f08a0b649c7afa804fa0e85678d693fd6069dd394c9b9e7d41973d74a3b5d3
|
||||
|
||||
define_default_value RAPIDJSON_SOURCE_VERSION "1.1.0"
|
||||
define_default_value RAPIDJSON_SOURCE_SHA256 bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e
|
||||
|
||||
|
||||
## $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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then
|
||||
cArch="i686"
|
||||
eABI=""
|
||||
else
|
||||
cArch="${ANDROID_NDK_ARCH}"
|
||||
eABI="eabi"
|
||||
fi
|
||||
export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot/"
|
||||
export PREFIX="${SYSROOT}/usr/"
|
||||
export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang"
|
||||
export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-clang++"
|
||||
export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
|
||||
export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
|
||||
|
||||
|
||||
## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||
build_toolchain()
|
||||
{
|
||||
rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH}
|
||||
${ANDROID_NDK_PATH}/build/tools/make_standalone_toolchain.py --verbose \
|
||||
--arch ${ANDROID_NDK_ARCH} --install-dir ${NATIVE_LIBS_TOOLCHAIN_PATH} \
|
||||
--api ${ANDROID_PLATFORM_VER}
|
||||
find "${PREFIX}/include/" -not -type d > "${NATIVE_LIBS_TOOLCHAIN_PATH}/deletefiles"
|
||||
}
|
||||
|
||||
## This avoid <cmath> include errors due to -isystem and -I ordering issue
|
||||
delete_copied_includes()
|
||||
{
|
||||
cat "${NATIVE_LIBS_TOOLCHAIN_PATH}/deletefiles" | while read delFile ; do
|
||||
rm "$delFile"
|
||||
done
|
||||
}
|
||||
|
||||
## 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-${BZIP2_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \
|
||||
http://trumpetti.atm.tut.fi/gentoo/distfiles/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
sed -i "/^CC=.*/d" Makefile
|
||||
sed -i "/^AR=.*/d" Makefile
|
||||
sed -i "/^RANLIB=.*/d" Makefile
|
||||
sed -i "/^LDFLAGS=.*/d" Makefile
|
||||
sed -i "s/^all: libbz2.a bzip2 bzip2recover test/all: libbz2.a bzip2 bzip2recover/" Makefile
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install PREFIX=${PREFIX}
|
||||
# sed -i "/^CC=.*/d" Makefile-libbz2_so
|
||||
# make -f Makefile-libbz2_so -j${HOST_NUM_CPU}
|
||||
# cp libbz2.so.1.0.6 ${SYSROOT}/usr/lib/libbz2.so
|
||||
cd ..
|
||||
}
|
||||
|
||||
## More information available at http://doc.qt.io/qt-5/opensslsupport.html
|
||||
build_openssl()
|
||||
{
|
||||
B_dir="openssl-${OPENSSL_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
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
|
||||
## We link openssl statically to avoid android silently sneaking in his own
|
||||
## version of libssl.so (we noticed this because it had some missing symbol
|
||||
## that made RS crash), the crash in some android version is only one of the
|
||||
## possible problems the fact that android insert his own binary libssl.so pose
|
||||
## non neglegible security concerns.
|
||||
oBits="32"
|
||||
[[ ${ANDROID_NDK_ARCH} =~ .*64.* ]] && oBits=64
|
||||
|
||||
ANDROID_NDK="${ANDROID_NDK_PATH}" PATH="${SYSROOT}/bin/:${PATH}" \
|
||||
./Configure linux-generic${oBits} --prefix="${PREFIX}" \
|
||||
--openssldir="${SYSROOT}/etc/ssl"
|
||||
# sed -i 's/LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \\/LIBNAME=$$i \\/g' Makefile
|
||||
# sed -i '/LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \\/d' Makefile
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
rm -f ${PREFIX}/lib/libssl.so*
|
||||
rm -f ${PREFIX}/lib/libcrypto.so*
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_sqlite()
|
||||
{
|
||||
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="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
rm -f ${PREFIX}/lib/libsqlite3.so*
|
||||
# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl
|
||||
# cp libsqlite3.so "${SYSROOT}/usr/lib"
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_sqlcipher()
|
||||
{
|
||||
B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
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="${PREFIX}" --with-sysroot="${SYSROOT}" \
|
||||
--enable-tempstore=yes \
|
||||
--disable-tcl --disable-shared \
|
||||
CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="${PREFIX}/lib/libcrypto.a"
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_libupnp()
|
||||
{
|
||||
B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
|
||||
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
|
||||
## look for libthreadutils.so.6 at runtime that cannot be packaged on android
|
||||
## as it supports only libname.so format for libraries, thus resulting in a
|
||||
## crash at startup.
|
||||
./configure --enable-static --disable-shared --disable-samples \
|
||||
--prefix="${PREFIX}" --host=${ANDROID_NDK_ARCH}-linux
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_rapidjson()
|
||||
{
|
||||
B_dir="rapidjson-${RAPIDJSON_SOURCE_VERSION}"
|
||||
D_file="${B_dir}.tar.gz"
|
||||
verified_download $D_file $RAPIDJSON_SOURCE_SHA256 \
|
||||
https://github.com/Tencent/rapidjson/archive/v${RAPIDJSON_SOURCE_VERSION}.tar.gz
|
||||
tar -xf $D_file
|
||||
cp -r "${B_dir}/include/rapidjson/" "${PREFIX}/include/rapidjson"
|
||||
}
|
||||
|
||||
build_restbed()
|
||||
{
|
||||
[ -d restbed ] || git clone --depth=2000 https://github.com/Corvusoft/restbed.git
|
||||
cd restbed
|
||||
git fetch --tags
|
||||
git checkout tags/${RESTBED_SOURCE_VERSION}
|
||||
git submodule update --init dependency/asio
|
||||
git submodule update --init dependency/catch
|
||||
git submodule update --init dependency/kashmir
|
||||
cd ..
|
||||
|
||||
rm -rf restbed-build; mkdir restbed-build ; cd restbed-build
|
||||
cmake -DBUILD_SSL=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX}" -B. -H../restbed
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
cp "${PREFIX}/library/librestbed.a" "${PREFIX}/lib/"
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_xapian()
|
||||
{
|
||||
B_dir="xapian-core-${XAPIAN_SOURCE_VERSION}"
|
||||
D_file="$B_dir.tar.xz"
|
||||
verified_download $D_file $XAPIAN_SOURCE_SHA256 \
|
||||
https://oligarchy.co.uk/xapian/${XAPIAN_SOURCE_VERSION}/$D_file
|
||||
rm -rf $B_dir
|
||||
tar -xf $D_file
|
||||
cd $B_dir
|
||||
B_endiannes_detection_failure_workaround="ac_cv_c_bigendian=no"
|
||||
B_large_file=""
|
||||
[ "${ANDROID_PLATFORM_VER}" -lt "24" ] && B_large_file="--disable-largefile"
|
||||
./configure ${B_endiannes_detection_failure_workaround} ${B_large_file} \
|
||||
--disable-backend-inmemory --disable-backend-remote \
|
||||
--disable--backend-chert --enable-backend-glass \
|
||||
--host=${ANDROID_NDK_ARCH}-linux --enable-static --disable-shared \
|
||||
--prefix="${PREFIX}" --with-sysroot="${SYSROOT}"
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
}
|
||||
|
||||
build_toolchain
|
||||
[ "${INSTALL_QT_ANDROID}X" != "trueX" ] || install_qt_android
|
||||
build_bzlib
|
||||
build_openssl
|
||||
build_sqlite
|
||||
build_sqlcipher
|
||||
build_libupnp
|
||||
build_rapidjson
|
||||
build_restbed
|
||||
build_xapian
|
||||
delete_copied_includes
|
||||
|
||||
echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}
|
@ -0,0 +1,30 @@
|
||||
app: retroshare-service
|
||||
|
||||
build:
|
||||
packages:
|
||||
- gcc7
|
||||
- gcc7-c++
|
||||
- libxapian-devel
|
||||
- doxygen
|
||||
- linuxdeployqt
|
||||
- desktop-file-utils
|
||||
- glib2-devel
|
||||
- sqlcipher-devel
|
||||
- libqt5-qtbase-devel
|
||||
- libqt5-qttools-devel
|
||||
- openssl-devel
|
||||
- update-desktop-files
|
||||
- libbz2-devel
|
||||
- libupnp-devel
|
||||
|
||||
script:
|
||||
- cd $BUILD_SOURCE_DIR
|
||||
- tar -xf RetroShare-git.tar.gz
|
||||
- cd RetroShare-git
|
||||
- ls $(which gcc)*
|
||||
- ls $(which g++)*
|
||||
- qmake-qt5 QMAKE_CC=gcc-7 QMAKE_CXX=g++-7 PREFIX=/usr CONFIG-=debug CONFIG+=release CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_qml_app CONFIG+=no_retroshare_android_notify_service CONFIG+=no_retroshare_plugins CONFIG+=ipv6 CONFIG+=no_retroshare_nogui CONFIG+=no_tests CONFIG+=rs_jsonapi CONFIG+=no_retroshare_android_service CONFIG+=rs_deep_search CONFIG+=no_libresapilocalserver CONFIG+=no_retroshare_gui CONFIG+=no_libresapihttpserver CONFIG+=retroshare_service CONFIG+=no_libresapi CONFIG+=c++11 CONFIG+=appimage
|
||||
- make -j$(nproc) || make -j$(nproc) || make
|
||||
- make INSTALL_ROOT=$BUILD_APPDIR install
|
||||
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
|
||||
- linuxdeployqt $BUILD_APPDIR/usr/share/applications/*.desktop -bundle-non-qt-libs -verbose=3 -no-strip
|
45
build_scripts/ArchLinuxAndDerivatives_OBS/PKGBUILD
Normal file
45
build_scripts/ArchLinuxAndDerivatives_OBS/PKGBUILD
Normal file
@ -0,0 +1,45 @@
|
||||
# Maintainer: Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
# Contributor: AsamK
|
||||
# Contributor: sehraf
|
||||
# Contributor: stqn
|
||||
# Contributor: JHeaton <jheaton at archlinux dot us>
|
||||
# Contributor: Tristero <tristero at online dot de>
|
||||
# Contributor: funkyou
|
||||
|
||||
pkgname=retroshare-service-git
|
||||
pkgver=git
|
||||
pkgrel=0
|
||||
pkgdesc="Serverless encrypted instant messenger with filesharing, chatgroups, e-mail. System service version."
|
||||
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
|
||||
url="https://retroshare.net/"
|
||||
license=('AGPL' 'GPL' 'LGPL')
|
||||
depends=('bzip2' 'libupnp' 'libzip' 'openssl' 'rapidjson' 'sqlcipher' 'xapian-core')
|
||||
makedepends=('cmake' 'doxygen' 'git' 'pkgconf' 'qt5-tools')
|
||||
provides=('retroshare-service')
|
||||
conflicts=('retroshare-service')
|
||||
|
||||
source=(RetroShare-${pkgver}.tar.gz)
|
||||
|
||||
md5sums=('3c66108223b427d617b962aff0755378')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
qmake-qt5 PREFIX=/usr DATA_DIR=/usr/share/retroshare CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=release
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/RetroShare-${pkgver}"
|
||||
make INSTALL_ROOT="${pkgdir}" install
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
retroshare-service-git (0.6.9999) stable; urgency=low
|
||||
|
||||
Add retroshare-service-git package
|
||||
|
||||
-- Gioacchino Mazzurco <gio@eigenlab.org> Tue, 08 Oct 2018 15:40:00 +0100
|
@ -0,0 +1 @@
|
||||
7
|
@ -0,0 +1,18 @@
|
||||
Source: retroshare-service-git
|
||||
Section: devel
|
||||
Priority: standard
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Standards-Version: 3.9.3
|
||||
Homepage: http://retroshare.net
|
||||
|
||||
Package: retroshare-service-git
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Secure communication with friends
|
||||
RetroShare is a Free and Open Source, private and secure decentralized
|
||||
communication 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.
|
||||
This package provide a headless RetroShare node that can be controlled only
|
||||
using the JSON API.
|
@ -0,0 +1,2 @@
|
||||
debian/tmp/usr/bin/retroshare-service
|
||||
debian/tmp/usr/share/retroshare/bdboot.txt
|
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
qmake --version
|
||||
qmake CONFIG-=debug CONFIG+=release PREFIX=/usr LIB_DIR=/usr/lib \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi CONFIG+=rs_deep_search \
|
||||
CONFIG+=c++11 RetroShare.pro
|
||||
touch $@
|
||||
|
||||
build: build-stamp
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
$(MAKE) -j$(shell nproc) || $(MAKE) -j$(shell nproc) || $(MAKE)
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f configure-stamp build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
[ ! -f Makefile ] || $(MAKE) distclean
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
#dh_installdirs
|
||||
$(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
|
@ -0,0 +1,11 @@
|
||||
Format: 1.0
|
||||
Source: retroshare-service-git
|
||||
Binary: retroshare-service-git
|
||||
Architecture: any
|
||||
Version: 0.6.9999
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Homepage: https://retroshare.net
|
||||
Standards-Version: 3.8.1
|
||||
Build-Depends: cmake, debhelper (>= 7), doxygen, git, libglib2.0-dev, libupnp-dev, qtbase5-dev, qt5-default, libssl-dev, libbz2-dev, libsqlcipher-dev, libxapian-dev
|
||||
Files:
|
||||
f562e399ef7d44ebc01362f365b4f30b 23617604 RetroShare-git.tar.gz
|
120
build_scripts/RpmBased_OBS/retroshare-service-git.spec
Normal file
120
build_scripts/RpmBased_OBS/retroshare-service-git.spec
Normal file
@ -0,0 +1,120 @@
|
||||
Name: retroshare-service-git
|
||||
Version: 0.6.9999
|
||||
Release: 0
|
||||
License: GNU AFFERO GENERAL PUBLIC LICENSE version 3
|
||||
Summary: Secure chat and file sharing
|
||||
Group: Productivity/Networking/Other
|
||||
Url: http://retroshare.net
|
||||
#Source0: https://github.com/RetroShare/RetroShare/archive/v%{version}.tar.gz#/RetroShare-%{version}.tar.gz
|
||||
Source0: RetroShare-git.tar.gz
|
||||
#Patch0: various.patch
|
||||
BuildRoot: %{_tmppath}/%{name}
|
||||
Conflicts: retroshare-service
|
||||
Requires: libupnp openssl sqlcipher
|
||||
BuildRequires: cmake doxygen git libupnp-devel openssl-devel sqlcipher-devel
|
||||
|
||||
%if %{defined centos_version}
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: fdupes xapian-core-devel
|
||||
BuildRequires: qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static
|
||||
Requires: qt5-qtbase xapian-core
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libzlib-devel libbzip2-devel
|
||||
BuildRequires: libqt5core-devel libqt5xml-devel libxapian-devel
|
||||
Requires: libqt5core libqt5xml5 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BuildRequires: gcc7 gcc7-c++
|
||||
BuildRequires: fdupes libbz2-devel
|
||||
BuildRequires: libqt5-qtbase-devel libqt5-qttools-devel
|
||||
BuildRequires: libxapian-devel update-desktop-files
|
||||
Requires: libbz2 libxapian
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora_version} >= 27
|
||||
%undefine _debugsource_packages
|
||||
%undefine _debuginfo_subpackages
|
||||
%endif
|
||||
|
||||
%description
|
||||
RetroShare is a cross-platform F2F communication platform.
|
||||
It lets you share securely with your friends, using PGP
|
||||
to authenticate peers and OpenSSL to encrypt all communication.
|
||||
RetroShare provides filesharing, chat, messages and channels.
|
||||
This package provides RetroShare system service that can be
|
||||
controlled only via JSON API.
|
||||
|
||||
Authors:
|
||||
see http://retroshare.net/
|
||||
--------
|
||||
|
||||
%prep
|
||||
%setup -n RetroShare-git
|
||||
#%patch0 -p0
|
||||
|
||||
%build
|
||||
|
||||
nproc
|
||||
qmake --version || qmake-qt5 --version
|
||||
ls $(which gcc)*
|
||||
ls $(which g++)*
|
||||
|
||||
BUILD_CC=""
|
||||
BUILD_CXX=""
|
||||
BUILD_DEEPSEARCH="CONFIG+=rs_deep_search"
|
||||
QMAKE="qmake-qt5"
|
||||
|
||||
%if %{defined centos_version}
|
||||
# Xapian is not availabe on Centos 7
|
||||
BUILD_DEEPSEARCH="CONFIG+=no_rs_deep_search"
|
||||
%endif
|
||||
|
||||
%if %{defined mageia}
|
||||
QMAKE="qmake"
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
BUILD_CC="QMAKE_CC=gcc-7"
|
||||
BUILD_CXX="QMAKE_CXX=g++-7"
|
||||
%endif
|
||||
|
||||
$QMAKE $BUILD_CC $BUILD_CXX QMAKE_STRIP=echo PREFIX="%{_prefix}" \
|
||||
BIN_DIR="%{_bindir}" \
|
||||
LIB_DIR="%{_libdir}" DATA_DIR="%{_datadir}/retroshare" CONFIG-=debug \
|
||||
CONFIG+=ipv6 CONFIG+=no_retroshare_android_service \
|
||||
CONFIG+=no_retroshare_android_notify_service \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=no_retroshare_nogui \
|
||||
CONFIG+=no_retroshare_gui CONFIG+=no_tests CONFIG+=no_libresapi \
|
||||
CONFIG+=no_libresapihttpserver CONFIG+=no_libresapilocalserver \
|
||||
CONFIG+=retroshare_service CONFIG+=rs_jsonapi ${BUILD_DEEPSEARCH} \
|
||||
CONFIG+=release RetroShare.pro
|
||||
make -j$(nproc) || make -j$(nproc) || make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make INSTALL_ROOT=$RPM_BUILD_ROOT install
|
||||
|
||||
%if 0%{?centos_version} < 800
|
||||
%else
|
||||
%fdupes %{buildroot}/%{_prefix}
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{_bindir}/retroshare-service
|
||||
%defattr(644, root, root)
|
||||
%{_datadir}/retroshare
|
||||
|
||||
%changelog
|
@ -9,7 +9,7 @@ call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release tor version autologin plugins
|
||||
call "%~dp0build\build.bat" 32 release tor autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
|
@ -9,7 +9,7 @@ call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" 32 release version autologin plugins
|
||||
call "%~dp0build\build.bat" 32 release autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
|
@ -49,10 +49,8 @@ echo.
|
||||
title Build - %SourceName%-%RsBuildConfig% [qmake]
|
||||
|
||||
set RS_QMAKE_CONFIG="CONFIG+=%RsBuildConfig%"
|
||||
if "%ParamVersion%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=version_detail_bash_script"
|
||||
if "%ParamAutologin%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=rs_autologin"
|
||||
if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retroshare_plugins"
|
||||
if "%ParamRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% "CONFIG+=retrotor"
|
||||
|
||||
call "%ToolsPath%\msys2-path.bat" "%SourcePath%" MSYS2SourcePath
|
||||
call "%ToolsPath%\msys2-path.bat" "%EnvMSYS2Path%" MSYS2EnvMSYS2Path
|
||||
|
@ -3,7 +3,6 @@ set Param32=0
|
||||
set Param64=0
|
||||
set ParamRelease=0
|
||||
set ParamDebug=0
|
||||
set ParamVersion=0
|
||||
set ParamAutologin=0
|
||||
set ParamPlugins=0
|
||||
set ParamTor=0
|
||||
@ -19,8 +18,6 @@ if "%~1" NEQ "" (
|
||||
set ParamRelease=1
|
||||
) else if "%%~a"=="debug" (
|
||||
set ParamDebug=1
|
||||
) else if "%%~a"=="version" (
|
||||
set ParamVersion=1
|
||||
) else if "%%~a"=="autologin" (
|
||||
set ParamAutologin=1
|
||||
) else if "%%~a"=="plugins" (
|
||||
@ -87,7 +84,6 @@ echo 32^|64 32-bit or 64-bit Version
|
||||
echo release^|debug Build release or debug version
|
||||
echo.
|
||||
echo Optional parameter (need clean when changed)
|
||||
echo version Create version information from git
|
||||
echo autologin Build with autologin
|
||||
echo plugins Build plugins
|
||||
echo.
|
||||
|
@ -26,27 +26,21 @@ if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error
|
||||
:: Get compiled revision
|
||||
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
|
||||
if not exist "%GetRsVersion%" (
|
||||
echo File not found
|
||||
%cecho% error "File not found"
|
||||
echo %GetRsVersion%
|
||||
goto error
|
||||
)
|
||||
|
||||
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
|
||||
if "%RsRevision%"=="" echo Revision not found.& goto error
|
||||
|
||||
:: Get compiled version
|
||||
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion
|
||||
if "%RsMajorVersion%"=="" echo Major version not found.& goto error
|
||||
call "%GetRsVersion%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Revision not found."& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion
|
||||
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error
|
||||
if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
|
||||
if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
|
||||
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber
|
||||
if "%RsBuildNumber%"=="" echo Build number not found.& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
|
||||
|
||||
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
|
||||
set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
|
||||
|
||||
:: Check WMIC is available
|
||||
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
|
||||
@ -59,10 +53,7 @@ set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
|
||||
if "%ParamTor%"=="1" (
|
||||
:: Check for tor executable
|
||||
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
|
||||
%cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
|
||||
goto error
|
||||
)
|
||||
)
|
||||
@ -78,9 +69,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%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%-msys2%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
|
@ -10,6 +10,8 @@ set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
|
||||
set WgetInstall=wget.exe
|
||||
set DependsUrl=http://www.dependencywalker.com/depends22_x86.zip
|
||||
set DependsInstall=depends22_x86.zip
|
||||
set SigcheckInstall=Sigcheck.zip
|
||||
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
@ -70,6 +72,16 @@ if not exist "%EnvToolsPath%\depends.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\sigcheck.exe" (
|
||||
%cecho% info "Download Sigcheck installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Sigcheck"
|
||||
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
|
||||
)
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
@ -1,9 +1,14 @@
|
||||
:: Usage:
|
||||
:: call get-rs-version.bat Define Variable
|
||||
:: call get-rs-version.bat Executable Variable
|
||||
::
|
||||
:: Variable.Major
|
||||
:: Variable.Minor
|
||||
:: Variable.Mini
|
||||
:: Variable.Extra
|
||||
|
||||
setlocal
|
||||
|
||||
set Define=%~1
|
||||
set Executable=%~1
|
||||
set Variable=%~2
|
||||
if "%Variable%"=="" (
|
||||
echo.
|
||||
@ -11,23 +16,23 @@ if "%Variable%"=="" (
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set Result=
|
||||
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
|
||||
|
||||
if not exist "%VersionFile%" (
|
||||
if not exist "%Executable%" (
|
||||
echo.
|
||||
echo Version file doesn't exist.
|
||||
echo %VersionFile%
|
||||
echo File %Executable% doesn't exist.
|
||||
exit /B1
|
||||
)
|
||||
|
||||
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
|
||||
if "%%A"=="#define" (
|
||||
if "%%B"=="%Define%" (
|
||||
set Result=%%~C
|
||||
)
|
||||
)
|
||||
set VersionMajor=
|
||||
set VersionMinor=
|
||||
set VersionMini=
|
||||
set VersionExtra=
|
||||
|
||||
for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
|
||||
set VersionMajor=%%A
|
||||
set VersionMinor=%%B
|
||||
set VersionMini=%%C
|
||||
set VersionExtra=%%D
|
||||
)
|
||||
|
||||
endlocal & set %Variable%=%Result%
|
||||
endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
|
||||
exit /B 0
|
@ -13,7 +13,7 @@ call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release tor version autologin plugins
|
||||
call "%~dp0build\build.bat" release tor autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
|
@ -13,7 +13,7 @@ call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" release version autologin plugins
|
||||
call "%~dp0build\build.bat" release autologin plugins
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
|
@ -31,15 +31,13 @@ set NSIS_PARAM=%NSIS_PARAM% /DOUTDIR="%RsPackPath%"
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DINSTALLERADD="%RsArchiveAdd%"
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DEXTERNAL_LIB_DIR="%BuildLibsPath%\libs"
|
||||
|
||||
:: Scan version from source
|
||||
set RsRevision=
|
||||
set RsBuildAdd=
|
||||
call "%ToolsPath%\get-rs-version.bat" RS_REVISION_STRING RsRevision
|
||||
if "%RsRevision%"=="" echo Revision not found.& exit /B 1
|
||||
call "%ToolsPath%\get-rs-version.bat" RS_BUILD_NUMBER_ADD RsBuildAdd
|
||||
if errorlevel 1 exit /B 1
|
||||
:: Get compiled version
|
||||
call "%ToolsPath%\get-rs-version.bat" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Version not found."& exit /B 1
|
||||
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsRevision% /DBUILDADD=%RsBuildAdd%
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& exit /B 1
|
||||
|
||||
set NSIS_PARAM=%NSIS_PARAM% /DREVISION=%RsVersion.Extra%
|
||||
|
||||
set QtMainVersion=%QtVersion:~0,1%
|
||||
|
||||
|
@ -22,13 +22,12 @@ set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
|
||||
|
||||
:: Check git executable
|
||||
if "%ParamVersion%"=="0" goto found_git
|
||||
set GitPath=
|
||||
call "%ToolsPath%\find-in-path.bat" GitPath git.exe
|
||||
if "%GitPath%" NEQ "" goto found_git
|
||||
choice /M "Git not found in PATH. Version information cannot be calculated. Do you want to proceed?"
|
||||
if %errorlevel%==2 exit /B 1
|
||||
:found_git
|
||||
if "%GitPath%"=="" (
|
||||
%cecho% error "Git not found in PATH. Version information cannot be determined."
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo === Version
|
||||
@ -75,7 +74,7 @@ popd
|
||||
|
||||
title %COMSPEC%
|
||||
|
||||
if errorlevel 1 echo.& echo Build failed& echo.
|
||||
if errorlevel 1 %cecho% error "\nBuild failed\n"
|
||||
exit /B %ERRORLEVEL%
|
||||
|
||||
:error_env
|
||||
|
@ -1,7 +1,6 @@
|
||||
:: Process commandline parameter
|
||||
set ParamRelease=0
|
||||
set ParamDebug=0
|
||||
set ParamVersion=0
|
||||
set ParamAutologin=0
|
||||
set ParamPlugins=0
|
||||
set ParamTor=0
|
||||
@ -13,8 +12,6 @@ if "%~1" NEQ "" (
|
||||
set ParamRelease=1
|
||||
) else if "%%~a"=="debug" (
|
||||
set ParamDebug=1
|
||||
) else if "%%~a"=="version" (
|
||||
set ParamVersion=1
|
||||
) else if "%%~a"=="autologin" (
|
||||
set ParamAutologin=1
|
||||
) else if "%%~a"=="plugins" (
|
||||
@ -95,7 +92,6 @@ echo Mandatory parameter
|
||||
echo release^|debug Build release or debug version
|
||||
echo.
|
||||
echo Optional parameter (need clean when changed)
|
||||
echo version Create version information from git
|
||||
echo autologin Build with autologin
|
||||
echo plugins Build plugins
|
||||
echo.
|
||||
|
@ -32,27 +32,21 @@ if not exist "%RsBuildPath%\Makefile" echo Project is not compiled.& goto error
|
||||
:: Get compiled revision
|
||||
set GetRsVersion=%SourcePath%\build_scripts\Windows\tools\get-rs-version.bat
|
||||
if not exist "%GetRsVersion%" (
|
||||
echo File not found
|
||||
%cecho% error "File not found"
|
||||
echo %GetRsVersion%
|
||||
goto error
|
||||
)
|
||||
|
||||
call "%GetRsVersion%" RS_REVISION_STRING RsRevision
|
||||
if "%RsRevision%"=="" echo Revision not found.& goto error
|
||||
|
||||
:: Get compiled version
|
||||
call "%GetRsVersion%" RS_MAJOR_VERSION RsMajorVersion
|
||||
if "%RsMajorVersion%"=="" echo Major version not found.& goto error
|
||||
call "%GetRsVersion%" "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\retroshare.exe" RsVersion
|
||||
if errorlevel 1 %cecho% error "Version not found."& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_MINOR_VERSION RsMinorVersion
|
||||
if "%RsMinorVersion%"=="" echo Minor version not found.& goto error
|
||||
if "%RsVersion.Major%"=="" %cecho% error "Major version not found."& goto error
|
||||
if "%RsVersion.Minor%"=="" %cecho% error "Minor version not found."& goto error
|
||||
if "%RsVersion.Mini%"=="" %cecho% error "Mini number not found".& goto error
|
||||
if "%RsVersion.Extra%"=="" %cecho% error "Extra number not found".& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_BUILD_NUMBER RsBuildNumber
|
||||
if "%RsBuildNumber%"=="" echo Build number not found.& goto error
|
||||
|
||||
call "%GetRsVersion%" RS_BUILD_NUMBER_ADD RsBuildNumberAdd
|
||||
|
||||
set RsVersion=%RsMajorVersion%.%RsMinorVersion%.%RsBuildNumber%%RsBuildNumberAdd%
|
||||
set RsVersion=%RsVersion.Major%.%RsVersion.Minor%.%RsVersion.Mini%
|
||||
|
||||
:: Check WMIC is available
|
||||
wmic.exe alias /? >nul 2>&1 || echo WMIC is not available.&& goto error
|
||||
@ -65,10 +59,7 @@ set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
|
||||
if "%ParamTor%"=="1" (
|
||||
:: Check for tor executable
|
||||
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
|
||||
%cecho% error "Tor binary not found. Please download Tor Expert Bundle from\nhttps://www.torproject.org/download/download.html.en\nand unpack to\n%EnvDownloadPath:\=\\%\\tor"
|
||||
goto error
|
||||
)
|
||||
)
|
||||
@ -83,9 +74,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%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsVersion.Extra%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
@ -98,7 +89,7 @@ title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
|
||||
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
|
||||
set Extensions=
|
||||
for /f %%e in ('type "%ExtensionsFile%" ^| "%EnvSedExe%" -n "s/^.*\/\(extensions[^/]*\)\/.*$/\1/p" ^| "%EnvSedExe%" -n "1,1p"') do set Extensions=%%e
|
||||
if "%Extensions%"=="" echo Folder for extensions not found in %ExtensionsFile%& goto error
|
||||
if "%Extensions%"=="" %cecho% error "Folder for extensions not found in %ExtensionsFile%"& goto error
|
||||
|
||||
:: Copy files
|
||||
mkdir "%RsDeployPath%\Data\%Extensions%"
|
||||
|
8
build_scripts/Windows/env/env.bat
vendored
8
build_scripts/Windows/env/env.bat
vendored
@ -24,7 +24,13 @@ if not exist "%EnvToolsPath%" mkdir "%EnvToolsPath%"
|
||||
if not exist "%EnvDownloadPath%" mkdir "%EnvDownloadPath%"
|
||||
|
||||
call "%~dp0tools\prepare-tools.bat"
|
||||
exit /B %ERRORLEVEL%
|
||||
if errorlevel 1 exit /B %ERRORLEVEL%
|
||||
|
||||
:: Add MinGit to PATH
|
||||
set PATH=%EnvToolsPath%\MinGit\cmd;%PATH%
|
||||
set HOME=%EnvToolsPath%\MinGit\home
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
|
@ -19,6 +19,11 @@ set UnixToolsInstall=UnxUpdates.zip
|
||||
set NSISUrl=http://prdownloads.sourceforge.net/nsis/nsis-3.0-setup.exe?download
|
||||
set NSISInstall=nsis-3.0-setup.exe
|
||||
set NSISInstallPath=%EnvToolsPath%\NSIS
|
||||
set MinGitInstall=MinGit-2.19.1-32-bit.zip
|
||||
set MinGitUrl=https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/%MinGitInstall%
|
||||
set MinGitInstallPath=%EnvToolsPath%\MinGit
|
||||
set SigcheckInstall=Sigcheck.zip
|
||||
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
@ -143,7 +148,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
|
||||
if not exist "%NSISInstallPath%\nsis.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
@ -160,6 +165,26 @@ if not exist "%EnvToolsPath%\NSIS\nsis.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
)
|
||||
|
||||
if not exist "%MinGitInstallPath%\cmd\git.exe" (
|
||||
%cecho% info "Download MinGit installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%MinGitInstall%" call "%ToolsPath%\download-file.bat" "%MinGitUrl%" "%EnvDownloadPath%\%MinGitInstall%"
|
||||
if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
|
||||
|
||||
%cecho% info "Unpack MinGit"
|
||||
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\sigcheck.exe" (
|
||||
%cecho% info "Download Sigcheck installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" call "%ToolsPath%\download-file.bat" "%SigcheckUrl%" "%EnvDownloadPath%\%SigcheckInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SigcheckInstall%" %cecho% error "Cannot download Sigcheck installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Sigcheck"
|
||||
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
|
||||
)
|
||||
|
||||
:exit
|
||||
endlocal
|
||||
exit /B 0
|
||||
|
@ -4,7 +4,7 @@
|
||||
!include ifexist.nsh
|
||||
|
||||
# Needed defines
|
||||
;!define BUILDADD ""
|
||||
;!define REVISION ""
|
||||
;!define RELEASEDIR ""
|
||||
;!define QTDIR ""
|
||||
;!define MINGWDIR ""
|
||||
@ -13,10 +13,6 @@
|
||||
;!define OUTDIR ""
|
||||
|
||||
# Check needed defines
|
||||
!ifndef BUILDADD
|
||||
!error "BUILDADD is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef RELEASEDIR
|
||||
!error "RELEASEDIR is not defined"
|
||||
!endif
|
||||
@ -44,7 +40,7 @@
|
||||
|
||||
# Get version from executable
|
||||
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
|
||||
;!define REVISION ${VERSION_4}
|
||||
|
||||
# Get version of Qt
|
||||
@ -56,10 +52,6 @@
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef REVISION
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
# Date
|
||||
!define /date Date "%Y%m%d"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
!include ifexist.nsh
|
||||
|
||||
# Needed defines
|
||||
;!define BUILDADD ""
|
||||
;!define REVISION ""
|
||||
;!define RELEASEDIR ""
|
||||
;!define QTDIR ""
|
||||
;!define MINGWDIR ""
|
||||
@ -13,10 +13,6 @@
|
||||
;!define OUTDIR ""
|
||||
|
||||
# Check needed defines
|
||||
!ifndef BUILDADD
|
||||
!error "BUILDADD is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef RELEASEDIR
|
||||
!error "RELEASEDIR is not defined"
|
||||
!endif
|
||||
@ -44,7 +40,7 @@
|
||||
|
||||
# Get version from executable
|
||||
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
|
||||
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}
|
||||
;!define REVISION ${VERSION_4}
|
||||
|
||||
# Get version of Qt
|
||||
@ -56,10 +52,6 @@
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
!ifndef REVISION
|
||||
!error "REVISION is not defined"
|
||||
!endif
|
||||
|
||||
# Date
|
||||
!define /date Date "%Y%m%d"
|
||||
|
||||
|
@ -1,9 +1,14 @@
|
||||
:: Usage:
|
||||
:: call get-rs-version.bat Define Variable
|
||||
:: call get-rs-version.bat Executable Variable
|
||||
::
|
||||
:: Variable.Major
|
||||
:: Variable.Minor
|
||||
:: Variable.Mini
|
||||
:: Variable.Extra
|
||||
|
||||
setlocal
|
||||
|
||||
set Define=%~1
|
||||
set Executable=%~1
|
||||
set Variable=%~2
|
||||
if "%Variable%"=="" (
|
||||
echo.
|
||||
@ -11,23 +16,23 @@ if "%Variable%"=="" (
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
set Result=
|
||||
set VersionFile="%~dp0..\..\..\libretroshare\src\retroshare\rsversion.h"
|
||||
|
||||
if not exist "%VersionFile%" (
|
||||
if not exist "%Executable%" (
|
||||
echo.
|
||||
echo Version file doesn't exist.
|
||||
echo %VersionFile%
|
||||
echo File %Executable% doesn't exist.
|
||||
exit /B1
|
||||
)
|
||||
|
||||
for /F "usebackq tokens=1,2,3" %%A in (%VersionFile%) do (
|
||||
if "%%A"=="#define" (
|
||||
if "%%B"=="%Define%" (
|
||||
set Result=%%~C
|
||||
)
|
||||
)
|
||||
set VersionMajor=
|
||||
set VersionMinor=
|
||||
set VersionMini=
|
||||
set VersionExtra=
|
||||
|
||||
for /F "tokens=1,2,3,* delims=.-" %%A in ('%EnvToolsPath%\sigcheck.exe -nobanner -n %Executable%') do (
|
||||
set VersionMajor=%%A
|
||||
set VersionMinor=%%B
|
||||
set VersionMini=%%C
|
||||
set VersionExtra=%%D
|
||||
)
|
||||
|
||||
endlocal & set %Variable%=%Result%
|
||||
endlocal & set %Variable%.Major=%VersionMajor%& set %Variable%.Minor=%VersionMinor%& set %Variable%.Mini=%VersionMini%& set %Variable%.Extra=%VersionExtra%&
|
||||
exit /B 0
|
263
data/retroshare.svg
Normal file
263
data/retroshare.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 67 KiB |
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
|
||||
if(argc != 3)
|
||||
{
|
||||
qDebug() << "Usage: jsonapi-generator SOURCE_PATH OUTPUT_PATH";
|
||||
return EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
QString sourcePath(argv[1]);
|
||||
@ -56,17 +56,23 @@ int main(int argc, char *argv[])
|
||||
QFile wrappersDefFile(wrappersDefFilePath);
|
||||
wrappersDefFile.remove();
|
||||
if(!wrappersDefFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text))
|
||||
qFatal(QString("Can't open: " + wrappersDefFilePath).toLatin1().data());
|
||||
{
|
||||
qDebug() << "Can't open: " << wrappersDefFilePath;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
QString cppApiIncludesFilePath(outputPath + "/jsonapi-includes.inl");
|
||||
QFile cppApiIncludesFile(cppApiIncludesFilePath);
|
||||
cppApiIncludesFile.remove();
|
||||
if(!cppApiIncludesFile.open(QIODevice::WriteOnly|QIODevice::Append|QIODevice::Text))
|
||||
qFatal(QString("Can't open: " + cppApiIncludesFilePath).toLatin1().data());
|
||||
{
|
||||
qDebug() << "Can't open: " << cppApiIncludesFilePath;
|
||||
return -errno;
|
||||
}
|
||||
QSet<QString> cppApiIncludesSet;
|
||||
|
||||
auto fatalError = [&](
|
||||
std::initializer_list<QVariant> errors, int ernum = EINVAL )
|
||||
std::initializer_list<QVariant> errors, int ernum = -EINVAL )
|
||||
{
|
||||
QString errorMsg;
|
||||
for(const QVariant& error: errors)
|
||||
@ -296,7 +302,7 @@ int main(int argc, char *argv[])
|
||||
const MethodParam& mp(paramsMap[pn]);
|
||||
paramsDeclaration += "\t\t" + mp.type + " " + mp.name;
|
||||
if(!mp.defval.isEmpty())
|
||||
paramsDeclaration += "(" + mp.defval + ")";
|
||||
paramsDeclaration += " = " + mp.defval;
|
||||
paramsDeclaration += ";\n";
|
||||
if(mp.in)
|
||||
inputParamsDeserialization += "\t\t\tRS_SERIAL_PROCESS("
|
||||
|
@ -78,7 +78,7 @@ win32 {
|
||||
QMAKE_CC = $${QMAKE_CXX}
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN
|
||||
# These have been replaced by _WIN32 && __MINGW32__
|
||||
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
SendLobbyParticipantsTask(RsIdentity* idservice, ChatHandler::LobbyParticipantsInfo pi):
|
||||
GxsResponseTask(idservice, 0), mParticipantsInfo(pi)
|
||||
{
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
requestGxsId(mit->first);
|
||||
}
|
||||
@ -144,8 +144,8 @@ protected:
|
||||
virtual void gxsDoWork(Request &/*req*/, Response &resp)
|
||||
{
|
||||
resp.mDataStream.getStreamToMember();
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
StreamBase& stream = resp.mDataStream.getStreamToMember();
|
||||
double last_active = mit->second;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "StateTokenServer.h"
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsPeers;
|
||||
class RsIdentity;
|
||||
@ -117,7 +118,7 @@ public:
|
||||
class LobbyParticipantsInfo{
|
||||
public:
|
||||
StateToken state_token;
|
||||
std::map<RsGxsId, time_t> participants;
|
||||
std::map<RsGxsId, rstime_t> participants;
|
||||
};
|
||||
|
||||
class ChatInfo{
|
||||
|
@ -521,7 +521,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
|
||||
StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages");
|
||||
usagesStream.getStreamToMember();
|
||||
|
||||
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
for(auto it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
{
|
||||
usagesStream.getStreamToMember()
|
||||
<< makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS)
|
||||
|
@ -422,7 +422,9 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
||||
{
|
||||
if(str == "self" && !req.mPath.empty() && req.mPath.top() == "certificate")
|
||||
{
|
||||
resp.mDataStream << makeKeyValue("cert_string", mRsPeers->GetRetroshareInvite(false));
|
||||
resp.mDataStream << makeKeyValue(
|
||||
"cert_string",
|
||||
mRsPeers->GetRetroshareInvite());
|
||||
resp.setOk();
|
||||
return;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
resp.setFail("hidden_port out of range. It must fit into uint16!");
|
||||
return;
|
||||
}
|
||||
hidden_port = p;
|
||||
hidden_port = static_cast<uint16_t>(p);
|
||||
}
|
||||
|
||||
RsPgpId pgp_id;
|
||||
@ -527,7 +527,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
RsInit::SetHiddenLocation(hidden_address, hidden_port, false);
|
||||
}
|
||||
|
||||
std::string ssl_password = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
|
||||
std::string ssl_password = RSRandom::random_alphaNumericString(static_cast<uint32_t>(RsInit::getSslPwdLen())) ;
|
||||
|
||||
/* GenerateSSLCertificate - selects the PGP Account */
|
||||
//RsInit::SelectGPGAccount(PGPId);
|
||||
@ -581,7 +581,7 @@ bool RsControlModule::askForDeferredSelfSignature(const void *data, const uint32
|
||||
}
|
||||
}
|
||||
|
||||
bool RsControlModule::requestShutdown()
|
||||
void RsControlModule::requestShutdown()
|
||||
{
|
||||
RS_STACK_MUTEX(mExitFlagMtx);
|
||||
mProcessShouldExit = true;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
// full_control: set to true if this module should handle rsinit and login
|
||||
// set to false if rsinit is handled by the Qt gui
|
||||
RsControlModule(int argc, char **argv, StateTokenServer* sts, ApiServer* apiserver, bool full_control);
|
||||
~RsControlModule();
|
||||
~RsControlModule() override;
|
||||
|
||||
// returns true if the process should terminate
|
||||
bool processShouldExit();
|
||||
@ -62,12 +62,12 @@ public:
|
||||
virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled) override;
|
||||
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason = "") override;
|
||||
|
||||
virtual bool requestShutdown();
|
||||
virtual void requestShutdown();
|
||||
|
||||
protected:
|
||||
// from RsThread
|
||||
// wee need a thread to call into things which block like askForPassword()
|
||||
virtual void run();
|
||||
virtual void run() override;
|
||||
|
||||
private:
|
||||
void handleRunState(Request& req, Response& resp);
|
||||
|
@ -40,16 +40,16 @@
|
||||
//#define DEBUG_CHAT_LOBBIES 1
|
||||
|
||||
static const int CONNECTION_CHALLENGE_MAX_COUNT = 20 ; // sends a connection challenge every 20 messages
|
||||
static const time_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const rstime_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const int CONNECTION_CHALLENGE_MIN_DELAY = 15 ; // sends a connection at most every 15 seconds
|
||||
static const int LOBBY_CACHE_CLEANING_PERIOD = 10 ; // clean lobby caches every 10 secs (remove old messages)
|
||||
|
||||
static const time_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const time_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const time_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const time_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
static const rstime_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const rstime_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const rstime_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const rstime_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const rstime_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const rstime_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
|
||||
static const uint32_t MAX_ALLOWED_LOBBIES_IN_LIST_WARNING = 50 ;
|
||||
//static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
|
||||
@ -71,10 +71,10 @@ DistributedChatService::DistributedChatService(uint32_t serv_type,p3ServiceContr
|
||||
|
||||
void DistributedChatService::flush()
|
||||
{
|
||||
static time_t last_clean_time_lobby = 0 ;
|
||||
static time_t last_req_chat_lobby_list = 0 ;
|
||||
static rstime_t last_clean_time_lobby = 0 ;
|
||||
static rstime_t last_req_chat_lobby_list = 0 ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(last_clean_time_lobby + LOBBY_CACHE_CLEANING_PERIOD < now)
|
||||
{
|
||||
@ -117,19 +117,19 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||
if(cli == NULL)
|
||||
return true ; // the item is handled correctly if it's not a lobby item ;-)
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now+100 > (time_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return false ;
|
||||
}
|
||||
if(now+600 < (time_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
if(now+600 < (rstime_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -292,7 +292,7 @@ bool DistributedChatService::getVirtualPeerId(const ChatLobbyId& id,ChatLobbyVir
|
||||
void DistributedChatService::locked_printDebugInfo() const
|
||||
{
|
||||
std::cerr << "Recorded lobbies: " << std::endl;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for( std::map<ChatLobbyId,ChatLobbyEntry>::const_iterator it(_chat_lobbys.begin()) ;it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
@ -307,7 +307,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
std::cerr << " Last activity\t: " << now - it->second.last_activity << " seconds ago." << std::endl;
|
||||
std::cerr << " Cached messages\t: " << it->second.msg_cache.size() << std::endl;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
std::cerr << " " << std::hex << it2->first << std::dec << " time=" << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
std::cerr << " Participating friends: " << std::endl;
|
||||
@ -317,7 +317,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
std::cerr << " Participating nick names: " << std::endl;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
for(std::map<RsGxsId,rstime_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
std::cerr << " " << it2->first << ": " << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
}
|
||||
@ -339,7 +339,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObject *obj,const RsPeerId& peer_id,uint32_t lobby_count)
|
||||
{
|
||||
static std::map<std::string, std::list<time_t> > message_counts ;
|
||||
static std::map<std::string, std::list<rstime_t> > message_counts ;
|
||||
|
||||
std::ostringstream os ;
|
||||
os << obj->lobby_id ;
|
||||
@ -375,14 +375,14 @@ bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObjec
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "lobby_count=" << lobby_count << std::endl;
|
||||
std::cerr << "Got msg for peer " << pid << std::dec << ". Limit is " << max_cnt << ". List is " ;
|
||||
for(std::list<time_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
for(std::list<rstime_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
std::cerr << *it << " " ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::list<time_t>& lst = message_counts[pid] ;
|
||||
std::list<rstime_t>& lst = message_counts[pid] ;
|
||||
|
||||
// Clean old messages time stamps from the list.
|
||||
//
|
||||
@ -501,7 +501,7 @@ void DistributedChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
std::cerr << "Received chat lobby list from friend " << item->PeerId() << ", " << item->lobbies.size() << " elements." << std::endl;
|
||||
#endif
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -677,7 +677,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(rsReputations->overallReputationLevel(item->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
{
|
||||
@ -713,17 +713,17 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
}
|
||||
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
|
||||
|
||||
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return ;
|
||||
}
|
||||
if(now+600 < (time_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
if(now+600 < (rstime_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -751,7 +751,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
|
||||
if(it != _chat_lobbys.end())
|
||||
{
|
||||
std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
|
||||
if(it2 != it->second.gxs_ids.end())
|
||||
{
|
||||
@ -815,7 +815,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
visible_lobbies.push_back(it->second) ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now > MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ + last_visible_lobby_info_request_time)
|
||||
{
|
||||
@ -843,7 +843,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
//
|
||||
bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,const RsPeerId& peer_id)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
locked_printDebugInfo() ; // debug
|
||||
@ -874,7 +874,7 @@ bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,c
|
||||
|
||||
// Checks wether the msg is already recorded or not
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
|
||||
if(it2 != lobby.msg_cache.end()) // found!
|
||||
{
|
||||
@ -1097,7 +1097,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
std::cerr << " Peer Id = " << item->PeerId() << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyId lobby_id ;
|
||||
const RsPeerId& ownId = rsPeers->getOwnId();
|
||||
|
||||
@ -1106,7 +1106,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it(_chat_lobbys.begin());it!=_chat_lobbys.end() && !found;++it)
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE + 5 > now) // any msg not older than 5 seconds plus max challenge count is fine.
|
||||
{
|
||||
uint64_t code = makeConnexionChallengeCode(ownId,it->first,it2->first) ;
|
||||
@ -1156,10 +1156,10 @@ void DistributedChatService::sendConnectionChallenge(ChatLobbyId lobby_id)
|
||||
return ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyMsgId msg_id = 0 ;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE > now) // any msg not older than 20 seconds is fine.
|
||||
{
|
||||
msg_id = it2->first ;
|
||||
@ -1431,7 +1431,7 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new Lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.participating_friends.insert(it->second.peer_id) ;
|
||||
@ -1555,7 +1555,7 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
|
||||
@ -1604,7 +1604,7 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " New (unique) ID: " << std::hex << lobby_id << std::dec << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.lobby_flags = lobby_flags ;
|
||||
@ -1859,20 +1859,20 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
{
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 1 - clean cache of all lobbies and participating nicknames.
|
||||
//
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.begin();it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
for(std::map<ChatLobbyMsgId,time_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
if(it2->second + MAX_KEEP_MSG_RECORD < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing old msg 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator tmp(it2) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.msg_cache.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
@ -1882,14 +1882,14 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
|
||||
bool changed = false ;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
for(std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
if(it2->second + MAX_KEEP_INACTIVE_NICKNAME < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing inactive nickname 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<RsGxsId,time_t>::iterator tmp(it2) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.gxs_ids.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
|
@ -135,11 +135,11 @@ class DistributedChatService
|
||||
class ChatLobbyEntry: public ChatLobbyInfo
|
||||
{
|
||||
public:
|
||||
std::map<ChatLobbyMsgId,time_t> msg_cache ;
|
||||
std::map<ChatLobbyMsgId,rstime_t> msg_cache ;
|
||||
RsPeerId virtual_peer_id ;
|
||||
int connexion_challenge_count ;
|
||||
time_t last_connexion_challenge_time ;
|
||||
time_t last_keep_alive_packet_time ;
|
||||
rstime_t last_connexion_challenge_time ;
|
||||
rstime_t last_keep_alive_packet_time ;
|
||||
std::set<RsPeerId> previously_known_peers ;
|
||||
};
|
||||
|
||||
@ -152,8 +152,8 @@ class DistributedChatService
|
||||
// RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE
|
||||
|
||||
float _time_shift_average ;
|
||||
time_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
time_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
rstime_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
rstime_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
bool _should_reset_lobby_counts ;
|
||||
RsGxsId _default_identity;
|
||||
std::map<ChatLobbyId,RsGxsId> _lobby_default_identity;
|
||||
|
@ -521,12 +521,12 @@ class MsgCounter
|
||||
public:
|
||||
MsgCounter() {}
|
||||
|
||||
void clean(time_t max_time)
|
||||
void clean(rstime_t max_time)
|
||||
{
|
||||
while(!recv_times.empty() && recv_times.front() < max_time)
|
||||
recv_times.pop_front() ;
|
||||
}
|
||||
std::list<time_t> recv_times ;
|
||||
std::list<rstime_t> recv_times ;
|
||||
};
|
||||
|
||||
void p3ChatService::handleIncomingItem(RsItem *item)
|
||||
|
@ -21,7 +21,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
|
||||
|
@ -28,6 +28,11 @@ namespace librs
|
||||
{
|
||||
namespace crypto
|
||||
{
|
||||
// Forward declare the class
|
||||
class HashStream;
|
||||
// Forward declare the template operator
|
||||
template<class T> HashStream& operator<<(HashStream& u, const T&);
|
||||
|
||||
class HashStream
|
||||
{
|
||||
public:
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
#include <vector>
|
||||
#include <xapian.h>
|
||||
|
||||
@ -261,7 +261,7 @@ private:
|
||||
return dbDir;
|
||||
}
|
||||
|
||||
static std::string timetToXapianDate(const time_t& time)
|
||||
static std::string timetToXapianDate(const rstime_t& time)
|
||||
{
|
||||
char date[] = "YYYYMMDD\0";
|
||||
std::strftime(date, 9, "%Y%m%d", std::gmtime(&time));
|
||||
|
@ -80,7 +80,7 @@
|
||||
PeerConnectStateBox::PeerConnectStateBox()
|
||||
{
|
||||
//mPeerId = id;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
mState = CSB_START;
|
||||
mNetState = CSB_NETSTATE_UNKNOWN;
|
||||
mStateTS = now;
|
||||
@ -241,7 +241,7 @@ void PeerConnectStateBox::stateMsg(std::ostream &out, std::string msg, uint32_t
|
||||
std::string PeerConnectStateBox::connectState() const
|
||||
{
|
||||
std::string str = StateAsString(mState);
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::string out;
|
||||
rs_sprintf(out, "%s(%lu/%lu) for %ld secs", str.c_str(), mNoAttempts, mNoFailedAttempts, now - mStateTS);
|
||||
if ( (mState == CSB_CONNECTED) || (mState == CSB_DIRECT_ATTEMPT) ||
|
||||
@ -358,7 +358,7 @@ uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, uint32_t netmode, uint3
|
||||
uint32_t PeerConnectStateBox::connectCb_direct()
|
||||
{
|
||||
uint32_t retval = 0;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -497,7 +497,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
|
||||
proxyPortMode = CSB_ACTION_DHT_PORT;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -782,7 +782,7 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
|
||||
*/
|
||||
|
||||
/* DO Connect / Disconnect Updates ... very specific! */
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
switch(update)
|
||||
{
|
||||
case CSB_UPDATE_CONNECTED:
|
||||
@ -1035,7 +1035,7 @@ bool PeerConnectStateBox::storeProxyPortChoice(uint32_t flags, bool useProxyPort
|
||||
bool PeerConnectStateBox::getProxyPortChoice()
|
||||
{
|
||||
#ifdef DEBUG_CONNECTBOX
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::cerr << "PeerConnectStateBox::getProxyPortChoice() Using ConnectLogic Info from: ";
|
||||
std::cerr << now-mProxyPortTS << " ago. Flags: " << mProxyPortFlags;
|
||||
|
@ -72,7 +72,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
class PeerConnectStateBox
|
||||
@ -104,16 +104,16 @@ class PeerConnectStateBox
|
||||
|
||||
uint32_t mState;
|
||||
uint32_t mNetState;
|
||||
time_t mStateTS;
|
||||
rstime_t mStateTS;
|
||||
uint32_t mNoAttempts;
|
||||
uint32_t mNoFailedAttempts;
|
||||
time_t mNextAttemptTS;
|
||||
time_t mAttemptLength;
|
||||
rstime_t mNextAttemptTS;
|
||||
rstime_t mAttemptLength;
|
||||
|
||||
// ProxyPort Storage.
|
||||
uint32_t mProxyPortFlags;
|
||||
bool mProxyPortChoice;
|
||||
time_t mProxyPortTS;
|
||||
rstime_t mProxyPortTS;
|
||||
};
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DhtPeerDetails
|
||||
|
||||
/* direct from the DHT! */
|
||||
uint32_t mDhtState; // One of RSDHT_PEERDHT_[...]
|
||||
time_t mDhtUpdateTS;
|
||||
rstime_t mDhtUpdateTS;
|
||||
|
||||
/* internal state */
|
||||
PeerConnectStateBox mConnectLogic;
|
||||
@ -66,9 +66,9 @@ class DhtPeerDetails
|
||||
struct sockaddr_in mPeerConnectAddr;
|
||||
uint32_t mPeerConnectPoint;
|
||||
|
||||
time_t mPeerConnectUdpTS;
|
||||
time_t mPeerConnectTS;
|
||||
time_t mPeerConnectClosedTS;
|
||||
rstime_t mPeerConnectUdpTS;
|
||||
rstime_t mPeerConnectTS;
|
||||
rstime_t mPeerConnectClosedTS;
|
||||
|
||||
bool mExclusiveProxyLock;
|
||||
|
||||
@ -80,7 +80,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerReqState;
|
||||
uint32_t mPeerReqMode;
|
||||
bdId mPeerReqProxyId;
|
||||
time_t mPeerReqTS;
|
||||
rstime_t mPeerReqTS;
|
||||
|
||||
/* Callback Info */
|
||||
std::string mPeerCbMsg;
|
||||
@ -88,7 +88,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerCbPoint;
|
||||
bdId mPeerCbProxyId;
|
||||
bdId mPeerCbDestId;
|
||||
time_t mPeerCbTS;
|
||||
rstime_t mPeerCbTS;
|
||||
|
||||
};
|
||||
|
||||
@ -331,7 +331,7 @@ private:
|
||||
float mDhtReadRate;
|
||||
float mDhtWriteRate;
|
||||
|
||||
time_t mLastDataRateUpdate;
|
||||
rstime_t mLastDataRateUpdate;
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
@ -380,7 +380,7 @@ private:
|
||||
RsPeerId mOwnRsId;
|
||||
bdNodeId mOwnDhtId;
|
||||
|
||||
time_t mMinuteTS;
|
||||
rstime_t mMinuteTS;
|
||||
|
||||
/* translation maps */
|
||||
std::map<RsPeerId, bdNodeId> mTransToNodeId;
|
||||
|
@ -204,7 +204,7 @@ void p3BitDht::updateDataRates()
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********* LOCKED *********/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
float period = now - mLastDataRateUpdate;
|
||||
|
||||
#define RATE_FACTOR (0.75)
|
||||
@ -380,7 +380,7 @@ RsDhtRelayProxy::RsDhtRelayProxy()
|
||||
mCreateTS = 0;
|
||||
|
||||
//uint32_t mDataSize;
|
||||
//time_t mLastBandwidthTS;
|
||||
//rstime_t mLastBandwidthTS;
|
||||
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ int p3BitDht::PeerCallback(const bdId *id, uint32_t status)
|
||||
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
dpd->mDhtUpdateTS = now;
|
||||
|
||||
return 1;
|
||||
@ -510,7 +510,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
||||
*/
|
||||
|
||||
bdId peerId;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(point)
|
||||
{
|
||||
@ -1101,7 +1101,7 @@ int p3BitDht::tick()
|
||||
minuteTick();
|
||||
|
||||
#ifdef DEBUG_PEERNET_COMMON
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(NULL); // Don't use rstime_t here or ctime break on windows
|
||||
std::cerr << "p3BitDht::tick() TIME: " << ctime(&now) << std::endl;
|
||||
std::cerr.flush();
|
||||
#endif
|
||||
@ -1114,7 +1114,7 @@ int p3BitDht::tick()
|
||||
|
||||
int p3BitDht::minuteTick()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
int deltaT = 0;
|
||||
|
||||
{
|
||||
@ -1164,7 +1164,7 @@ int p3BitDht::doActions()
|
||||
std::cerr << "p3BitDht::doActions()" << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
while(mActions.size() > 0)
|
||||
{
|
||||
@ -1727,7 +1727,7 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* check if they are in our friend list */
|
||||
DhtPeerDetails *dpd = findInternalDhtPeer_locked(&(peerId->id), RSDHT_PEERTYPE_FRIEND);
|
||||
@ -2171,7 +2171,7 @@ int p3BitDht::removeRelayConnection(const bdId *srcId, const bdId *destId)
|
||||
void p3BitDht::monitorConnections()
|
||||
{
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::map<bdNodeId, DhtPeerDetails>::iterator it;
|
||||
|
||||
|
@ -90,10 +90,10 @@ Classes
|
||||
- std::string name
|
||||
- RsFileHash hash
|
||||
- uint64_t size
|
||||
- time_t Last modification time
|
||||
- rstime_t Last modification time
|
||||
|
||||
LocalFileInfo: public FileInfo
|
||||
- time_t Last data access time
|
||||
- rstime_t Last data access time
|
||||
- uint64_t Total data uploaded
|
||||
- uint32_t ShareFlags
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
@ -356,7 +356,7 @@ bool InternalFileHierarchyStorage::updateHash(const DirectoryStorage::EntryIndex
|
||||
|
||||
return true;
|
||||
}
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time)
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time)
|
||||
{
|
||||
if(!checkIndex(file_index,FileStorageNode::TYPE_FILE))
|
||||
{
|
||||
@ -427,7 +427,7 @@ DirectoryStorage::EntryIndex InternalFileHierarchyStorage::allocateNewIndex()
|
||||
return mNodes.size()-1 ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,time_t most_recent_time,time_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,rstime_t most_recent_time,rstime_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
{
|
||||
if(!checkIndex(indx,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -599,7 +599,7 @@ void InternalFileHierarchyStorage::getStatistics(SharedDirStats& stats) const
|
||||
stats.total_shared_size = mTotalSize ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m) const
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m) const
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -614,7 +614,7 @@ bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& ind
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m)
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m)
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -631,11 +631,11 @@ bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& ind
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
|
||||
time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
rstime_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
{
|
||||
DirEntry& d(*static_cast<DirEntry*>(mNodes[dir_index])) ;
|
||||
|
||||
time_t largest_modf_time = d.dir_modtime ;
|
||||
rstime_t largest_modf_time = d.dir_modtime ;
|
||||
unfinished_files_present = false ;
|
||||
|
||||
for(uint32_t i=0;i<d.subfiles.size();++i)
|
||||
@ -732,7 +732,7 @@ public:
|
||||
inline virtual const std::string& file_name() const { return mFe.file_name ; }
|
||||
inline virtual uint64_t file_size() const { return mFe.file_size ; }
|
||||
inline virtual const RsFileHash& file_hash() const { return mFe.file_hash ; }
|
||||
inline virtual time_t file_modtime() const { return mFe.file_modtime ; }
|
||||
inline virtual rstime_t file_modtime() const { return mFe.file_modtime ; }
|
||||
inline virtual std::string file_parent_path()const { return RsDirUtil::makePath(mDe.dir_parent_path, mDe.dir_name) ; }
|
||||
inline virtual uint32_t file_popularity() const { NOT_IMPLEMENTED() ; return 0; }
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
{
|
||||
public:
|
||||
FileEntry() : file_size(0), file_modtime(0) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
|
||||
virtual uint32_t type() const { return FileStorageNode::TYPE_FILE ; }
|
||||
virtual ~FileEntry() {}
|
||||
@ -56,7 +56,7 @@ public:
|
||||
// local stuff
|
||||
std::string file_name ;
|
||||
uint64_t file_size ;
|
||||
time_t file_modtime;
|
||||
rstime_t file_modtime;
|
||||
RsFileHash file_hash ;
|
||||
};
|
||||
|
||||
@ -76,9 +76,9 @@ public:
|
||||
std::vector<DirectoryStorage::EntryIndex> subdirs ;
|
||||
std::vector<DirectoryStorage::EntryIndex> subfiles ;
|
||||
|
||||
time_t dir_modtime;
|
||||
time_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
time_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
rstime_t dir_modtime;
|
||||
rstime_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
rstime_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
};
|
||||
|
||||
// class stuff
|
||||
@ -95,18 +95,18 @@ public:
|
||||
bool checkIndex(DirectoryStorage::EntryIndex indx,uint8_t type) const;
|
||||
bool updateSubFilesList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,DirectoryStorage::FileTS>& subfiles,std::map<std::string,DirectoryStorage::FileTS>& new_files);
|
||||
bool updateHash(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, time_t most_recent_time, time_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, rstime_t most_recent_time, rstime_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
|
||||
// TS get/set functions. Take one of the class members as argument.
|
||||
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) ;
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) ;
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
// Also keeps the high level statistics up to date.
|
||||
|
||||
time_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
rstime_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
|
||||
// hash stuff
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rstlvbinary.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/rsdir.h"
|
||||
@ -71,7 +71,7 @@ DirectoryStorage::DirIterator ::operator bool() const { return **this != Directo
|
||||
RsFileHash DirectoryStorage::FileIterator::hash() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_hash):RsFileHash(); }
|
||||
uint64_t DirectoryStorage::FileIterator::size() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_size):0; }
|
||||
std::string DirectoryStorage::FileIterator::name() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_name):std::string(); }
|
||||
time_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
rstime_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
|
||||
std::string DirectoryStorage::DirIterator::name() const { const InternalFileHierarchyStorage::DirEntry *d = mStorage->getDirEntry(**this) ; return d?(d->dir_name):std::string(); }
|
||||
|
||||
@ -119,13 +119,13 @@ uint32_t DirectoryStorage::getEntryType(const EntryIndex& indx)
|
||||
}
|
||||
}
|
||||
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,time_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,time_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,rstime_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,rstime_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
|
||||
bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,time_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,time_t rec_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::setDirectoryLocalModTime (EntryIndex index,time_t loc_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,rstime_t rec_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::setDirectoryLocalModTime (EntryIndex index,rstime_t loc_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
|
||||
bool DirectoryStorage::updateSubDirectoryList(const EntryIndex& indx, const std::set<std::string> &subdirs, const RsFileHash& hash_salt)
|
||||
{
|
||||
@ -281,7 +281,7 @@ bool DirectoryStorage::getIndexFromDirHash(const RsFileHash& hash,EntryIndex& in
|
||||
|
||||
void DirectoryStorage::checkSave()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mChanged && mLastSavedTime + MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE < now)
|
||||
{
|
||||
@ -489,7 +489,7 @@ void LocalDirectoryStorage::updateTimeStamps()
|
||||
|
||||
bool unfinished_files_below ;
|
||||
|
||||
time_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
rstime_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
mTSChanged = false ;
|
||||
|
||||
#ifdef DEBUG_LOCAL_DIRECTORY_STORAGE
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "retroshare/rsids.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; }
|
||||
|
||||
@ -52,13 +53,13 @@ class DirectoryStorage
|
||||
|
||||
// gets/sets the various time stamps:
|
||||
//
|
||||
bool getDirectoryRecursModTime(EntryIndex index,time_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,time_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
bool getDirectoryRecursModTime(EntryIndex index,rstime_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,rstime_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
|
||||
bool setDirectoryRecursModTime(EntryIndex index,time_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,time_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,time_t update_TS) ;
|
||||
bool setDirectoryRecursModTime(EntryIndex index,rstime_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,rstime_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) ;
|
||||
|
||||
uint32_t getEntryType(const EntryIndex& indx) ; // WARNING: returns DIR_TYPE_*, not the internal directory storage stuff.
|
||||
virtual bool extractData(const EntryIndex& indx,DirDetails& d);
|
||||
@ -81,8 +82,8 @@ class DirectoryStorage
|
||||
// info about the directory that is pointed by the iterator
|
||||
|
||||
std::string name() const ;
|
||||
time_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
time_t last_update_time() const ; // last time this directory was updated
|
||||
rstime_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
rstime_t last_update_time() const ; // last time this directory was updated
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
uint32_t mDirTabIndex ; // index in the vector of subdirs.
|
||||
@ -106,7 +107,7 @@ class DirectoryStorage
|
||||
std::string name() const ;
|
||||
uint64_t size() const ;
|
||||
RsFileHash hash() const ;
|
||||
time_t modtime() const ;
|
||||
rstime_t modtime() const ;
|
||||
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
@ -117,7 +118,7 @@ class DirectoryStorage
|
||||
struct FileTS
|
||||
{
|
||||
uint64_t size ;
|
||||
time_t modtime;
|
||||
rstime_t modtime;
|
||||
};
|
||||
|
||||
EntryIndex root() const ; // returns the index of the root directory entry. This is generally 0.
|
||||
@ -171,7 +172,7 @@ class DirectoryStorage
|
||||
|
||||
InternalFileHierarchyStorage *mFileHierarchy ;
|
||||
|
||||
time_t mLastSavedTime ;
|
||||
rstime_t mLastSavedTime ;
|
||||
bool mChanged ;
|
||||
std::string mFileName;
|
||||
};
|
||||
@ -198,7 +199,7 @@ public:
|
||||
* returns the last time a sweep has been done over the directory in order to check update TS.
|
||||
* \return
|
||||
*/
|
||||
time_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
rstime_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
|
||||
/*!
|
||||
* \brief searchHash
|
||||
@ -212,7 +213,7 @@ public:
|
||||
virtual int searchHash(const RsFileHash& hash, EntryIndex& results) const ;
|
||||
|
||||
private:
|
||||
time_t mLastSweepTime ;
|
||||
rstime_t mLastSweepTime ;
|
||||
};
|
||||
|
||||
class LocalDirectoryStorage: public DirectoryStorage
|
||||
|
@ -64,7 +64,7 @@ void LocalDirectoryUpdater::setEnabled(bool b)
|
||||
|
||||
void LocalDirectoryUpdater::data_tick()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if (mIsEnabled || mForceUpdate)
|
||||
{
|
||||
@ -190,14 +190,14 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
|
||||
librs::util::FolderIterator dirIt(cumulated_path,mFollowSymLinks,false); // disallow symbolic links and files from the future.
|
||||
|
||||
time_t dir_local_mod_time ;
|
||||
rstime_t dir_local_mod_time ;
|
||||
if(!mSharedDirectories->getDirectoryLocalModTime(indx,dir_local_mod_time))
|
||||
{
|
||||
std::cerr << "(EE) Cannot get local mod time for dir index " << indx << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(mNeedsFullRecheck || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
||||
// we only want to detect when the directory has changed on the disk
|
||||
|
@ -27,6 +27,7 @@
|
||||
//
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class LocalDirectoryUpdater: public HashStorageClient, public RsTickingThread
|
||||
{
|
||||
@ -77,8 +78,8 @@ private:
|
||||
|
||||
RsFileHash mHashSalt ;
|
||||
|
||||
time_t mLastSweepTime;
|
||||
time_t mLastTSUpdateTime;
|
||||
rstime_t mLastSweepTime;
|
||||
rstime_t mLastTSUpdateTime;
|
||||
|
||||
uint32_t mDelayBetweenDirectoryUpdates;
|
||||
bool mIsEnabled ;
|
||||
|
@ -232,7 +232,7 @@ void HashStorage::data_tick()
|
||||
job.client->hash_callback(job.client_param, job.full_path, hash, size);
|
||||
}
|
||||
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,rstime_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
{
|
||||
// check if the hash is up to date w.r.t. cache.
|
||||
|
||||
@ -243,7 +243,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
|
||||
std::string real_path = RsDirUtil::removeSymLinks(full_path) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
std::map<std::string,HashStorageInfo>::iterator it = mFiles.find(real_path) ;
|
||||
|
||||
// On windows we compare the time up to +/- 3600 seconds. This avoids re-hashing files in case of daylight saving change.
|
||||
@ -318,8 +318,8 @@ void HashStorage::clean()
|
||||
{
|
||||
RS_STACK_MUTEX(mHashMtx) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
time_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
rstime_t now = time(NULL) ;
|
||||
rstime_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << "Cleaning hash cache." << std::endl ;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <map>
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
/*!
|
||||
* \brief The HashStorageClient class
|
||||
@ -65,7 +66,7 @@ public:
|
||||
*
|
||||
* \return true if the supplied hash info is up to date.
|
||||
*/
|
||||
bool requestHash(const std::string& full_path, uint64_t size, time_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
bool requestHash(const std::string& full_path, uint64_t size, rstime_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
|
||||
struct HashStorageInfo
|
||||
{
|
||||
@ -120,7 +121,7 @@ private:
|
||||
uint64_t size ;
|
||||
HashStorageClient *client;
|
||||
uint32_t client_param ;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
};
|
||||
|
||||
// current work
|
||||
@ -136,7 +137,7 @@ private:
|
||||
uint64_t mTotalSizeToHash ;
|
||||
uint64_t mTotalHashedSize ;
|
||||
uint64_t mTotalFilesToHash ;
|
||||
time_t mLastSaveTime ;
|
||||
rstime_t mLastSaveTime ;
|
||||
|
||||
// The following is used to estimate hashing speed.
|
||||
|
||||
|
@ -171,7 +171,7 @@ int p3FileDatabase::tick()
|
||||
tickRecv() ;
|
||||
tickSend() ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// cleanup
|
||||
// - remove/delete shared file lists for people who are not friend anymore
|
||||
@ -183,7 +183,7 @@ int p3FileDatabase::tick()
|
||||
mLastCleanupTime = now ;
|
||||
}
|
||||
|
||||
static time_t last_print_time = 0;
|
||||
static rstime_t last_print_time = 0;
|
||||
|
||||
if(last_print_time + 20 < now)
|
||||
{
|
||||
@ -604,15 +604,15 @@ void p3FileDatabase::cleanup()
|
||||
for(std::list<RsPeerId>::const_iterator it(friend_lst.begin());it!=friend_lst.end();++it)
|
||||
friend_set.insert(*it) ;
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(uint32_t i=0;i<mRemoteDirectories.size();++i)
|
||||
if(mRemoteDirectories[i] != NULL)
|
||||
{
|
||||
time_t recurs_mod_time ;
|
||||
rstime_t recurs_mod_time ;
|
||||
mRemoteDirectories[i]->getDirectoryRecursModTime(0,recurs_mod_time) ;
|
||||
|
||||
time_t last_contact = 0 ;
|
||||
rstime_t last_contact = 0 ;
|
||||
RsPeerDetails pd ;
|
||||
if(rsPeers->getPeerDetails(mRemoteDirectories[i]->peerId(),pd))
|
||||
last_contact = pd.lastConnect ;
|
||||
@ -779,10 +779,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<4>(const void *p, Ent
|
||||
{
|
||||
// trust me, I can do this ;-)
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
e = EntryIndex( *reinterpret_cast<uint32_t*>(&p) & ENTRY_INDEX_BIT_MASK_32BITS ) ;
|
||||
friend_index = (*reinterpret_cast<uint32_t*>(&p)) >> NB_ENTRY_INDEX_BITS_32BITS ;
|
||||
#pragma GCC diagnostic pop
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
if(friend_index == 0)
|
||||
{
|
||||
@ -819,10 +823,14 @@ template<> bool p3FileDatabase::convertPointerToEntryIndex<8>(const void *p, Ent
|
||||
{
|
||||
// trust me, I can do this ;-)
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
e = EntryIndex( *reinterpret_cast<uint64_t*>(&p) & ENTRY_INDEX_BIT_MASK_64BITS ) ;
|
||||
friend_index = (*reinterpret_cast<uint64_t*>(&p)) >> NB_ENTRY_INDEX_BITS_64BITS ;
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
if(friend_index == 0)
|
||||
{
|
||||
@ -976,7 +984,7 @@ void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIn
|
||||
{
|
||||
// update the cache of extra files if last requested too long ago
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mLastExtraFilesCacheUpdate + DELAY_BETWEEN_EXTRA_FILES_CACHE_UPDATES <= now)
|
||||
{
|
||||
@ -1184,16 +1192,6 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags
|
||||
return true;
|
||||
}
|
||||
|
||||
int p3FileDatabase::RequestDirDetails(const RsPeerId &/*uid*/, const std::string &/*path*/, DirDetails &/*details*/) const
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
//int p3FileDatabase::RequestDirDetails(const std::string& path, DirDetails &details) const
|
||||
//{
|
||||
// NOT_IMPLEMENTED();
|
||||
// return 0;
|
||||
//}
|
||||
uint32_t p3FileDatabase::getType(void *ref,FileSearchFlags flags) const
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
@ -1627,7 +1625,7 @@ void p3FileDatabase::handleDirSyncRequest(RsFileListsSyncRequestItem *item)
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t local_recurs_max_time ;
|
||||
rstime_t local_recurs_max_time ;
|
||||
mLocalSharedDirs->getDirectoryRecursModTime(entry_index,local_recurs_max_time) ;
|
||||
|
||||
if(item->last_known_recurs_modf_TS != local_recurs_max_time) // normally, should be "<", but since we provided the TS it should be equal, so != is more robust.
|
||||
@ -1792,7 +1790,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
sitem = item ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// check the hash. If anything goes wrong (in the chunking for instance) the hash will not match
|
||||
|
||||
@ -1899,7 +1897,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
|
||||
void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *rds,DirectoryStorage::EntryIndex e,int depth)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
//std::string indent(2*depth,' ') ;
|
||||
|
||||
@ -1912,7 +1910,7 @@ void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *r
|
||||
P3FILELISTS_DEBUG() << "currently at entry index " << e << std::endl;
|
||||
#endif
|
||||
|
||||
time_t local_update_TS;
|
||||
rstime_t local_update_TS;
|
||||
|
||||
if(!rds->getDirectoryUpdateTime(e,local_update_TS))
|
||||
{
|
||||
@ -1959,9 +1957,9 @@ p3FileDatabase::DirSyncRequestId p3FileDatabase::makeDirSyncReqId(const RsPeerId
|
||||
bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *rds,const DirectoryStorage::EntryIndex& e)
|
||||
{
|
||||
RsFileHash entry_hash ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
time_t max_known_recurs_modf_time ;
|
||||
rstime_t max_known_recurs_modf_time ;
|
||||
|
||||
if(!rds->getDirectoryRecursModTime(e,max_known_recurs_modf_time))
|
||||
{
|
||||
@ -2027,11 +2025,11 @@ bool p3FileDatabase::banFile(const RsFileHash& real_file_hash, const std::string
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
BannedFileEntry& entry(mPrimaryBanList[real_file_hash]) ; // primary list (user controlled) of files banned from FT search and forwarding. map<real hash, BannedFileEntry>
|
||||
|
||||
if(entry.ban_time_stamp == 0)
|
||||
if(entry.mBanTimeStamp == 0)
|
||||
{
|
||||
entry.filename = filename ;
|
||||
entry.size = file_size ;
|
||||
entry.ban_time_stamp = time(NULL);
|
||||
entry.mFilename = filename ;
|
||||
entry.mSize = file_size ;
|
||||
entry.mBanTimeStamp = time(NULL);
|
||||
|
||||
RsFileHash hash_of_hash ;
|
||||
ftServer::encryptHash(real_file_hash,hash_of_hash) ;
|
||||
@ -2118,7 +2116,7 @@ void p3FileDatabase::checkSendBannedFilesInfo()
|
||||
P3FILELISTS_DEBUG() << " Checking banned files information: " << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::list<RsPeerId> online_friends ;
|
||||
rsPeers->getOnlineList(online_friends);
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "ft/ftextralist.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "services/p3service.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
|
||||
@ -71,7 +71,7 @@ struct PeerBannedFilesEntry
|
||||
{
|
||||
std::set<RsFileHash> mBannedHashOfHash;
|
||||
uint32_t mSessionId ; // used for when a friend sends multiple packets in separate items.
|
||||
time_t mLastSent;
|
||||
rstime_t mLastSent;
|
||||
};
|
||||
|
||||
class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, public RsSharedFileService
|
||||
@ -246,11 +246,11 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
struct DirSyncRequestData
|
||||
{
|
||||
RsPeerId peer_id ;
|
||||
time_t request_TS ;
|
||||
rstime_t request_TS ;
|
||||
uint32_t flags ;
|
||||
};
|
||||
|
||||
time_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
rstime_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
std::map<DirSyncRequestId,DirSyncRequestData> mPendingSyncRequests ; // pending requests, waiting for an answer
|
||||
std::map<DirSyncRequestId,RsFileListsSyncResponseItem *> mPartialResponseItems;
|
||||
|
||||
@ -265,8 +265,8 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
mutable RsMutex mFLSMtx ;
|
||||
uint32_t mUpdateFlags ;
|
||||
std::string mFileSharingDir ;
|
||||
time_t mLastCleanupTime;
|
||||
time_t mLastDataRecvTS ;
|
||||
rstime_t mLastCleanupTime;
|
||||
rstime_t mLastDataRecvTS ;
|
||||
|
||||
// File filtering. Not explicitly related to shared files, but has its place here
|
||||
//
|
||||
@ -275,10 +275,10 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
std::map<RsPeerId,PeerBannedFilesEntry> mPeerBannedFiles ; // records of which files other peers ban, stored as H(H(f))
|
||||
std::set<RsFileHash> mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends.
|
||||
mutable std::vector<FileInfo> mExtraFilesCache; // cache for extra files, to avoid requesting them too often.
|
||||
mutable time_t mLastExtraFilesCacheUpdate ;
|
||||
mutable rstime_t mLastExtraFilesCacheUpdate ;
|
||||
bool mTrustFriendNodesForBannedFiles ;
|
||||
bool mBannedFileListNeedsUpdate;
|
||||
time_t mLastPrimaryBanListChangeTimeStamp;
|
||||
rstime_t mLastPrimaryBanListChangeTimeStamp;
|
||||
|
||||
void locked_sendBanInfo(const RsPeerId& pid);
|
||||
void handleBannedFilesInfo(RsFileListsBannedHashesItem *item);
|
||||
|
@ -50,12 +50,7 @@ void RsFileListsBannedHashesConfigItem::serial_process(RsGenericSerializer::Seri
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,primary_banned_files_list,"primary_banned_files_list") ;
|
||||
}
|
||||
template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx,BannedFileEntry& entry,const std::string& /*name*/)
|
||||
{
|
||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,entry.filename ,"entry.file_name") ;
|
||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx, entry.size ,"entry.size") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx, entry.ban_time_stamp,"entry.ban_time_stamp") ;
|
||||
}
|
||||
|
||||
RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const
|
||||
{
|
||||
if(service != RS_SERVICE_TYPE_FILE_DATABASE)
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "ftchunkmap.h"
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
static const uint32_t SOURCE_CHUNK_MAP_UPDATE_PERIOD = 60 ; //! TTL for chunkmap info
|
||||
static const uint32_t INACTIVE_CHUNK_TIME_LAPSE = 3600 ; //! TTL for an inactive chunk
|
||||
@ -264,7 +264,7 @@ bool ChunkMap::reAskPendingChunk( const RsPeerId& peer_id,
|
||||
if(_map[i] == FileChunksInfo::CHUNK_OUTSTANDING)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<uint32_t,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();++it)
|
||||
for(std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo >::iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
@ -400,7 +400,7 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
void ChunkMap::removeInactiveChunks(std::vector<ftChunk::OffsetInFile>& to_remove)
|
||||
{
|
||||
to_remove.clear() ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<ChunkNumber,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();)
|
||||
if(now - it->second._last_data_received > (int)INACTIVE_CHUNK_TIME_LAPSE)
|
||||
@ -573,7 +573,7 @@ uint32_t ChunkMap::getAvailableChunk(const RsPeerId& peer_id,bool& map_is_too_ol
|
||||
// useful to get a new map that will also be full, but because we need to be careful not to mislead information,
|
||||
// we still keep asking.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if((!peer_chunks->is_full) && ((int)now - (int)peer_chunks->TS > (int)SOURCE_CHUNK_MAP_UPDATE_PERIOD))
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ class ftChunk
|
||||
uint64_t offset; // current offset of the slice
|
||||
uint64_t size; // size remaining to download
|
||||
OffsetInFile id ; // id of the chunk. Equal to the starting offset of the chunk
|
||||
time_t ts; // time of last data received
|
||||
rstime_t ts; // time of last data received
|
||||
int *ref_cnt; // shared counter of number of sub-blocks. Used when a slice gets split.
|
||||
RsPeerId peer_id ;
|
||||
};
|
||||
@ -98,20 +98,20 @@ struct ChunkDownloadInfo
|
||||
struct SliceRequestInfo
|
||||
{
|
||||
uint32_t size ; // size of the slice
|
||||
time_t request_time ; // last request time
|
||||
rstime_t request_time ; // last request time
|
||||
std::set<RsPeerId> peers ; // peers the slice was requested to. Normally only one, except at the end of the file.
|
||||
};
|
||||
|
||||
std::map<ftChunk::OffsetInFile,SliceRequestInfo> _slices ;
|
||||
uint32_t _remains ;
|
||||
time_t _last_data_received ;
|
||||
rstime_t _last_data_received ;
|
||||
};
|
||||
|
||||
class SourceChunksInfo
|
||||
{
|
||||
public:
|
||||
CompressedChunkMap cmap ; //! map of what the peer has/doens't have
|
||||
time_t TS ; //! last update time for this info
|
||||
rstime_t TS ; //! last update time for this info
|
||||
bool is_full ; //! is the map full ? In such a case, re-asking for it is unnecessary.
|
||||
|
||||
// Returns true if the offset is starting in a mapped chunk.
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "rsitems/rsconfigitems.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define CONTROL_DEBUG 1
|
||||
@ -226,7 +226,7 @@ void ftController::data_tick()
|
||||
doPending = (mFtActive) && (!mFtPendingDone);
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
if(now > last_save_time + SAVE_TRANSFERS_DELAY)
|
||||
{
|
||||
IndicateConfigChanged() ;
|
||||
@ -421,11 +421,11 @@ void ftController::checkDownloadQueue()
|
||||
|
||||
// Check for inactive transfers, and queued transfers with online sources.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsFileHash,ftFileControl*>::const_iterator it(mDownloads.begin());it!=mDownloads.end() ;++it)
|
||||
if( it->second->mState != ftFileControl::QUEUED && (it->second->mState == ftFileControl::PAUSED
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (time_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (rstime_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
{
|
||||
inactive_transfers.push_back(it->second) ;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class ftFileControl
|
||||
RsFileHash mHash;
|
||||
uint64_t mSize;
|
||||
TransferRequestFlags mFlags;
|
||||
time_t mCreateTime;
|
||||
rstime_t mCreateTime;
|
||||
uint32_t mQueuePriority ;
|
||||
uint32_t mQueuePosition ;
|
||||
};
|
||||
@ -226,8 +226,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
||||
bool setPeerState(ftTransferModule *tm, const RsPeerId& id,
|
||||
uint32_t maxrate, bool online);
|
||||
|
||||
time_t last_save_time ;
|
||||
time_t last_clean_time ;
|
||||
rstime_t last_save_time ;
|
||||
rstime_t last_clean_time ;
|
||||
/* pointers to other components */
|
||||
|
||||
ftSearch *mSearch;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsmemory.h"
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/* For Thread Behaviour */
|
||||
const uint32_t DMULTIPLEX_MIN = 10; /* 10 msec sleep */
|
||||
@ -452,7 +452,7 @@ bool ftDataMultiplex::recvSingleChunkCRC(const RsPeerId& peerId, const RsFileHas
|
||||
// remove this chunk from the request list as well.
|
||||
|
||||
Sha1CacheEntry& sha1cache(_cached_sha1maps[hash]) ;
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
|
||||
if(it2 != sha1cache._to_ask.end())
|
||||
sha1cache._to_ask.erase(it2) ;
|
||||
@ -943,7 +943,7 @@ bool ftDataMultiplex::sendSingleChunkCRCRequests(const RsFileHash& hash, const s
|
||||
|
||||
for(uint32_t i=0;i<to_ask.size();++i)
|
||||
{
|
||||
std::pair<time_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
std::pair<rstime_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
list.first = 0 ; // set last request time to 0
|
||||
}
|
||||
return true ;
|
||||
@ -953,7 +953,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
{
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uint32_t n=0 ;
|
||||
|
||||
// Go through the list of currently handled hashes. For each of them,
|
||||
@ -966,7 +966,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
for(std::map<RsFileHash,Sha1CacheEntry>::iterator it(_cached_sha1maps.begin());it!=_cached_sha1maps.end();++it)
|
||||
for(std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
for(std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
if(it2->second.first + MAX_CHECKING_CHUNK_WAIT_DELAY < now) // is the last request old enough?
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
@ -986,14 +986,14 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
RsPeerId best_source ;
|
||||
time_t oldest_timestamp = now ;
|
||||
rstime_t oldest_timestamp = now ;
|
||||
|
||||
for(uint32_t i=0;i<sources.size();++i)
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
std::cerr << "ftDataMultiplex::handlePendingCrcRequests(): Examining source " << sources[i] << std::endl;
|
||||
#endif
|
||||
std::map<RsPeerId,time_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
std::map<RsPeerId,rstime_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
|
||||
if(it3 == it2->second.second.end()) // source not found. So this one is surely the oldest one to have been requested.
|
||||
{
|
||||
@ -1044,7 +1044,7 @@ void ftDataMultiplex::deleteUnusedServers()
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
//scan the uploads list in ftdatamultiplex and delete the items which time out
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<RsFileHash, ftFileProvider *>::iterator sit(mServers.begin());sit != mServers.end();)
|
||||
if(sit->second->purgeOldPeers(now,10))
|
||||
|
@ -74,15 +74,15 @@ class ftRequest
|
||||
void *mData;
|
||||
};
|
||||
|
||||
typedef std::map<RsPeerId,time_t> ChunkCheckSumSourceList ;
|
||||
typedef std::map<RsPeerId,rstime_t> ChunkCheckSumSourceList ;
|
||||
|
||||
class Sha1CacheEntry
|
||||
{
|
||||
public:
|
||||
Sha1Map _map ; // Map of available sha1 sums for every chunk.
|
||||
time_t last_activity ; // This is used for removing unused entries.
|
||||
rstime_t last_activity ; // This is used for removing unused entries.
|
||||
std::vector<uint32_t> _received ; // received chunk ids. To bedispatched.
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
};
|
||||
|
||||
class ftDataMultiplex: public ftDataRecv, public RsQueueThread
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "util/rstime.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define DEBUG_ELIST 1
|
||||
@ -49,7 +49,7 @@ ftExtraList::ftExtraList()
|
||||
void ftExtraList::data_tick()
|
||||
{
|
||||
bool todo = false;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
{
|
||||
RsStackMutex stack(extMutex);
|
||||
@ -229,12 +229,12 @@ bool ftExtraList::cleanupOldFiles()
|
||||
|
||||
RS_STACK_MUTEX(extMutex);
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::list<RsFileHash> toRemove;
|
||||
|
||||
for( std::map<RsFileHash, FileDetails>::iterator it = mFiles.begin(); it != mFiles.end(); ++it) /* check timestamps */
|
||||
if ((time_t)it->second.info.age < now)
|
||||
if ((rstime_t)it->second.info.age < now)
|
||||
toRemove.push_back(it->first);
|
||||
|
||||
if (toRemove.size() > 0)
|
||||
@ -450,7 +450,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
@ -475,7 +475,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
fclose(fd);
|
||||
fd = NULL ;
|
||||
|
||||
if (ts > (time_t)fi->file.age)
|
||||
if (ts > (rstime_t)fi->file.age)
|
||||
{
|
||||
/* to old */
|
||||
cleanupEntry(fi->file.path, TransferRequestFlags(fi->flags));
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class FileDetails
|
||||
{
|
||||
@ -177,7 +178,7 @@ private:
|
||||
std::map<RsFileHash, FileDetails> mFiles;
|
||||
std::map<RsFileHash, RsFileHash> mHashOfHash; /* sha1(hash) map so as to answer requests to encrypted transfers */
|
||||
|
||||
time_t cleanup ;
|
||||
rstime_t cleanup ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ftfilecreator.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <sys/stat.h>
|
||||
#include <util/rsdiscspace.h>
|
||||
#include <util/rsdir.h>
|
||||
@ -63,7 +63,7 @@ ftFileCreator::ftFileCreator(const std::string& path, uint64_t size, const RsFil
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
_creation_time = now ;
|
||||
|
||||
struct stat64 buf;
|
||||
@ -143,12 +143,12 @@ bool ftFileCreator::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32_
|
||||
return false ;
|
||||
}
|
||||
|
||||
time_t ftFileCreator::creationTimeStamp()
|
||||
rstime_t ftFileCreator::creationTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _creation_time ;
|
||||
}
|
||||
time_t ftFileCreator::lastRecvTimeStamp()
|
||||
rstime_t ftFileCreator::lastRecvTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _last_recv_time_t ;
|
||||
@ -520,7 +520,7 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
|
||||
locked_printChunkMap();
|
||||
#endif
|
||||
source_chunk_map_needed = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 0 - is there a faulting chunk that would need to be asked again ?
|
||||
|
||||
|
@ -103,8 +103,8 @@ class ftFileCreator: public ftFileProvider
|
||||
void getSourcesList(uint32_t chunk_number,std::vector<RsPeerId>& sources) ;
|
||||
|
||||
// Returns resets the time stamp of the last data receive.
|
||||
time_t lastRecvTimeStamp() ;
|
||||
time_t creationTimeStamp() ;
|
||||
rstime_t lastRecvTimeStamp() ;
|
||||
rstime_t creationTimeStamp() ;
|
||||
|
||||
// actually store data in the file, and update chunks info
|
||||
//
|
||||
@ -144,8 +144,8 @@ class ftFileCreator: public ftFileProvider
|
||||
|
||||
ChunkMap chunkMap ;
|
||||
|
||||
time_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
time_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
rstime_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
rstime_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
};
|
||||
|
||||
#endif // FT_FILE_CREATOR_HEADER
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/********
|
||||
* #define DEBUG_FT_FILE_PROVIDER 1
|
||||
@ -41,7 +41,7 @@
|
||||
#include <iomanip>
|
||||
#endif
|
||||
|
||||
static const time_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
static const rstime_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
|
||||
ftFileProvider::ftFileProvider(const std::string& path, uint64_t size, const RsFileHash& hash)
|
||||
: mSize(size), hash(hash), file_name(path), fd(NULL), ftcMutex("ftFileProvider")
|
||||
@ -122,7 +122,7 @@ bool ftFileProvider::FileDetails(FileInfo &info)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftFileProvider::purgeOldPeers(time_t now,uint32_t max_duration)
|
||||
bool ftFileProvider::purgeOldPeers(rstime_t now,uint32_t max_duration)
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -232,7 +232,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
|
||||
// This creates the peer info, and updates it.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uploading_peers[peer_id].updateStatus(offset,data_size,now) ;
|
||||
|
||||
#ifdef DEBUG_TRANSFERS
|
||||
@ -254,7 +254,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,time_t now)
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,rstime_t now)
|
||||
{
|
||||
lastTS = now ;
|
||||
long int diff = (long int)now - (long int)lastTS_t ; // in bytes/s. Average over multiple samples
|
||||
@ -293,7 +293,7 @@ void ftFileProvider::getClientMap(const RsPeerId& peer_id,CompressedChunkMap& cm
|
||||
|
||||
PeerUploadInfo& pui(uploading_peers[peer_id]) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now - pui.client_chunk_map_stamp > UPLOAD_CHUNK_MAPS_TIME)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ class ftFileProvider
|
||||
|
||||
// Removes inactive peers from the client list. Returns true if all peers have been removed.
|
||||
//
|
||||
bool purgeOldPeers(time_t now,uint32_t max_duration) ;
|
||||
bool purgeOldPeers(rstime_t now,uint32_t max_duration) ;
|
||||
|
||||
const RsFileHash& fileHash() const { return hash ; }
|
||||
const std::string& fileName() const { return file_name ; }
|
||||
@ -88,12 +88,12 @@ class ftFileProvider
|
||||
PeerUploadInfo()
|
||||
: req_loc(0),req_size(1), lastTS_t(0), lastTS(0),transfer_rate(0), total_size(0), client_chunk_map_stamp(0) {}
|
||||
|
||||
void updateStatus(uint64_t offset,uint32_t data_size,time_t now) ;
|
||||
void updateStatus(uint64_t offset,uint32_t data_size,rstime_t now) ;
|
||||
|
||||
uint64_t req_loc;
|
||||
uint32_t req_size;
|
||||
time_t lastTS_t; // used for estimating transfer rate.
|
||||
time_t lastTS; // last update time (for purging)
|
||||
rstime_t lastTS_t; // used for estimating transfer rate.
|
||||
rstime_t lastTS; // last update time (for purging)
|
||||
|
||||
// these two are used for speed estimation
|
||||
float transfer_rate ;
|
||||
@ -101,7 +101,7 @@ class ftFileProvider
|
||||
|
||||
// Info about what the downloading peer already has
|
||||
CompressedChunkMap client_chunk_map ;
|
||||
time_t client_chunk_map_stamp ;
|
||||
rstime_t client_chunk_map_stamp ;
|
||||
};
|
||||
|
||||
// Contains statistics (speed, peer name, etc.) of all uploading peers for that file.
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "util/rsprint.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/***
|
||||
* #define SERVER_DEBUG 1
|
||||
@ -62,8 +62,8 @@
|
||||
#define FTSERVER_DEBUG() std::cerr << time(NULL) << " : FILE_SERVER : " << __FUNCTION__ << " : "
|
||||
#define FTSERVER_ERROR() std::cerr << "(EE) FILE_SERVER ERROR : "
|
||||
|
||||
static const time_t FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD = 5 ; // low priority tasks handling every 5 seconds
|
||||
static const time_t FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD = 10 ; // keep usage records for 10 secs at most.
|
||||
static const rstime_t FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD = 5 ; // low priority tasks handling every 5 seconds
|
||||
static const rstime_t FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD = 10 ; // keep usage records for 10 secs at most.
|
||||
|
||||
/* Setup */
|
||||
ftServer::ftServer(p3PeerMgr *pm, p3ServiceControl *sc)
|
||||
@ -702,19 +702,20 @@ bool ftServer::ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t
|
||||
/******************** Directory Listing ************************/
|
||||
/***************************************************************/
|
||||
|
||||
int ftServer::RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details)
|
||||
{
|
||||
return mFileDatabase->RequestDirDetails(uid, path, details);
|
||||
}
|
||||
|
||||
bool ftServer::findChildPointer(void *ref, int row, void *& result, FileSearchFlags flags)
|
||||
{
|
||||
return mFileDatabase->findChildPointer(ref,row,result,flags) ;
|
||||
}
|
||||
|
||||
bool ftServer::requestDirDetails(
|
||||
DirDetails &details, std::uintptr_t handle, FileSearchFlags flags )
|
||||
{ return RequestDirDetails(reinterpret_cast<void*>(handle), details, flags); }
|
||||
|
||||
int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags)
|
||||
{
|
||||
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
||||
}
|
||||
|
||||
uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
||||
{
|
||||
return mFileDatabase->getType(ref,flags) ;
|
||||
@ -1625,8 +1626,8 @@ int ftServer::tick()
|
||||
if(handleIncoming())
|
||||
moreToTick = true;
|
||||
|
||||
static time_t last_law_priority_tasks_handling_time = 0 ;
|
||||
time_t now = time(NULL) ;
|
||||
static rstime_t last_law_priority_tasks_handling_time = 0 ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(last_law_priority_tasks_handling_time + FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD < now)
|
||||
{
|
||||
@ -1666,10 +1667,10 @@ bool ftServer::checkUploadLimit(const RsPeerId& pid,const RsFileHash& hash)
|
||||
|
||||
// Find the latest records for this pid.
|
||||
|
||||
std::map<RsFileHash,time_t>& tmap(mUploadLimitMap[pid]) ;
|
||||
std::map<RsFileHash,time_t>::iterator it ;
|
||||
std::map<RsFileHash,rstime_t>& tmap(mUploadLimitMap[pid]) ;
|
||||
std::map<RsFileHash,rstime_t>::iterator it ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// If the limit has been decresed, we arbitrarily drop some ongoing slots.
|
||||
|
||||
@ -1694,7 +1695,7 @@ bool ftServer::checkUploadLimit(const RsPeerId& pid,const RsFileHash& hash)
|
||||
for(it = tmap.begin();it!=tmap.end() && cleaned<2;)
|
||||
if(it->second + FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD < now)
|
||||
{
|
||||
std::map<RsFileHash,time_t>::iterator tmp(it) ;
|
||||
std::map<RsFileHash,rstime_t>::iterator tmp(it) ;
|
||||
++tmp;
|
||||
tmap.erase(it) ;
|
||||
it = tmp;
|
||||
@ -1859,7 +1860,7 @@ bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr)
|
||||
bool ftServer::turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const std::list<TurtleFileInfo>& results)>& multiCallback,
|
||||
std::time_t maxWait )
|
||||
rstime_t maxWait )
|
||||
{
|
||||
if(matchString.empty())
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
virtual bool turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const std::list<TurtleFileInfo>& results)>& multiCallback,
|
||||
std::time_t maxWait = 300 );
|
||||
rstime_t maxWait = 300 );
|
||||
|
||||
virtual TurtleSearchRequestId turtleSearch(const std::string& string_to_match) ;
|
||||
virtual TurtleSearchRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ;
|
||||
@ -189,8 +189,13 @@ public:
|
||||
/***
|
||||
* Directory Listing / Search Interface
|
||||
***/
|
||||
virtual int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details);
|
||||
virtual int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags);
|
||||
|
||||
/// @see RsFiles::RequestDirDetails
|
||||
virtual bool requestDirDetails(
|
||||
DirDetails &details, std::uintptr_t handle = 0,
|
||||
FileSearchFlags flags = RS_FILE_HINTS_LOCAL );
|
||||
|
||||
virtual bool findChildPointer(void *ref, int row, void *& result, FileSearchFlags flags) ;
|
||||
virtual uint32_t getType(void *ref,FileSearchFlags flags) ;
|
||||
|
||||
@ -326,7 +331,7 @@ private:
|
||||
|
||||
std::map<RsFileHash,RsFileHash> mEncryptedHashes ; // This map is such that sha1(it->second) = it->first
|
||||
std::map<RsPeerId,RsFileHash> mEncryptedPeerIds ; // This map holds the hash to be used with each peer id
|
||||
std::map<RsPeerId,std::map<RsFileHash,time_t> > mUploadLimitMap ;
|
||||
std::map<RsPeerId,std::map<RsFileHash,rstime_t> > mUploadLimitMap ;
|
||||
|
||||
/** Store search callbacks with timeout*/
|
||||
std::map<
|
||||
|
@ -23,7 +23,7 @@
|
||||
* #define FT_DEBUG 1
|
||||
*****/
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include "fttransfermodule.h"
|
||||
@ -285,7 +285,7 @@ void ftTransferModule::resetActvTimeStamp()
|
||||
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
|
||||
_last_activity_time_stamp = time(NULL);
|
||||
}
|
||||
time_t ftTransferModule::lastActvTimeStamp()
|
||||
rstime_t ftTransferModule::lastActvTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
|
||||
return _last_activity_time_stamp ;
|
||||
@ -693,7 +693,7 @@ void ftTransferModule::adjustSpeed()
|
||||
bool ftTransferModule::locked_tickPeerTransfer(peerInfo &info)
|
||||
{
|
||||
/* how long has it been? */
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
|
||||
int ageRecv = ts - info.recvTS;
|
||||
int ageReq = ts - info.lastTS;
|
||||
@ -865,7 +865,7 @@ bool ftTransferModule::locked_recvPeerData(peerInfo &info, uint64_t offset, uint
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
info.recvTS = ts;
|
||||
info.nResets = 0;
|
||||
info.state = PQIPEER_DOWNLOADING;
|
||||
|
@ -76,15 +76,15 @@ public:
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
|
||||
time_t lastTS; /* last Request */
|
||||
time_t recvTS; /* last Recv */
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
|
||||
/* rrt rate control */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
time_t rttStart; /* ts of request */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate */
|
||||
};
|
||||
@ -156,7 +156,7 @@ public:
|
||||
void setDownloadPriority(DwlSpeed p) { mPriority =p ; }
|
||||
|
||||
// read/reset the last time the transfer module was active (either wrote data, or was solicitaded by clients)
|
||||
time_t lastActvTimeStamp() ;
|
||||
rstime_t lastActvTimeStamp() ;
|
||||
void resetActvTimeStamp() ;
|
||||
|
||||
private:
|
||||
@ -185,7 +185,7 @@ private:
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
|
||||
time_t _last_activity_time_stamp ;
|
||||
rstime_t _last_activity_time_stamp ;
|
||||
|
||||
ftFileStatus mFileStatus; //used for pause/resume file transfer
|
||||
|
||||
|
@ -50,7 +50,7 @@ class GRouterCacheInfo
|
||||
{
|
||||
public:
|
||||
GRouterCacheInfoFlags flags ;
|
||||
time_t last_activity ;
|
||||
rstime_t last_activity ;
|
||||
};
|
||||
|
||||
class GRouterCache
|
||||
|
@ -144,10 +144,10 @@ void RsGRouterRoutingInfoItem::serial_process(RsGenericSerializer::SerializeJob
|
||||
RsTypeSerializer::serial_process (j,ctx,peerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,data_status,"data_status") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_status,"tunnel_status") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,received_time_TS,"received_time_TS") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,last_sent_TS,"last_sent_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,received_time_TS,"received_time_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,last_sent_TS,"last_sent_TS") ;
|
||||
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,last_tunnel_request_TS,"last_tunnel_request_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,last_tunnel_request_TS,"last_tunnel_request_TS") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,sending_attempts,"sending_attempts") ;
|
||||
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,client_id,"client_id") ;
|
||||
@ -215,7 +215,7 @@ void RsGRouterMatrixTrackItem::serial_process(RsGenericSerializer::SerializeJob
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,provider_id,"provider_id") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,message_id,"message_id") ;
|
||||
RsTypeSerializer::serial_process<time_t>(j,ctx,time_stamp,"time_stamp") ;
|
||||
RsTypeSerializer::serial_process<rstime_t>(j,ctx,time_stamp,"time_stamp") ;
|
||||
}
|
||||
|
||||
void RsGRouterMatrixCluesItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
@ -228,7 +228,7 @@ template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJ
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,s.friend_id,name+":friend_id") ;
|
||||
RsTypeSerializer::serial_process<float> (j,ctx,s.weight,name+":weight") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,s.time_stamp,name+":time_stamp") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,s.time_stamp,name+":time_stamp") ;
|
||||
}
|
||||
|
||||
RsGRouterGenericDataItem *RsGRouterGenericDataItem::duplicate() const
|
||||
|
@ -224,7 +224,7 @@ class RsGRouterMatrixTrackItem: public RsGRouterItem
|
||||
//
|
||||
RsGxsMessageId message_id ;
|
||||
RsPeerId provider_id ;
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
class RsGRouterMatrixFriendListItem: public RsGRouterItem
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ GRouterMatrix::GRouterMatrix()
|
||||
|
||||
bool GRouterMatrix::addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& source_friend)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RoutingTrackEntry rte ;
|
||||
|
||||
@ -57,7 +57,7 @@ bool GRouterMatrix::cleanUp()
|
||||
#ifdef ROUTING_MATRIX_DEBUG
|
||||
std::cerr << "GRouterMatrix::cleanup()" << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsGxsMessageId,RoutingTrackEntry>::iterator it(_tracking_clues.begin());it!=_tracking_clues.end();)
|
||||
if(it->second.time_stamp + RS_GROUTER_MAX_KEEP_TRACKING_CLUES < now)
|
||||
@ -84,7 +84,7 @@ bool GRouterMatrix::addRoutingClue(const GRouterKeyId& key_id,const RsPeerId& so
|
||||
|
||||
// 2 - get the Key map, and add the routing clue.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RoutingMatrixHitEntry rc ;
|
||||
rc.weight = weight ;
|
||||
@ -179,7 +179,7 @@ void GRouterMatrix::debugDump() const
|
||||
std::cerr << " Proba needs up: " << _proba_need_updating << std::endl;
|
||||
std::cerr << " Known keys: " << _time_combined_hits.size() << std::endl;
|
||||
std::cerr << " Routing events: " << std::endl;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
||||
{
|
||||
@ -209,7 +209,7 @@ bool GRouterMatrix::computeRoutingProbabilities(const GRouterKeyId& key_id, cons
|
||||
{
|
||||
// Routing probabilities are computed according to routing clues
|
||||
//
|
||||
// For a given key, each friend has a known set of routing clues (time_t, weight)
|
||||
// For a given key, each friend has a known set of routing clues (rstime_t, weight)
|
||||
// We combine these to compute a static weight for each friend/key pair.
|
||||
// This is performed in updateRoutingProbabilities()
|
||||
//
|
||||
@ -271,7 +271,7 @@ bool GRouterMatrix::updateRoutingProbabilities()
|
||||
if(!_proba_need_updating)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
||||
{
|
||||
|
@ -39,13 +39,13 @@ struct RoutingMatrixHitEntry
|
||||
{
|
||||
uint32_t friend_id ; // not the full key. Gets too big otherwise!
|
||||
float weight ;
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
|
||||
struct RoutingTrackEntry
|
||||
{
|
||||
RsPeerId friend_id ; // not the full key. Gets too big otherwise!
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
|
||||
class GRouterMatrix
|
||||
|
@ -22,7 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <list>
|
||||
#include "pgp/rscertificate.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
@ -56,9 +56,9 @@ static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // cl
|
||||
static const uint32_t GROUTER_MAX_DUPLICATION_FACTOR = 10 ; // max number of duplicates for a given message to keep in the network
|
||||
static const uint32_t GROUTER_MAX_BRANCHING_FACTOR = 3 ; // max number of branches, for locally forwarding items
|
||||
|
||||
static const time_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
||||
static const time_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 60*10 ; // Check for key advertising every 10 minutes
|
||||
static const rstime_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
||||
static const rstime_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||
static const rstime_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 60*10 ; // Check for key advertising every 10 minutes
|
||||
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 2*86400 ; // Cached items are kept for 48 hours at most.
|
||||
|
||||
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
||||
@ -79,7 +79,7 @@ class FriendTrialRecord
|
||||
{
|
||||
public:
|
||||
RsPeerId friend_id ; // id of the friend
|
||||
time_t time_stamp ; // time of the last tried
|
||||
rstime_t time_stamp ; // time of the last tried
|
||||
float probability ; // probability at which the item was selected
|
||||
uint32_t nb_friends ; // number of friends at the time of sending the item
|
||||
|
||||
@ -108,9 +108,9 @@ public:
|
||||
uint32_t data_status ; // pending, waiting, etc.
|
||||
uint32_t tunnel_status ; // status of tunnel handling.
|
||||
|
||||
time_t received_time_TS ; // time at which the item was originally received
|
||||
time_t last_sent_TS ; // last time the item was sent
|
||||
time_t last_tunnel_request_TS ; // last time tunnels have been asked for this item.
|
||||
rstime_t received_time_TS ; // time at which the item was originally received
|
||||
rstime_t last_sent_TS ; // last time the item was sent
|
||||
rstime_t last_tunnel_request_TS ; // last time tunnels have been asked for this item.
|
||||
uint32_t sending_attempts ; // number of times tunnels have been asked for this peer without success
|
||||
|
||||
GRouterServiceId client_id ; // service ID of the client. Only valid when origin==OwnId
|
||||
@ -125,7 +125,7 @@ public:
|
||||
|
||||
// non serialised data
|
||||
|
||||
time_t data_transaction_TS ;
|
||||
rstime_t data_transaction_TS ;
|
||||
|
||||
static const uint32_t ROUTING_FLAGS_ALLOW_TUNNELS = 0x0001;
|
||||
static const uint32_t ROUTING_FLAGS_ALLOW_FRIENDS = 0x0002;
|
||||
|
@ -218,7 +218,7 @@ p3GRouter::p3GRouter(p3ServiceControl *sc, RsGixs *is)
|
||||
|
||||
int p3GRouter::tick()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// Sort incoming service data
|
||||
//
|
||||
@ -555,7 +555,7 @@ void GRouterTunnelInfo::addVirtualPeer(const TurtleVirtualPeerId& vpid)
|
||||
|
||||
virtual_peers.insert(vpid) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(first_tunnel_ok_TS == 0) first_tunnel_ok_TS = now ;
|
||||
last_tunnel_ok_TS = now ;
|
||||
@ -760,7 +760,7 @@ void p3GRouter::handleTunnels()
|
||||
}
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
std::vector<std::pair<int,GRouterRoutingInfo*> > priority_list ;
|
||||
|
||||
for(std::map<GRouterMsgPropagationId, GRouterRoutingInfo>::iterator it=_pending_messages.begin();it!=_pending_messages.end();++it)
|
||||
@ -893,7 +893,7 @@ void p3GRouter::routePendingObjects()
|
||||
// Which tunnels are available is handled by handleTunnels()
|
||||
//
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RS_STACK_MUTEX(grMtx) ;
|
||||
#ifdef GROUTER_DEBUG
|
||||
@ -1220,7 +1220,7 @@ void p3GRouter::locked_collectAvailableFriends(const GRouterKeyId& gxs_id,const
|
||||
|
||||
void p3GRouter::locked_collectAvailableTunnels(const TurtleFileHash& hash,uint32_t total_duplication,std::map<RsPeerId,uint32_t>& tunnel_peers_and_duplication_factors)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// Now go through available virtual peers. Select the ones that are interesting, and set them as potential destinations.
|
||||
|
||||
@ -1304,7 +1304,7 @@ bool p3GRouter::locked_sendTransactionData(const RsPeerId& pid,const RsGRouterTr
|
||||
void p3GRouter::autoWash()
|
||||
{
|
||||
bool items_deleted = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::map<GRouterMsgPropagationId,std::pair<GRouterClientService *,RsGxsId> > failed_msgs ;
|
||||
|
||||
@ -2158,7 +2158,7 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
|
||||
//
|
||||
GRouterRoutingInfo info ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
info.data_item = data_item ;
|
||||
info.receipt_item = NULL ;
|
||||
@ -2368,7 +2368,7 @@ void p3GRouter::debugDump()
|
||||
{
|
||||
RS_STACK_MUTEX(grMtx) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
grouter_debug() << "Full dump of Global Router state: " << std::endl;
|
||||
grouter_debug() << " Owned keys : " << std::endl;
|
||||
|
@ -68,8 +68,8 @@ public:
|
||||
|
||||
std::set<TurtleVirtualPeerId> virtual_peers ;
|
||||
|
||||
time_t first_tunnel_ok_TS ; // timestamp when 1st tunnel was received.
|
||||
time_t last_tunnel_ok_TS ; // timestamp when last tunnel was received.
|
||||
rstime_t first_tunnel_ok_TS ; // timestamp when 1st tunnel was received.
|
||||
rstime_t last_tunnel_ok_TS ; // timestamp when last tunnel was received.
|
||||
};
|
||||
class GRouterDataInfo
|
||||
{
|
||||
@ -87,7 +87,7 @@ public:
|
||||
RsGRouterAbstractMsgItem *addDataChunk(RsGRouterTransactionChunkItem *chunk_item) ;
|
||||
RsGRouterTransactionChunkItem *incoming_data_buffer ;
|
||||
|
||||
time_t last_activity_TS ;
|
||||
rstime_t last_activity_TS ;
|
||||
};
|
||||
|
||||
class p3GRouter: public RsGRouter, public RsTurtleClientService, public p3Service, public p3Config
|
||||
@ -346,10 +346,10 @@ private:
|
||||
bool _changed ;
|
||||
bool _debug_enabled ;
|
||||
|
||||
time_t _last_autowash_time ;
|
||||
time_t _last_matrix_update_time ;
|
||||
time_t _last_debug_output_time ;
|
||||
time_t _last_config_changed ;
|
||||
rstime_t _last_autowash_time ;
|
||||
rstime_t _last_matrix_update_time ;
|
||||
rstime_t _last_debug_output_time ;
|
||||
rstime_t _last_config_changed ;
|
||||
|
||||
uint64_t _random_salt ;
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ class gxp::Paper
|
||||
std::string serialnumber;
|
||||
std::string url;
|
||||
std::list<std::string> authors;
|
||||
time_t date;
|
||||
rstime_t date;
|
||||
uint32_t startpage;
|
||||
uint32_t endpage;
|
||||
std::string language;
|
||||
|
@ -73,7 +73,7 @@ class gixp::profile
|
||||
gxip::keyref mKeyId;
|
||||
|
||||
std::string mName;
|
||||
time_t mTimestamp; /* superseded by newer timestamps */
|
||||
rstime_t mTimestamp; /* superseded by newer timestamps */
|
||||
uint32_t mProfileType; /* ANONYMOUS (no name, self-signed), PSEUDONYM (self-signed), GPG (name=gpgid, gpgsigned), REVOCATION?? */
|
||||
gpp::permissions mPermissions;
|
||||
|
||||
|
@ -157,7 +157,7 @@ class gdp::interface
|
||||
/* query for available groups & messages */
|
||||
int listgroups(std::list<gdb::id> &grpIds);
|
||||
/* response from listmsgs: -1 = invalid parameters, 0 = incomplete list, 1 = all known msgs */
|
||||
int listmsgs(const gdp::id grpId, std::list<gdb::id> &msgIds, const time_t from, const time_t to, const int maxmsgs);
|
||||
int listmsgs(const gdp::id grpId, std::list<gdb::id> &msgIds, const rstime_t from, const rstime_t to, const int maxmsgs);
|
||||
|
||||
/* response from requestMsg: YES (available immediately), RETRIEVING (known to exist),
|
||||
* IN_REQUEST (might exist), NOT_AVAILABLE (still might exist)
|
||||
@ -239,8 +239,8 @@ class gnp::exchange: public gdp::interface
|
||||
/*** IMPLEMENTATION DETAILS ****/
|
||||
|
||||
/* Get/Send Messages */
|
||||
getAvailableMsgs(gdp::id grpId, time_t from, time_t to); /* request over the network */
|
||||
sendAvailableMsgs(std::string peerId, gdp::id grpId, time_t from, time_t to); /* send to peers */
|
||||
getAvailableMsgs(gdp::id grpId, rstime_t from, rstime_t to); /* request over the network */
|
||||
sendAvailableMsgs(std::string peerId, gdp::id grpId, rstime_t from, rstime_t to); /* send to peers */
|
||||
|
||||
requestMessages(std::string peerId, gdp::id grpId, std::list<gdp::id> msgIds);
|
||||
sendMessages(std::string peerId, gdp::id grpId, std::list<gdp::id> msgIds); /* send to peer, obviously permissions have been checked first */
|
||||
@ -284,7 +284,7 @@ class gixp::profile
|
||||
gxip::keyref mKeyId;
|
||||
|
||||
std::string mPseudonym;
|
||||
time_t mTimestamp; /* superseded by newer timestamps */
|
||||
rstime_t mTimestamp; /* superseded by newer timestamps */
|
||||
uint32_t mProfileType; /* ANONYMOUS (no name, self-signed), PSEUDONYM (self-signed), GPG (name=gpgname, gpgsigned), REVOCATION?? */
|
||||
gpp::permissions mPermissions;
|
||||
|
||||
|
@ -954,7 +954,7 @@ void RsDataService::locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta)
|
||||
|
||||
void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
auto it = mGrpMetaDataCache.find(gid) ;
|
||||
|
||||
// We dont actually delete the item, because it might be used by a calling client.
|
||||
|
@ -345,7 +345,7 @@ private:
|
||||
void locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta);
|
||||
|
||||
std::map<RsGxsGroupId,RsGxsGrpMetaData*> mGrpMetaDataCache ;
|
||||
std::list<std::pair<time_t,RsGxsGrpMetaData*> > mOldCachedItems ;
|
||||
std::list<std::pair<rstime_t,RsGxsGrpMetaData*> > mOldCachedItems ;
|
||||
|
||||
bool mGrpMetaDataCache_ContainsAllDatabase ;
|
||||
};
|
||||
|
@ -88,7 +88,7 @@ struct RsGroupNetworkStats
|
||||
uint32_t mMaxVisibleCount;
|
||||
bool mGrpAutoSync;
|
||||
bool mAllowMsgSync;
|
||||
time_t mLastGroupModificationTS;
|
||||
rstime_t mLastGroupModificationTS;
|
||||
};
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;
|
||||
|
@ -124,7 +124,7 @@ RsGenExchange::~RsGenExchange()
|
||||
mGrpsToPublish.clear();
|
||||
}
|
||||
|
||||
bool RsGenExchange::getGroupServerUpdateTS(const RsGxsGroupId& gid, time_t& grp_server_update_TS, time_t& msg_server_update_TS)
|
||||
bool RsGenExchange::getGroupServerUpdateTS(const RsGxsGroupId& gid, rstime_t& grp_server_update_TS, rstime_t& msg_server_update_TS)
|
||||
{
|
||||
return mNetService->getGroupServerUpdateTS(gid,grp_server_update_TS,msg_server_update_TS) ;
|
||||
}
|
||||
@ -169,7 +169,7 @@ void RsGenExchange::tick()
|
||||
// implemented service tick function
|
||||
service_tick();
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if((mLastClean + MSG_CLEANUP_PERIOD < now) || mCleaning)
|
||||
{
|
||||
@ -259,7 +259,7 @@ bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta)
|
||||
|
||||
uint32_t st = mNetService->getKeepAge(meta.mGroupId);
|
||||
|
||||
time_t storageTimeLimit = meta.mPublishTs + st;
|
||||
rstime_t storageTimeLimit = meta.mPublishTs + st;
|
||||
|
||||
return meta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP || st == 0 || storageTimeLimit >= time(NULL);
|
||||
}
|
||||
@ -2140,7 +2140,7 @@ void RsGenExchange::publishMsgs()
|
||||
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// stick back msgs pending signature
|
||||
typedef std::map<uint32_t, GxsPendingItem<RsGxsMsgItem*, uint32_t> > PendSignMap;
|
||||
@ -2561,7 +2561,7 @@ void RsGenExchange::publishGrps()
|
||||
GxsGrpPendingSign& ggps = *vit;
|
||||
|
||||
/* do intial checks to see if this entry has expired */
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uint32_t token = ggps.mToken;
|
||||
|
||||
|
||||
@ -2869,7 +2869,7 @@ void RsGenExchange::processRecvdMessages()
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mMsgPendingValidate.empty())
|
||||
return ;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define RSGENEXCHANGE_H
|
||||
|
||||
#include <queue>
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "rsgxs.h"
|
||||
#include "rsgds.h"
|
||||
@ -39,7 +39,7 @@ template<class GxsItem, typename Identity = std::string>
|
||||
class GxsPendingItem
|
||||
{
|
||||
public:
|
||||
GxsPendingItem(GxsItem item, Identity id,time_t ts) :
|
||||
GxsPendingItem(GxsItem item, Identity id,rstime_t ts) :
|
||||
mItem(item), mId(id), mFirstTryTS(ts)
|
||||
{}
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
|
||||
GxsItem mItem;
|
||||
Identity mId;
|
||||
time_t mFirstTryTS;
|
||||
rstime_t mFirstTryTS;
|
||||
};
|
||||
|
||||
class GxsGrpPendingSign
|
||||
@ -61,7 +61,7 @@ public:
|
||||
mItem(item), mHaveKeys(false), mIsUpdate(false)
|
||||
{}
|
||||
|
||||
time_t mLastAttemptTS, mStartTS;
|
||||
rstime_t mLastAttemptTS, mStartTS;
|
||||
uint32_t mToken;
|
||||
RsGxsGrpItem* mItem;
|
||||
bool mHaveKeys; // mKeys->first == true if key present
|
||||
@ -669,7 +669,7 @@ public:
|
||||
* when needed. Typical use case is forums and circles.
|
||||
* @param gid GroupId the TS is which is requested
|
||||
*/
|
||||
bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
||||
bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) ;
|
||||
|
||||
/*!
|
||||
* \brief getDefaultStoragePeriod. All times in seconds.
|
||||
@ -905,12 +905,12 @@ private:
|
||||
NxsMsgPendingVect mMsgPendingValidate;
|
||||
|
||||
bool mCleaning;
|
||||
time_t mLastClean;
|
||||
rstime_t mLastClean;
|
||||
RsGxsMessageCleanUp* mMsgCleanUp;
|
||||
|
||||
|
||||
bool mChecking, mCheckStarted;
|
||||
time_t mLastCheck;
|
||||
rstime_t mLastCheck;
|
||||
RsGxsIntegrityCheck* mIntegrityCheck;
|
||||
|
||||
protected:
|
||||
|
@ -221,7 +221,7 @@ class RsGcxs
|
||||
|
||||
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) = 0;
|
||||
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) =0;
|
||||
};
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ public:
|
||||
:RsGenExchange(gds,ns,serviceSerialiser,mServType, gixs, authenPolicy) { return; }
|
||||
virtual ~RsGxsCircleExchange() { return; }
|
||||
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS)
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS)
|
||||
{
|
||||
return RsGenExchange::getGroupServerUpdateTS(RsGxsGroupId(gid),grp_server_update_TS,msg_server_update_TS) ;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "rsitems/rsgxsitems.h"
|
||||
|
||||
struct RsGroupMetaData;
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
RsTlvKeySignatureSet signSet;
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
rstime_t mPublishTs;
|
||||
uint32_t mMsgFlags; // used by some services (e.g. by forums to store message moderation flags)
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
@ -119,7 +119,7 @@ public:
|
||||
std::string mServiceString;
|
||||
uint32_t mMsgStatus;
|
||||
uint32_t mMsgSize;
|
||||
time_t mChildTs;
|
||||
rstime_t mChildTs;
|
||||
uint32_t recvTS;
|
||||
RsFileHash mHash;
|
||||
bool validated;
|
||||
|
@ -20,7 +20,7 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "rsgxsutil.h"
|
||||
#include "rsgxsdataaccess.h"
|
||||
@ -317,7 +317,7 @@ RsTokenService::GxsRequestStatus RsGxsDataAccess::requestStatus(uint32_t token)
|
||||
RsTokenService::GxsRequestStatus status;
|
||||
uint32_t reqtype;
|
||||
uint32_t anstype;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mDataMutex);
|
||||
@ -717,7 +717,7 @@ GxsRequest* RsGxsDataAccess::locked_retrieveRequest(const uint32_t& token)
|
||||
void RsGxsDataAccess::processRequests()
|
||||
{
|
||||
std::list<uint32_t> toClear;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::map<uint32_t, GxsRequest*>::iterator it;
|
||||
|
||||
{
|
||||
@ -1124,8 +1124,8 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
||||
std::vector<RsGxsMsgMetaData*>::const_iterator vit = metaV.begin();
|
||||
|
||||
// RUN THROUGH ALL MSGS... in map origId -> TS.
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> >::iterator oit;
|
||||
|
||||
for(; vit != metaV.end(); ++vit)
|
||||
{
|
||||
@ -1402,8 +1402,8 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
if (onlyChildMsgs || onlyThreadMsgs)
|
||||
{
|
||||
// RUN THROUGH ALL MSGS... in map origId -> TS.
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> >::iterator oit;
|
||||
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); ++vit_meta)
|
||||
{
|
||||
|
||||
@ -1472,7 +1472,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
{
|
||||
|
||||
/* first guess is potentially better than Orig (can't be worse!) */
|
||||
time_t latestTs = 0;
|
||||
rstime_t latestTs = 0;
|
||||
RsGxsMessageId latestMsgId;
|
||||
RsGxsMsgMetaData* latestMeta=NULL;
|
||||
|
||||
@ -1760,7 +1760,7 @@ void RsGxsDataAccess::filterGrpList(std::list<RsGxsGroupId> &grpIds, const RsTok
|
||||
|
||||
bool RsGxsDataAccess::checkRequestStatus(
|
||||
uint32_t token, GxsRequestStatus& status, uint32_t& reqtype,
|
||||
uint32_t& anstype, time_t& ts )
|
||||
uint32_t& anstype, rstime_t& ts )
|
||||
{
|
||||
RS_STACK_MUTEX(mDataMutex);
|
||||
|
||||
|
@ -314,7 +314,7 @@ private:
|
||||
* @return false if token does not exist, true otherwise
|
||||
*/
|
||||
bool checkRequestStatus( uint32_t token, GxsRequestStatus &status,
|
||||
uint32_t &reqtype, uint32_t &anstype, time_t &ts);
|
||||
uint32_t &reqtype, uint32_t &anstype, rstime_t &ts);
|
||||
|
||||
// special ones for testing (not in final design)
|
||||
/*!
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user