From 81d4ad1ae8a8ddd3b177f9ede52043e368d7c77b Mon Sep 17 00:00:00 2001 From: Naim A Date: Sat, 23 Jan 2016 15:08:30 -0800 Subject: [PATCH] Some Linux ajustments --- Makefile | 11 +++++------ README.md | 2 +- src/udpTracker.cpp | 12 ++++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 0de727a..25762d5 100644 --- a/Makefile +++ b/Makefile @@ -18,23 +18,22 @@ # objects = main.o udpTracker.o database.o driver_sqlite.o \ - settings.o tools.o httpserver.o webapp.o \ - logging.o + tools.o httpserver.o webapp.o logging.o target = udpt %.o: src/%.c $(CC) -c -o $@ $< $(CFLAGS) %.o: src/%.cpp - $(CXX) -c -o $@ $< $(CXXFLAGS) + $(CXX) -g -std=gnu++11 -c -o $@ $< $(CXXFLAGS) %.o: src/db/%.cpp - $(CXX) -c -o $@ $< $(CXXFLAGS) + $(CXX) -g -std=gnu++11 -c -o $@ $< $(CXXFLAGS) %.o: src/http/%.cpp - $(CXX) -c -o $@ $< $(CXXFLAGS) + $(CXX) -g -std=gnu++11 -c -o $@ $< $(CXXFLAGS) all: $(target) $(target): $(objects) @echo Linking... - $(CXX) -O3 -o $(target) $(objects) $(LDFLAGS) -lsqlite3 -lpthread + $(CXX) -O3 -o $(target) $(objects) $(LDFLAGS) -lboost_program_options -lsqlite3 -lpthread @echo Done. clean: @echo Cleaning Up... diff --git a/README.md b/README.md index 82b0d2a..a350e12 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ UDPT is designed to run on both Windows and Linux-based platform (It may run on ### License UDPT is released under the [GPL](http://www.gnu.org/licenses/gpl-3.0.en.html) license, a copy is included in this repository. -We use [SQLite3](http://www.sqlite.org/) which is public-domain. +We use [SQLite3](http://www.sqlite.org/) which is public-domain, and [Boost](http://www.boost.org/) which is released under the [boost license](http://www.boost.org/LICENSE_1_0.txt). ### Building We didn't really work on creating any installer, at the moment you can just run udpt from anywhere on your filesystem. diff --git a/src/udpTracker.cpp b/src/udpTracker.cpp index 26632e3..e16950d 100644 --- a/src/udpTracker.cpp +++ b/src/udpTracker.cpp @@ -106,12 +106,12 @@ namespace UDPT void UDPTracker::wait() { #ifdef WIN32 - WaitForMultipleObjects(this->m_threadCount, this->m_threads, TRUE, INFINITE); + ::WaitForMultipleObjects(this->m_threadCount, this->m_threads, TRUE, INFINITE); #else int i; for (i = 0;i < this->m_threadCount; i++) { - pthread_join (this->m_threads[i], NULL); + ::pthread_join(this->m_threads[i], NULL); } #endif } @@ -161,7 +161,7 @@ namespace UDPT #ifdef WIN32 this->m_threads[0] = ::CreateThread(NULL, 0, reinterpret_cast(_maintainance_start), (LPVOID)this, 0, NULL); #elif defined (linux) - ::pthread_create (&this->m_threads[0], NULL, _maintainance_start, (void*)this); + ::pthread_create(&this->m_threads[0], NULL, _maintainance_start, (void*)this); #endif for (i = 1;i < this->m_threadCount; i++) @@ -173,7 +173,7 @@ namespace UDPT #ifdef WIN32 this->m_threads[i] = ::CreateThread(NULL, 0, reinterpret_cast(_thread_start), (LPVOID)this, 0, NULL); #elif defined (linux) - ::pthread_create (&(this->m_threads[i]), NULL, _thread_start, (void*)this); + ::pthread_create(&(this->m_threads[i]), NULL, _thread_start, (void*)this); #endif } } @@ -258,7 +258,7 @@ namespace UDPT if (!usi->m_allowRemotes && req->ip_address != 0) { - UDPTracker::sendError (usi, remote, req->transaction_id, "Tracker doesn't allow remote IP's; Request ignored."); + UDPTracker::sendError(usi, remote, req->transaction_id, "Tracker doesn't allow remote IP's; Request ignored."); return 0; } @@ -424,7 +424,7 @@ static int _isIANA_IP (uint32_t ip) if (!usi->m_allowIANA_IPs) { - if (_isIANA_IP (remote->sin_addr.s_addr)) + if (_isIANA_IP(remote->sin_addr.s_addr)) { return 0; // Access Denied: IANA reserved IP. }