diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/net/abstract_tcp_server2.inl | 19 | ||||
-rw-r--r-- | contrib/epee/src/connection_basic.cpp | 2 | ||||
-rwxr-xr-x | contrib/gitian/gitian-build.py | 65 |
3 files changed, 57 insertions, 29 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl index 8d96e4a84..e455d0204 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.inl +++ b/contrib/epee/include/net/abstract_tcp_server2.inl @@ -50,6 +50,8 @@ #include <sstream> #include <iomanip> #include <algorithm> +#include <functional> +#include <random> #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "net" @@ -628,7 +630,17 @@ PRAGMA_WARNING_DISABLE_VS(4355) return false; // aborted }*/ - long int ms = 250 + (rand()%50); + using engine = std::mt19937; + + engine rng; + std::random_device dev; + std::seed_seq::result_type rand[engine::state_size]{}; // Use complete bit space + + std::generate_n(rand, engine::state_size, std::ref(dev)); + std::seed_seq seed(rand, rand + engine::state_size); + rng.seed(seed); + + long int ms = 250 + (rng() % 50); MDEBUG("Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<chunk.size()); // XXX debug sleep m_send_que_lock.unlock(); boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) ); @@ -736,6 +748,11 @@ PRAGMA_WARNING_DISABLE_VS(4355) MERROR("Resetting timer on a dead object"); return; } + if (m_was_shutdown) + { + MERROR("Setting timer on a shut down object"); + return; + } if (add) ms += m_timer.expires_from_now(); m_timer.expires_from_now(ms); diff --git a/contrib/epee/src/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp index 7526dde26..3ce7a1057 100644 --- a/contrib/epee/src/connection_basic.cpp +++ b/contrib/epee/src/connection_basic.cpp @@ -136,6 +136,7 @@ connection_basic::connection_basic(boost::asio::ip::tcp::socket&& sock, std::sha socket_(GET_IO_SERVICE(sock), get_context(m_state.get())), m_want_close_connection(false), m_was_shutdown(false), + m_is_multithreaded(false), m_ssl_support(ssl_support) { // add nullptr checks if removed @@ -160,6 +161,7 @@ connection_basic::connection_basic(boost::asio::io_service &io_service, std::sha socket_(io_service, get_context(m_state.get())), m_want_close_connection(false), m_was_shutdown(false), + m_is_multithreaded(false), m_ssl_support(ssl_support) { // add nullptr checks if removed diff --git a/contrib/gitian/gitian-build.py b/contrib/gitian/gitian-build.py index 5913fda3a..a8d164c2c 100755 --- a/contrib/gitian/gitian-build.py +++ b/contrib/gitian/gitian-build.py @@ -5,6 +5,9 @@ import os import subprocess import sys +gsigs = 'https://github.com/monero-project/gitian.sigs.git' +gbrepo = 'https://github.com/devrandom/gitian-builder.git' + def setup(): global args, workdir programs = ['apt-cacher-ng', 'ruby', 'git', 'make', 'wget'] @@ -14,14 +17,21 @@ def setup(): programs += ['lxc', 'debootstrap'] if not args.no_apt: subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs) - if not os.path.isdir('gitian.sigs'): - subprocess.check_call(['git', 'clone', 'https://github.com/monero-project/gitian.sigs.git']) - if not os.path.isdir('gitian-builder'): - subprocess.check_call(['git', 'clone', 'https://github.com/devrandom/gitian-builder.git']) - if not os.path.isdir('monero'): - subprocess.check_call(['git', 'clone', 'https://github.com/monero-project/monero.git']) - os.chdir('gitian-builder') + if not os.path.isdir('sigs'): + subprocess.check_call(['git', 'clone', gsigs, 'sigs']) + if not os.path.isdir('builder'): + subprocess.check_call(['git', 'clone', gbrepo, 'builder']) + os.chdir('builder') + subprocess.check_call(['git', 'config', 'user.email', 'gitianuser@localhost']) + subprocess.check_call(['git', 'config', 'user.name', 'gitianuser']) subprocess.check_call(['git', 'checkout', '963322de8420c50502c4cc33d4d7c0d84437b576']) + subprocess.check_call(['git', 'fetch', 'origin', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3']) + subprocess.check_call(['git', 'cherry-pick', '72c51f0bd2adec4eedab4dbd06c9229b9c4eb0e3']) + os.makedirs('inputs', exist_ok=True) + os.chdir('inputs') + if not os.path.isdir('monero'): + subprocess.check_call(['git', 'clone', args.url, 'monero']) + os.chdir('..') make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64'] if args.docker: if not subprocess.call(['docker', '--help'], shell=False, stdout=subprocess.DEVNULL): @@ -39,40 +49,40 @@ def setup(): def build(): global args, workdir - os.makedirs('monero-binaries/' + args.version, exist_ok=True) + os.makedirs('out/' + args.version, exist_ok=True) print('\nBuilding Dependencies\n') - os.chdir('gitian-builder') + os.chdir('builder') os.makedirs('inputs', exist_ok=True) subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz']) subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch']) subprocess.check_output(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True) subprocess.check_output(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True) - subprocess.check_call(['make', '-C', '../monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common']) + subprocess.check_call(['make', '-C', 'inputs/monero/contrib/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common']) if args.linux: print('\nCompiling ' + args.version + ' Linux') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-linux.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-linux.yml']) - subprocess.check_call('mv build/out/monero-*.tar.bz2 ../monero-binaries/'+args.version, shell=True) + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-linux.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-linux.yml']) + subprocess.check_call('mv build/out/monero-*.tar.bz2 ../out/'+args.version, shell=True) if args.windows: print('\nCompiling ' + args.version + ' Windows') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-win.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-win.yml']) - subprocess.check_call('mv build/out/monero*.zip ../monero-binaries/'+args.version, shell=True) + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, 'inputs/monero/contrib/gitian/gitian-win.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-win.yml']) + subprocess.check_call('mv build/out/monero*.zip ../out/'+args.version, shell=True) if args.macos: print('\nCompiling ' + args.version + ' MacOS') - subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero='+args.url, '../monero/contrib/gitian/gitian-osx.yml']) - subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx', '--destination', '../gitian.sigs/', '../monero/contrib/gitian/gitian-osx.yml']) - subprocess.check_call('mv build/out/monero*.tar.bz2 ../monero-binaries/'+args.version, shell=True) + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'monero='+args.commit, '--url', 'monero'+args.url, 'inputs/monero/contrib/gitian/gitian-osx.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx', '--destination', '../sigs/', 'inputs/monero/contrib/gitian/gitian-osx.yml']) + subprocess.check_call('mv build/out/monero*.tar.bz2 ../out/'+args.version, shell=True) os.chdir(workdir) if args.commit_files: print('\nCommitting '+args.version+' Unsigned Sigs\n') - os.chdir('gitian.sigs') + os.chdir('sigs') subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer]) subprocess.check_call(['git', 'add', args.version+'-win/'+args.signer]) subprocess.check_call(['git', 'add', args.version+'-osx/'+args.signer]) @@ -81,14 +91,14 @@ def build(): def verify(): global args, workdir - os.chdir('gitian-builder') + os.chdir('builder') print('\nVerifying v'+args.version+' Linux\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../monero/contrib/gitian/gitian-linux.yml']) + subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-linux', 'inputs/monero/contrib/gitian/gitian-linux.yml']) print('\nVerifying v'+args.version+' Windows\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win', '../monero/contrib/gitian/gitian-win.yml']) + subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-win', 'inputs/monero/contrib/gitian/gitian-win.yml']) print('\nVerifying v'+args.version+' MacOS\n') - subprocess.check_call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx', '../monero/contrib/gitian/gitian-osx.yml']) + subprocess.check_call(['bin/gverify', '-v', '-d', '../sigs/', '-r', args.version+'-osx', 'inputs/monero/contrib/gitian/gitian-osx.yml']) os.chdir(workdir) def main(): @@ -142,7 +152,7 @@ def main(): os.environ['LXC_GUEST_IP'] = '10.0.3.5' # Disable MacOS build if no SDK found - if args.build and args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'): + if args.build and args.macos and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'): print('Cannot build for MacOS, SDK does not exist. Will build for other OSes') args.macos = False @@ -165,11 +175,10 @@ def main(): if args.setup: setup() - os.chdir('monero') + os.makedirs('builder/inputs/monero', exist_ok=True) + os.chdir('builder/inputs/monero') if args.pull: subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge']) - os.chdir('../gitian-builder/inputs/monero') - subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge']) args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True).strip() args.version = 'pull-' + args.version print(args.commit) |