Skip to content

Commit

Permalink
Merge 60626c2 into 08ff19a
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jul 8, 2018
2 parents 08ff19a + 60626c2 commit f0e6844
Show file tree
Hide file tree
Showing 41 changed files with 286 additions and 135 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium)
set(toxcore_SOURCES ${toxcore_SOURCES}
toxcore/logger.c
toxcore/logger.h
toxcore/mono_time.c
toxcore/mono_time.h
toxcore/network.c
toxcore/network.h
toxcore/util.c
Expand Down Expand Up @@ -341,6 +343,7 @@ include(CompileGTest)
unit_test(toxav ring_buffer)
unit_test(toxav rtp)
unit_test(toxcore crypto_core)
unit_test(toxcore mono_time)
unit_test(toxcore util)

################################################################################
Expand Down
1 change: 1 addition & 0 deletions auto_tests/TCP_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "../toxcore/TCP_server.h"

#include "../toxcore/crypto_core.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/util.h"

#include "helpers.h"
Expand Down
1 change: 1 addition & 0 deletions auto_tests/onion_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <sys/types.h>
#include <time.h>

#include "../toxcore/mono_time.h"
#include "../toxcore/onion.h"
#include "../toxcore/onion_announce.h"
#include "../toxcore/onion_client.h"
Expand Down
2 changes: 2 additions & 0 deletions auto_tests/toxav_many_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ static void *call_thread(void *pd)

printf("Closing thread\n");
pthread_exit(nullptr);

return nullptr;
}

static void test_av_three_calls(void)
Expand Down
1 change: 1 addition & 0 deletions other/DHT_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "../toxcore/LAN_discovery.h"
#include "../toxcore/friend_requests.h"
#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/tox.h"
#include "../toxcore/util.h"

Expand Down
1 change: 1 addition & 0 deletions other/bootstrap_daemon/src/tox-bootstrapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "../../../toxcore/LAN_discovery.h"
#include "../../../toxcore/TCP_server.h"
#include "../../../toxcore/logger.h"
#include "../../../toxcore/mono_time.h"
#include "../../../toxcore/onion_announce.h"
#include "../../../toxcore/util.h"

Expand Down
1 change: 1 addition & 0 deletions other/monolith.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "../toxcore/group.c"
#include "../toxcore/list.c"
#include "../toxcore/logger.c"
#include "../toxcore/mono_time.c"
#include "../toxcore/network.c"
#include "../toxcore/net_crypto.c"
#include "../toxcore/onion.c"
Expand Down
3 changes: 0 additions & 3 deletions other/travis/env-freebsd.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/sh

CMAKE=cmake
# Asan is disabled because it's currently broken in FreeBSD 11.
# We should try enabling it in the next FreeBSD release and see if it works.
CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS -DASAN=OFF"
NPROC=`nproc`
CURDIR=/root
RUN_TESTS=true
Expand Down
1 change: 0 additions & 1 deletion other/travis/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export PKG_CONFIG_PATH=$CACHE_DIR/lib/pkgconfig
export ASTYLE=$CACHE_DIR/astyle/build/gcc/bin/astyle
export CFLAGS="-O3 -DTRAVIS_ENV=1"
export CXXFLAGS="-O3 -DTRAVIS_ENV=1"
export CMAKE_EXTRA_FLAGS="-DERROR_ON_WARNING=ON"
export MAKE=make

BUILD_DIR=_build
Expand Down
4 changes: 1 addition & 3 deletions other/travis/toxcore-script
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ RUN $CMAKE \
-B$BUILD_DIR \
-H. \
-DCMAKE_INSTALL_PREFIX:PATH=$CURDIR/_install \
-DASAN=ON \
-DDEBUG=ON \
-DMUST_BUILD_TOXAV=ON \
-DSTRICT_ABI=ON \
-DTEST_TIMEOUT_SECONDS=120 \
-DTRACE=ON \
-DUSE_IPV6=$USE_IPV6 \
$CMAKE_EXTRA_FLAGS
-DUSE_IPV6=$USE_IPV6

export CTEST_OUTPUT_ON_FAILURE=1

