Some Linux ajustments
This commit is contained in:
parent
1db33eb0b6
commit
81d4ad1ae8
11
Makefile
11
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...
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<LPTHREAD_START_ROUTINE>(_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<LPTHREAD_START_ROUTINE>(_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.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue