diff --git a/build.macos.sh b/build.macos.sh index bef295c..ff4d2a0 100644 --- a/build.macos.sh +++ b/build.macos.sh @@ -9,12 +9,13 @@ c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c multithread-test.cpp -o obj/multithread-test.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c printout.cpp -o obj/printout.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c processes.cpp -o obj/processes.o +c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c rapidjson_extra.cpp -o obj/rapidjson_extra.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/include/freetype2 -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c renderer.cpp -o obj/renderer.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c rulematch.cpp -o obj/rulematch.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c socket.cpp -o obj/socket.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c speedtestutil.cpp -o obj/speedtestutil.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c tcping.cpp -o obj/tcping.o c++ -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -Wall -fexceptions -D_MACOS -DCURL_STATICLIB -g -std=c++11 -c webget.cpp -o obj/webget.o -c++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -L/usr/local/opt/openssl@1.1/lib -lcurl -lPNGwriter -lpng -lfreetype -lz -lssl -lcrypto -lyaml-cpp -ldl -lpthread +c++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/rapidjson_extra.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -L/usr/local/opt/openssl@1.1/lib -lcurl -lPNGwriter -lpng -lfreetype -lz -lssl -lcrypto -lyaml-cpp -ldl -lpthread chmod +x stairspeedtest diff --git a/build.sh b/build.sh index 6df5c0c..30d6a80 100644 --- a/build.sh +++ b/build.sh @@ -9,12 +9,13 @@ gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c misc.cpp -o obj/misc gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c multithread-test.cpp -o obj/multithread-test.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c printout.cpp -o obj/printout.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c processes.cpp -o obj/processes.o -gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c renderer.cpp -o obj/renderer.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rapidjson_extra.cpp -o obj/rapidjson_extra.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -I/usr/local/include/freetype2 -I/usr/include/freetype2 -std=c++11 -c renderer.cpp -o obj/renderer.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rulematch.cpp -o obj/rulematch.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c socket.cpp -o obj/socket.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c speedtestutil.cpp -o obj/speedtestutil.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c tcping.cpp -o obj/tcping.o gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c webget.cpp -o obj/webget.o -g++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -lcurl -lPNGwriter -lpng16 -lfreetype -lz -lssl -lcrypto -ldl -lpthread -lyaml-cpp -s +g++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/rapidjson_extra.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -lcurl -lPNGwriter -lpng16 -lfreetype -lz -lssl -lcrypto -ldl -lpthread -lyaml-cpp -s chmod +x stairspeedtest diff --git a/build.static.sh b/build.static.sh new file mode 100644 index 0000000..f8048a4 --- /dev/null +++ b/build.static.sh @@ -0,0 +1,21 @@ +#!/bin/bash +mkdir obj +mkdir bin +set -e +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c geoip.cpp -o obj/geoip.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c logger.cpp -o obj/logger.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c main.cpp -o obj/main.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c misc.cpp -o obj/misc.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c multithread-test.cpp -o obj/multithread-test.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c printout.cpp -o obj/printout.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c processes.cpp -o obj/processes.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rapidjson_extra.cpp -o obj/rapidjson_extra.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -I/usr/local/include/freetype2 -I/usr/include/freetype2 -std=c++11 -c renderer.cpp -o obj/renderer.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c rulematch.cpp -o obj/rulematch.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c socket.cpp -o obj/socket.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c speedtestutil.cpp -o obj/speedtestutil.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c tcping.cpp -o obj/tcping.o +gcc -Wall -fexceptions -DCURL_STATICLIB -g -std=c++11 -c webget.cpp -o obj/webget.o +g++ -g -o stairspeedtest obj/geoip.o obj/logger.o obj/main.o obj/misc.o obj/multithread-test.o obj/printout.o obj/processes.o obj/rapidjson_extra.o obj/renderer.o obj/rulematch.o obj/socket.o obj/speedtestutil.o obj/tcping.o obj/webget.o -lcurl -lPNGwriter -lpng16 -lfreetype -lz -lssl -lcrypto -ldl -lpthread -lyaml-cpp -s -static +chmod +x stairspeedtest + diff --git a/config.alpine.shared.sh b/config.alpine.shared.sh new file mode 100644 index 0000000..1a046f6 --- /dev/null +++ b/config.alpine.shared.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +apk add gcc g++ cmake make + +apk add libpng-dev curl-dev freetype-dev zlib-dev openssl rapidjson-dev yaml-cpp-dev + +git clone https://github.com/pngwriter/pngwriter +cd pngwriter +cmake . +make install -j4 +cd .. diff --git a/config.alpine.static.sh b/config.alpine.static.sh new file mode 100644 index 0000000..cd19571 --- /dev/null +++ b/config.alpine.static.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +apk add gcc g++ cmake make autoconf automake libtool + +apk add libpng-dev libressl-dev freetype-dev freetype-static zlib-dev openssl rapidjson-dev + +git clone https://github.com/curl/curl +cd curl +./buildconf +./configure +make install -j4 +cd .. + +git clone https://github.com/jbeder/yaml-cpp +cd yaml-cpp +cmake . +make install -j4 +cd .. + +git clone https://github.com/pngwriter/pngwriter +cd pngwriter +cmake . +make install -j4 +cd .. diff --git a/socket.h b/socket.h index dd68833..0e55911 100644 --- a/socket.h +++ b/socket.h @@ -19,10 +19,12 @@ #define SOCKADDR_IN sockaddr_in #define ZeroMemory(d,l) memset((d), 0, (l)) #define ioctlsocket ioctl -#ifdef _MACOS +#ifndef SA_INTERRUPT #define SA_INTERRUPT 0 //ignore this setting +#endif +#ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 //ignore this setting -#endif // _MACOS +#endif #ifndef __hpux #include #endif /* __hpux */ diff --git a/tcping.cpp b/tcping.cpp index c22937b..8e3b100 100644 --- a/tcping.cpp +++ b/tcping.cpp @@ -81,7 +81,13 @@ int tcping(nodeInfo *node) draw_progress(loopcounter, node->rawPing); loopcounter++; if(loopcounter < times_to_ping) - sleep(1000); + { + if(retVal != 1) + sleep(1000); //passed, sleep longer + else + sleep(200); //not passed, sleep shorter + } + } cerr<