diff --git a/Jamfile b/Jamfile index 2cc30a4..980401e 100644 --- a/Jamfile +++ b/Jamfile @@ -13,10 +13,19 @@ lib libdatachannel static : # usage requirements ./include + /libdatachannel//plog -pthread "`pkg-config --libs openssl glib-2.0 gobject-2.0 nice`" ; +alias plog + : # no sources + : # no build requirements + : # no default build + : # usage requirements + ./deps/plog/include + ; + alias usrsctp : # no sources : # no build requirements diff --git a/Makefile b/Makefile index a83ac4f..ebad178 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ CXXFLAGS=-std=c++17 LDFLAGS=-pthread LIBS=glib-2.0 gobject-2.0 nice USRSCTP_DIR=deps/usrsctp +PLOG_DIR=deps/plog USE_GNUTLS ?= 0 ifneq ($(USE_GNUTLS), 0) @@ -20,7 +21,7 @@ else endif LDLIBS= $(shell pkg-config --libs $(LIBS)) -INCLUDES=-Iinclude/rtc -I$(USRSCTP_DIR)/usrsctplib $(shell pkg-config --cflags $(LIBS)) +INCLUDES=-Iinclude/rtc -I$(PLOG_DIR)/include -I$(USRSCTP_DIR)/usrsctplib $(shell pkg-config --cflags $(LIBS)) SRCS=$(shell printf "%s " src/*.cpp) OBJS=$(subst .cpp,.o,$(SRCS)) @@ -31,7 +32,7 @@ src/%.o: src/%.cpp $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) -MMD -MP -o $@ -c $< test/%.o: test/%.cpp - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -Iinclude -MMD -MP -o $@ -c $< + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -Iinclude -I$(PLOG_DIR)/include -MMD -MP -o $@ -c $< -include $(subst .cpp,.d,$(SRCS)) diff --git a/include/rtc/include.hpp b/include/rtc/include.hpp index 60d60f9..1489d4e 100644 --- a/include/rtc/include.hpp +++ b/include/rtc/include.hpp @@ -27,8 +27,8 @@ #include #include -#include -#include +#include "plog/Appenders/ColorConsoleAppender.h" +#include "plog/Log.h" namespace rtc { diff --git a/src/dtlstransport.cpp b/src/dtlstransport.cpp index 9a29ced..f82a5b2 100644 --- a/src/dtlstransport.cpp +++ b/src/dtlstransport.cpp @@ -508,8 +508,9 @@ void DtlsTransport::InfoCallback(const SSL *ssl, int where, int ret) { static_cast(SSL_get_ex_data(ssl, DtlsTransport::TransportExIndex)); if (where & SSL_CB_ALERT) { - if (ret != 256) // Close Notify + if (ret != 256) { // Close Notify PLOG_ERROR << "DTLS alert: " << SSL_alert_desc_string_long(ret); + } t->mIncomingQueue.stop(); // Close the connection } } diff --git a/src/sctptransport.cpp b/src/sctptransport.cpp index ba951db..e4dcb56 100644 --- a/src/sctptransport.cpp +++ b/src/sctptransport.cpp @@ -202,8 +202,9 @@ void SctpTransport::connect() { void SctpTransport::shutdown() { PLOG_DEBUG << "SCTP shutdown"; - if (usrsctp_shutdown(mSock, SHUT_RDWR)) + if (usrsctp_shutdown(mSock, SHUT_RDWR)) { PLOG_WARNING << "SCTP shutdown failed, errno=" << errno; + } PLOG_INFO << "SCTP disconnected"; changeState(State::Disconnected);