Expand Down
2 changes: 1 addition & 1 deletion testing/av_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern "C" {
#include "../toxav/ring_buffer.c"

#include "../toxav/toxav.h"
#include "../toxcore/network.h" /* current_time_monotonic() */
#include "../toxcore/mono_time.h" /* current_time_monotonic() */
#include "../toxcore/tox.h"
#include "../toxcore/util.h"

Expand Down
1 change: 1 addition & 0 deletions toxav/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "rtp.h"

#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"

static struct JitterBuffer *jbuf_new(uint32_t capacity);
static void jbuf_clear(struct JitterBuffer *q);
Expand Down
1 change: 1 addition & 0 deletions toxav/bwcontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "ring_buffer.h"

#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/util.h"

#define BWC_PACKET_ID 196
Expand Down
1 change: 1 addition & 0 deletions toxav/groupav.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string.h>

#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/util.h"

#define GROUP_JBUF_SIZE 6
Expand Down
1 change: 1 addition & 0 deletions toxav/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "../toxcore/Messenger.h"
#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/util.h"

enum {
Expand Down
1 change: 1 addition & 0 deletions toxav/toxav.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "../toxcore/Messenger.h"
#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/util.h"

#include <assert.h>
Expand Down
1 change: 1 addition & 0 deletions toxav/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "rtp.h"

#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/network.h"

/**
Expand Down
17 changes: 17 additions & 0 deletions toxcore/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ cc_library(
deps = [":ccompat"],
)

cc_library(
name = "mono_time",
srcs = ["mono_time.c"],
hdrs = ["mono_time.h"],
deps = [":ccompat"],
)

cc_test(
name = "mono_time_test",
srcs = ["mono_time_test.cc"],
deps = [
":mono_time",
"@com_google_googletest//:gtest_main",
],
)

cc_library(
name = "network",
srcs = [
Expand All @@ -70,6 +86,7 @@ cc_library(
":ccompat",
":crypto_core",
":logger",
":mono_time",
],
)

Expand Down
1 change: 1 addition & 0 deletions toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "LAN_discovery.h"
#include "logger.h"
#include "mono_time.h"
#include "network.h"
#include "ping.h"
#include "util.h"
Expand Down
2 changes: 2 additions & 0 deletions toxcore/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ libtoxcore_la_includedir = $(includedir)/tox
libtoxcore_la_SOURCES = ../toxcore/ccompat.h \
../toxcore/DHT.h \
../toxcore/DHT.c \
../toxcore/mono_time.h \
../toxcore/mono_time.c \
../toxcore/network.h \
../toxcore/network.c \
../toxcore/crypto_core.h \
Expand Down
5 changes: 3 additions & 2 deletions toxcore/Messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <time.h>

#include "logger.h"
#include "mono_time.h"
#include "network.h"
#include "util.h"

Expand Down Expand Up @@ -1763,8 +1764,8 @@ static int handle_filecontrol(Messenger *m, int32_t friendnumber, uint8_t receiv

if (position >= ft->size) {
LOGGER_DEBUG(m->log,
"file control (friend %d, file %d): seek position %lld exceeds file size %lld",
friendnumber, filenumber, (unsigned long long)position, (unsigned long long)ft->size);
"file control (friend %d, file %d): seek position %ld exceeds file size %ld",
friendnumber, filenumber, (unsigned long)position, (unsigned long)ft->size);
return -1;
}

Expand Down
1 change: 1 addition & 0 deletions toxcore/TCP_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>

#include "mono_time.h"
#include "util.h"

struct TCP_Client_Connection {
Expand Down
1 change: 1 addition & 0 deletions toxcore/TCP_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>

#include "mono_time.h"
#include "util.h"


Expand Down
1 change: 1 addition & 0 deletions toxcore/TCP_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <unistd.h>
#endif

#include "mono_time.h"
#include "util.h"

typedef struct TCP_Secure_Connection {
Expand Down
1 change: 1 addition & 0 deletions toxcore/friend_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stdlib.h>
#include <string.h>

#include "mono_time.h"
#include "util.h"

#define PORTS_PER_DISCOVERY 10
Expand Down
1 change: 1 addition & 0 deletions toxcore/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>

#include "mono_time.h"
#include "util.h"

/* return 1 if the groupnumber is not valid.
Expand Down
Loading

0 comments on commit f0e6844

Please sign in to comment.