From 421d0471e8b1a9bb21d6cd25892a3c2b3b8af5bc Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sun, 19 Jan 2020 18:44:45 -0600 Subject: Update emscripten to 1.39.6 --- .../build-utils/emscripten-fastcomp/Buildrules | 6 +- .../packages/build-utils/emscripten/Buildrules | 5 +- gnunet-build/packages/gnunet/gnunet/Buildrules | 107 ++++++++++++------ .../gnunet/gnunet/files/client-lib.exports | 2 - .../packages/gnunet/gnunet/files/client-pre.js | 2 +- .../packages/gnunet/gnunet/files/configuration.js | 14 +-- .../gnunet/files/gnunet-git-e8533c-all.patch | 17 ++- gnunet-build/packages/gnunet/gnunet/files/imports | 3 - .../packages/gnunet/gnunet/files/network.js | 46 ++++---- .../packages/gnunet/gnunet/files/plugin.js | 4 +- .../files/plugin_peerstore_emscripten_int.js | 20 ++-- .../plugin_transport_http_client_emscripten.c | 3 +- .../plugin_transport_http_client_emscripten_int.js | 26 ++--- .../gnunet/files/plugin_transport_webrtc_int.js | 6 +- gnunet-build/packages/gnunet/gnunet/files/pre.js | 6 +- .../packages/gnunet/gnunet/files/scheduler.c | 124 --------------------- .../packages/gnunet/gnunet/files/scheduler.js | 12 +- .../packages/gnunet/gnunet/files/scheduler_em.c | 124 +++++++++++++++++++++ 18 files changed, 288 insertions(+), 239 deletions(-) delete mode 100644 gnunet-build/packages/gnunet/gnunet/files/scheduler.c create mode 100644 gnunet-build/packages/gnunet/gnunet/files/scheduler_em.c (limited to 'gnunet-build') diff --git a/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules b/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules index 6032f13..fbb5a60 100644 --- a/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules +++ b/gnunet-build/packages/build-utils/emscripten-fastcomp/Buildrules @@ -1,8 +1,8 @@ -VERSION="1.37.28" +VERSION="1.39.6" DESCRIPTION="LLVM with the emscripten fastcomp javascript backend." SOURCE_URI=" -git://github.com/kripken/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT} -git://github.com/kripken/${NAME}-clang.git?${VERSION}&archive=${NAME}-clang-${VERSION}.${ARCHIVE_FORMAT} +git://github.com/emscripten-core/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT} +git://github.com/emscripten-core/${NAME}-clang.git?${VERSION}&archive=${NAME}-clang-${VERSION}.${ARCHIVE_FORMAT} " pkg_prep() diff --git a/gnunet-build/packages/build-utils/emscripten/Buildrules b/gnunet-build/packages/build-utils/emscripten/Buildrules index bf0d525..5011d43 100644 --- a/gnunet-build/packages/build-utils/emscripten/Buildrules +++ b/gnunet-build/packages/build-utils/emscripten/Buildrules @@ -1,6 +1,6 @@ -VERSION="1.37.28" +VERSION="1.39.6" DESCRIPTION="Emscripten is an LLVM-to-JavaScript compiler." -SOURCE_URI="git://github.com/kripken/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}" +SOURCE_URI="git://github.com/emscripten-core/${NAME}.git?${VERSION}&archive=${NAME}-${VERSION}.${ARCHIVE_FORMAT}" RDEPENDS="build-utils/emscripten-fastcomp build-utils/node" pkg_compile() { @@ -22,6 +22,7 @@ TEMP_DIR = os.path.expanduser(os.getenv('TEMP_DIR')) CRUNCH = os.path.expanduser(os.getenv('CRUNCH') or 'crunch') COMPILER_ENGINE = NODE_JS JS_ENGINES = [NODE_JS] +BINARYEN_ROOT = '/no_binaryen' EOF } diff --git a/gnunet-build/packages/gnunet/gnunet/Buildrules b/gnunet-build/packages/gnunet/gnunet/Buildrules index b8423d4..07fb822 100644 --- a/gnunet-build/packages/gnunet/gnunet/Buildrules +++ b/gnunet-build/packages/gnunet/gnunet/Buildrules @@ -13,7 +13,8 @@ BDEPENDS="${BDEPENDS} " pkg_compile() { - cp "${F}/scheduler.c" "${S}/src/util/" + cp "${F}/scheduler_em.c" \ + "${S}/src/util/" cp "${F}/plugin_transport_http_client_emscripten.c" \ "${S}/src/transport/" cp "${F}/plugin_transport_webrtc.c" \ @@ -23,12 +24,14 @@ pkg_compile() { cp "${F}/plugin_datastore_emscripten.c" \ "${S}/src/datastore/" export TEMP_DIR="${T}" + export LDFLAGS="${LDFLAGS} -s NO_WASM -L${SYSROOT}/usr/lib" ./bootstrap EMCONFIGURE_JS=1 emconfigure ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --with-libgcrypt-prefix="${SYSROOT}/usr" \ --without-libcurl \ + --without-ltdl \ --disable-testing \ --disable-nls \ --disable-documentation \ @@ -37,9 +40,11 @@ pkg_compile() { ac_cv_func_srandom=no \ ac_cv_func_getifaddrs=yes \ ac_cv_lib_socket_socket=no \ + ac_cv_search___atomic_load_8=no \ + ac_cv_search_memset_s=no \ CPPFLAGS="-I${SYSROOT}/usr/include" \ - LDFLAGS="-L${SYSROOT}/usr/lib" - emmake make LDFLAGS="${LDFLAGS} -Wc,--ignore-dynamic-linking" + LDFLAGS="${LDFLAGS}" + emmake make LDFLAGS="${LDFLAGS} -Wc,--ignore-dynamic-linking" V=1 mkdir -p "${D}/var/lib/gnunet/js" OPT_LEVEL="-O2" # @@ -48,7 +53,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='["_libgnunet_plugin_block_dht_init"]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/dht/libgnunet_plugin_block_dht.js" \ @@ -56,7 +62,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='["_libgnunet_plugin_block_fs_init"]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/fs/libgnunet_plugin_block_fs.js" \ @@ -70,6 +77,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ + ${LDFLAGS} \ + -s ALLOW_MEMORY_GROWTH \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ --use-preload-plugins \ @@ -82,6 +91,7 @@ pkg_compile() { "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ -lz \ + -lidbfs.js \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/scheduler.js" \ @@ -95,7 +105,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ "_libgnunet_plugin_datacache_heap_init" ]' \ @@ -110,9 +121,10 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ - "_libgnunet_plugin_datastore_emscripten_init", + "_libgnunet_plugin_datastore_emscripten_init" ]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/datastore/libgnunet_plugin_datastore_emscripten.js" \ @@ -120,11 +132,12 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ + -s TOTAL_MEMORY=$((80 * 1024 * 1024)) \ --memory-init-file 1 \ --use-preload-plugins \ - -s TOTAL_MEMORY=$((80 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/datastore/gnunet-service-datastore.js" \ "${S}/src/datastore/gnunet-service-datastore.o" \ @@ -132,6 +145,7 @@ pkg_compile() { "${S}/src/util/libgnunetutil.la" \ "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ + -lidbfs.js \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/plugin.js" \ @@ -149,7 +163,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ "_libgnunet_plugin_ats_proportional_init" ]' \ @@ -159,14 +174,16 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ --memory-init-file 1 \ --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/ats/gnunet-service-ats.js" \ "${S}/src/ats/gnunet-service-ats"*.o \ "${S}/src/ats/libgnunetats.la" \ + "${S}/src/nt/libgnunetnt.la" \ "${S}/src/statistics/libgnunetstatistics.la" \ "${S}/src/util/libgnunetutil.la" \ "${SYSROOT}/usr/lib/libgcrypt.la" \ @@ -187,9 +204,10 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ - "_libgnunet_plugin_transport_http_client_init", + "_libgnunet_plugin_transport_http_client_init" ]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/transport/libgnunet_plugin_transport_http_client.js" \ @@ -198,26 +216,31 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ - "_libgnunet_plugin_transport_webrtc_init", + "_libgnunet_plugin_transport_webrtc_init" ]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/transport/libgnunet_plugin_transport_webrtc.js" \ - "${S}/src/transport/libgnunet_plugin_transport_webrtc_la-plugin_transport_webrtc.lo" + "${S}/src/transport/plugin_transport_webrtc.lo" ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ + -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ --memory-init-file 1 \ --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/transport/gnunet-service-transport.js" \ "${S}/src/transport/gnunet_service_transport-gnunet-service-transport"*.o \ "${S}/src/transport/libgnunettransport.la" \ + "${S}/src/cadet/libgnunetcadet.la" \ "${S}/src/ats/libgnunetats.la" \ "${S}/src/hello/libgnunethello.la" \ + "${S}/src/nt/libgnunetnt.la" \ "${S}/src/peerinfo/libgnunetpeerinfo.la" \ "${S}/src/statistics/libgnunetstatistics.la" \ "${S}/src/util/libgnunetutil.la" \ @@ -241,6 +264,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ + ${LDFLAGS} \ + -s ALLOW_MEMORY_GROWTH \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ --use-preload-plugins \ @@ -267,6 +292,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ + ${LDFLAGS} \ + -s ALLOW_MEMORY_GROWTH \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ --use-preload-plugins \ @@ -280,6 +307,7 @@ pkg_compile() { "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ -lz \ + -lidbfs.js \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/scheduler.js" \ @@ -293,11 +321,12 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ + -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ --memory-init-file 1 \ --use-preload-plugins \ - -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/dht/gnunet-service-dht.js" \ "${S}/src/dht/gnunet-service-dht"*.o \ @@ -314,7 +343,6 @@ pkg_compile() { "${S}/src/util/libgnunetutil.la" \ "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ - -lz \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/plugin.js" \ @@ -329,6 +357,8 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ + ${LDFLAGS} \ + -s ALLOW_MEMORY_GROWTH \ -s EXPORTED_FUNCTIONS=@"${F}/imports" \ --memory-init-file 1 \ --use-preload-plugins \ @@ -358,8 +388,9 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ --memory-init-file 1 \ --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ @@ -376,7 +407,6 @@ pkg_compile() { "${S}/src/util/libgnunetutil.la" \ "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ - -lz \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/plugin.js" \ @@ -391,9 +421,10 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s SIDE_MODULE=1 \ + ${LDFLAGS} \ + -s SIDE_MODULE \ -s EXPORTED_FUNCTIONS='[ - "_libgnunet_plugin_peerstore_emscripten_init", + "_libgnunet_plugin_peerstore_emscripten_init" ]' \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/peerstore/libgnunet_plugin_peerstore_emscripten.js" \ @@ -401,8 +432,9 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ --memory-init-file 1 \ --use-preload-plugins \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ @@ -428,11 +460,12 @@ pkg_compile() { ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ ${OPT_LEVEL} \ - -s MAIN_MODULE=1 \ - -s EXPORTED_FUNCTIONS=@"${F}/imports" \ + ${LDFLAGS} \ + -s MAIN_MODULE \ + -s EXPORT_ALL \ + -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ --memory-init-file 1 \ --use-preload-plugins \ - -s TOTAL_MEMORY=$((32 * 1024 * 1024)) \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ -o "${S}/src/fs/gnunet-service-fs.js" \ "${S}/src/fs/gnunet-service-fs"*.o \ @@ -449,7 +482,7 @@ pkg_compile() { "${S}/src/util/libgnunetutil.la" \ "${SYSROOT}/usr/lib/libgcrypt.la" \ "${SYSROOT}/usr/lib/libgpg-error.la" \ - -lz \ + -lidbfs.js \ --js-library "${F}/configuration.js" \ --js-library "${F}/network.js" \ --js-library "${F}/plugin.js" \ @@ -468,6 +501,8 @@ pkg_compile() { "${F}/client-lib.c" ./libtool --tag=CC --mode=link \ emcc -fno-strict-aliasing -Wall \ + ${LDFLAGS} \ + -s ALLOW_MEMORY_GROWTH \ -s EXPORTED_FUNCTIONS=@${F}/client-lib.exports \ -s RESERVED_FUNCTION_POINTERS=100 \ "-I${SYSROOT}/usr/include" "-L${SYSROOT}/usr/lib" \ diff --git a/gnunet-build/packages/gnunet/gnunet/files/client-lib.exports b/gnunet-build/packages/gnunet/gnunet/files/client-lib.exports index fee5472..5e1b621 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/client-lib.exports +++ b/gnunet-build/packages/gnunet/gnunet/files/client-lib.exports @@ -38,8 +38,6 @@ "_GNUNET_FS_uri_parse", "_GNUNET_FS_uri_to_string", "_GNUNET_HELLO_get_id", -"_GNUNET_MQ_queue_for_connection_client", -"_GNUNET_SCHEDULER_run_task", "_GNUNET_STRINGS_data_to_string", "_GNUNET_TRANSPORT_hello_get", "_GNUNET_TRANSPORT_hello_get_cancel", diff --git a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js index 5afee0d..db585cd 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/client-pre.js +++ b/gnunet-build/packages/gnunet/gnunet/files/client-pre.js @@ -44,7 +44,7 @@ function ccallFunc(func, returnType, argTypes, args) { } } var ret = func.apply(null, cArgs); - if (returnType === 'string') ret = Pointer_stringify(ret); + if (returnType === 'string') ret = UTF8ToString(ret); if (stack !== 0) { stackRestore(stack); } diff --git a/gnunet-build/packages/gnunet/gnunet/files/configuration.js b/gnunet-build/packages/gnunet/gnunet/files/configuration.js index f227ec6..e9bab65 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/configuration.js +++ b/gnunet-build/packages/gnunet/gnunet/files/configuration.js @@ -98,8 +98,8 @@ mergeInto(LibraryManager.library, { }, GNUNET_CONFIGURATION_get_value__deps: ['$CONFIG'], GNUNET_CONFIGURATION_get_value: function(section, option) { - var section = Pointer_stringify(section).toLowerCase(); - var option = Pointer_stringify(option).toUpperCase(); + var section = UTF8ToString(section).toLowerCase(); + var option = UTF8ToString(option).toUpperCase(); console.debug('GNUNET_CONFIGURATION_get_value(' + section + ',' + option + ')'); if (!(section in CONFIG)) { @@ -186,11 +186,11 @@ mergeInto(LibraryManager.library, { GNUNET_CONFIGURATION_iterate_section_values__deps: ['$CONFIG'], GNUNET_CONFIGURATION_iterate_section_values: function(cfg, section, iter, iter_cls) { - var section_name = Pointer_stringify(section); + var section_name = UTF8ToString(section); console.debug('GNUNET_CONFIGURATION_iterate_section_values(' + section_name + ')'); if (!(section_name in CONFIG)) { - Module.print(section_name + ' not in CONFIG'); + console.log(section_name + ' not in CONFIG'); return; } section = CONFIG[section_name]; @@ -202,9 +202,9 @@ mergeInto(LibraryManager.library, { } }, GNUNET_CONFIGURATION_set_value_string: function(cfg, section, option, value) { - var section_name = Pointer_stringify(section); - var option_str = Pointer_stringify(option); - var value_str = Pointer_stringify(value); + var section_name = UTF8ToString(section); + var option_str = UTF8ToString(option); + var value_str = UTF8ToString(value); if(!(section_name in CONFIG)) { CONFIG[section_name] = {} } diff --git a/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch b/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch index ffa4361..297fce7 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch +++ b/gnunet-build/packages/gnunet/gnunet/files/gnunet-git-e8533c-all.patch @@ -1028,7 +1028,7 @@ index 4e8c8140d..7f75b2852 100644 olen = sizeof(uc); if ((0 == getsockopt (GNUNET_NETWORK_get_fd (sock), diff --git a/src/util/Makefile.am b/src/util/Makefile.am -index 387f22a9f..ae1ebd988 100644 +index 387f22a9f..a5622755b 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -43,8 +43,6 @@ libgnunetutil_la_SOURCES = \ @@ -1040,7 +1040,7 @@ index 387f22a9f..ae1ebd988 100644 container_bloomfilter.c \ container_heap.c \ container_meta_data.c \ -@@ -78,13 +76,11 @@ libgnunetutil_la_SOURCES = \ +@@ -78,17 +76,15 @@ libgnunetutil_la_SOURCES = \ mst.c \ mq.c \ nc.c \ @@ -1054,3 +1054,16 @@ index 387f22a9f..ae1ebd988 100644 program.c \ regex.c \ resolver_api.c resolver.h \ +- scheduler.c \ ++ scheduler_em.c \ + service.c \ + signal.c \ + strings.c \ +@@ -127,7 +123,6 @@ libgnunetutil_la_LIBADD = \ + $(LIBGCRYPT_LIBS) \ + $(LTLIBICONV) \ + $(LTLIBINTL) \ +- -lltdl \ + $(LIBIDN) $(LIBIDN2) \ + $(Z_LIBS) \ + -lunistring \ diff --git a/gnunet-build/packages/gnunet/gnunet/files/imports b/gnunet-build/packages/gnunet/gnunet/files/imports index 1d5c97f..cf80020 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/imports +++ b/gnunet-build/packages/gnunet/gnunet/files/imports @@ -1,7 +1,4 @@ [ -"_GNUNET_CONFIGURATION_get_value_float", -"_GNUNET_MQ_queue_for_connection_client", -"_GNUNET_SCHEDULER_run_task", "_GNUNET_STRINGS_fancy_size_to_bytes", "_GNUNET_STRINGS_fancy_time_to_relative", "_GNUNET_log_setup", diff --git a/gnunet-build/packages/gnunet/gnunet/files/network.js b/gnunet-build/packages/gnunet/gnunet/files/network.js index 4d5c717..8bcc763 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/network.js +++ b/gnunet-build/packages/gnunet/gnunet/files/network.js @@ -19,7 +19,7 @@ mergeInto(LibraryManager.library, { $NEXT_SOCKET: 1, GNUNET_NETWORK_socket_create__deps: ['$SOCKETS', '$NEXT_SOCKET'], GNUNET_NETWORK_socket_create: function(domain, type, protocol) { - console.debug("socket_create(", domain, type, protocol, ")"); + //console.debug("socket_create(", domain, type, protocol, ")"); if (domain != 1) { ___setErrNo(ERRNO_CODES.EAFNOSUPPORT); return 0; @@ -33,7 +33,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_connect__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_connect: function(desc, address, address_len) { - console.debug("socket_connect(", desc, address, address_len, ")"); + //console.debug("socket_connect(", desc, address, address_len, ")"); if (desc in SOCKETS) { console.error("socket already connected?"); ___setErrNo(ERRNO_CODES.EISCONN); @@ -44,8 +44,8 @@ mergeInto(LibraryManager.library, { ___setErrNo(ERRNO_CODES.EAFNOSUPPORT); return -1; } - var path = Pointer_stringify(address + 2); - console.debug("connecting to", path); + var path = UTF8ToString(address + 2); + //console.debug("connecting to", path); var channel; try { channel = new MessageChannel(); @@ -60,10 +60,10 @@ mergeInto(LibraryManager.library, { queue: [], }; channel.port1.onmessage = function(ev) { - console.debug("got message on socket", desc, ev); + //console.debug("got message on socket", desc, ev); socket.queue.push(ev.data); if ("task" in socket) { - console.debug("calling read handler"); + //console.debug("calling read handler"); delete SCHEDULER_TASKS[socket.task]; delete socket["task"]; dynCall('vi', socket.handler, [socket.cls]); @@ -84,7 +84,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_send__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_send: function(desc, buffer, length) { - console.debug("socket_send(", desc, buffer, length, ")"); + //console.debug("socket_send(", desc, buffer, length, ")"); if (!(desc in SOCKETS)) { console.error("socket not connected?"); ___setErrNo(ERRNO_CODES.ENOTCONN); @@ -103,7 +103,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_close__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_close: function(desc) { - console.debug("socket_close(", desc, ")"); + //console.debug("socket_close(", desc, ")"); if (!(desc in SOCKETS)) { return 1; } @@ -117,7 +117,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_bind__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_bind: function(desc, address, address_len) { - console.debug("socket_bind(", desc, address, address_len, ")"); + //console.debug("socket_bind(", desc, address, address_len, ")"); if (desc in SOCKETS) { console.error("socket already bound?"); ___setErrNo(ERRNO_CODES.EINVAL); @@ -127,14 +127,14 @@ mergeInto(LibraryManager.library, { ___setErrNo(ERRNO_CODES.EINVAL); return -1; } - var path = Pointer_stringify(address + 2); - console.debug("binding to", path); + var path = UTF8ToString(address + 2); + //console.debug("binding to", path); SOCKETS[desc] = {}; return 1; }, GNUNET_NETWORK_socket_listen__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_listen: function(desc, backlog) { - console.debug("socket_listen(", desc, backlog, ")"); + //console.debug("socket_listen(", desc, backlog, ")"); if ("listening" in SOCKETS) { console.error("only one listening socket is supported"); return -1; @@ -144,14 +144,14 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_accept__deps: ['$SOCKETS', '$NEXT_SOCKET'], GNUNET_NETWORK_socket_accept: function(desc, address, address_len) { - console.debug("socket_accept(", desc, address, address_len, ")"); + //console.debug("socket_accept(", desc, address, address_len, ")"); if (desc != SOCKETS.listening) { console.error("socket is not listening"); ___setErrNo(ERRNO_CODES.EINVAL); return 0; } if (0 == SOCKETS.incoming.length) { - console.debug("no incoming connections"); + //console.debug("no incoming connections"); ___setErrNo(ERRNO_CODES.EWOULDBLOCK); return 0; } @@ -168,10 +168,10 @@ mergeInto(LibraryManager.library, { queue: [], }; data.port.onmessage = function(ev) { - console.debug("got message on socket", sd, ev); + //console.debug("got message on socket", sd, ev); socket.queue.push(ev.data); if ("task" in socket) { - console.debug("calling read handler"); + //console.debug("calling read handler"); delete SCHEDULER_TASKS[socket.task]; delete socket["task"]; dynCall('vi', socket.handler, [socket.cls]); @@ -184,7 +184,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_NETWORK_socket_recv__deps: ['$SOCKETS'], GNUNET_NETWORK_socket_recv: function(desc, buffer, length) { - console.debug("socket_recv(", desc, buffer, length, ")"); + //console.debug("socket_recv(", desc, buffer, length, ")"); if (!(desc in SOCKETS)) { console.error("socket not connected?"); ___setErrNo(ERRNO_CODES.ENOTCONN); @@ -192,13 +192,13 @@ mergeInto(LibraryManager.library, { } var socket = SOCKETS[desc]; if (0 == socket.queue.length) { - console.debug("nothing to read"); + //console.debug("nothing to read"); ___setErrNo(ERRNO_CODES.EWOULDBLOCK); return -1; } var data = socket.queue[0]; if ("close" == data) { - console.debug("socket closed"); + //console.debug("socket closed"); return 0; } var sub = data.subarray(0, length); @@ -208,7 +208,7 @@ mergeInto(LibraryManager.library, { } else { socket.queue[0] = data.subarray(sub.length); } - console.debug("read", sub.length, "bytes"); + //console.debug("read", sub.length, "bytes"); return sub.length; }, GNUNET_NETWORK_fdset_isset__deps: ['$SOCKETS'], @@ -245,6 +245,12 @@ mergeInto(LibraryManager.library, { GNUNET_NETWORK_socket_select: function(rfds, wfds, efds, timeout) { console.error("GNUNET_NETWORK_socket_select should not be called"); return -1; + }, + GNUNET_NETWORK_test_pf: function(pf) { + if (1 == pf) { + return 1; + } + return 0; } }); diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin.js b/gnunet-build/packages/gnunet/gnunet/files/plugin.js index 534b4d8..181c95b 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin.js @@ -17,7 +17,7 @@ mergeInto(LibraryManager.library, { GNUNET_PLUGIN_load__deps: ['dlclose', 'dlsym', 'dlopen'], GNUNET_PLUGIN_load: function(library_name, arg) { - var lib = Pointer_stringify(library_name); + var lib = UTF8ToString(library_name); var handle = ccallFunc(_dlopen, 'number', ['string', 'number'], [lib + '.js', 0]); @@ -40,7 +40,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_PLUGIN_load_all__deps: ['$FS', 'GNUNET_PLUGIN_load'], GNUNET_PLUGIN_load_all: function(basename, arg, cb, cb_cls) { - var prefix = Pointer_stringify(basename); + var prefix = UTF8ToString(basename); var entries = []; try { entries = FS.readdir('.'); diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js index f1e576e..2e98663 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_peerstore_emscripten_int.js @@ -26,7 +26,7 @@ mergeInto(LibraryManager.library, { if (cursor) { count++; cursor.delete().onerror = function(e) { - Module.print('expiry request failed'); + console.error('expiry request failed'); }; cursor.continue(); } else { @@ -36,18 +36,18 @@ mergeInto(LibraryManager.library, { } }; request.onerror = function(e) { - Module.print('cursor request failed'); + console.error('cursor request failed'); dynCall('vii', cont, [cont_cls, -1]); }; }, peerstore_emscripten_iterate_records_int: function(sub_system_pointer, peer_pointer, key_pointer, iter, iter_cls, wrapper) { - var sub_system = Pointer_stringify(sub_system_pointer); + var sub_system = UTF8ToString(sub_system_pointer); var peer = peer_pointer ? Array.prototype.slice.call( HEAP8.subarray(peer_pointer, peer_pointer + 32)) : null; - var key = key_pointer ? Pointer_stringify(key_pointer) : null; + var key = key_pointer ? UTF8ToString(key_pointer) : null; var key_range = [sub_system]; if (peer) { key_range.push(peer); @@ -89,7 +89,7 @@ mergeInto(LibraryManager.library, { } }; request.onerror = function(e) { - Module.print('cursor request failed'); + console.error('cursor request failed'); dynCall('viii', iter, [iter_cls, 0, -1]); }; }, @@ -97,10 +97,10 @@ mergeInto(LibraryManager.library, { peer_pointer, key_pointer, value_pointer, size, expiry, options, cont, cont_cls) { - var sub_system = Pointer_stringify(sub_system_pointer); + var sub_system = UTF8ToString(sub_system_pointer); var peer = Array.prototype.slice.call(HEAP8.subarray(peer_pointer, peer_pointer + 32)); - var key = Pointer_stringify(key_pointer); + var key = UTF8ToString(key_pointer); var value = new Uint8Array(HEAP8.subarray(value_pointer, value_pointer + size)); var store = @@ -113,7 +113,7 @@ mergeInto(LibraryManager.library, { value: value, expiry: expiry}); request.onerror = function(e) { - Module.print('put request failed'); + console.error('put request failed'); dynCall('vii', cont, [cont_cls, -1]); }; request.onsuccess = function(e) { @@ -127,7 +127,7 @@ mergeInto(LibraryManager.library, { var cursor = e.target.result; if (cursor) { cursor.delete().onerror = function(e) { - Module.print('replace request failed'); + console.error('replace request failed'); }; cursor.continue(); } else { @@ -135,7 +135,7 @@ mergeInto(LibraryManager.library, { } }; request.onerror = function(e) { - Module.print('cursor request failed'); + console.error('cursor request failed'); dynCall('vii', cont, [cont_cls, -1]); }; } else { diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c index 3e100cc..70385d1 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten.c @@ -737,8 +737,7 @@ http_client_plugin_get_network_for_address (void *cls, * @param tc scheduler context */ static void -client_session_timeout (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +client_session_timeout (void *cls) { struct GNUNET_ATS_Session *s = cls; struct GNUNET_TIME_Relative left; diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js index da8c478..b7a501d 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_http_client_emscripten_int.js @@ -16,24 +16,24 @@ mergeInto(LibraryManager.library, { abort_xhr: function(xhr) { - Module.print('Aborting xhr: ' + xhr); + //console.debug('Aborting xhr: ' + xhr); xhrs[xhr].abort(); }, http_client_plugin_send_int: function(url_pointer, data_pointer, data_size, cont, cont_cls, target) { - var url = Pointer_stringify(url_pointer); + var url = UTF8ToString(url_pointer); var data = HEAP8.subarray(data_pointer, data_pointer + data_size); var xhr = new XMLHttpRequest(); xhr.open('PUT', url); xhr.send(data); xhr.onload = function(e) { - Module.print('put onload readyState ' + xhr.readyState + ' status ' + xhr.status); + //console.debug('put onload readyState ' + xhr.readyState + ' status ' + xhr.status); if (cont) { dynCall('viiiii', cont, [cont_cls, target, 1, data_size, data_size]); } }; xhr.onerror = function(e) { - Module.print('put onerror readyState ' + xhr.readyState + ' status ' + xhr.status); + //console.debug('put onerror readyState ' + xhr.readyState + ' status ' + xhr.status); if (cont) { dynCall('viiiii', cont, [cont_cls, target, -1, data_size, data_size]); } @@ -41,8 +41,8 @@ mergeInto(LibraryManager.library, { }, client_connect_get_int: function(get, s, url_pointer, client_receive, session_disconnect, plugin) { - var url = Pointer_stringify(url_pointer); - Module.print('Creating new get xhr: ' + get); + var url = UTF8ToString(url_pointer); + //console.debug('Creating new get xhr: ' + get); var xhr = new XMLHttpRequest(); xhrs[get] = xhr; xhr.responseType = 'arraybuffer'; @@ -51,20 +51,20 @@ mergeInto(LibraryManager.library, { xhr.send(); }; xhr.onreadystatechange = function() { - Module.print('xhr' + get + ' readyState ' + xhr.readyState + - ' status ' + xhr.status + ':' + xhr.statusText); + //console.debug('xhr' + get + ' readyState ' + xhr.readyState + + // ' status ' + xhr.status + ':' + xhr.statusText); }; xhr.onload = function(e) { var response = new Uint8Array(e.target.response); - Module.print('xhr' + get + ' got ' + response.length + ' bytes'); + //console.debug('xhr' + get + ' got ' + response.length + ' bytes'); ccallFunc(getFuncWrapper(client_receive, 'iiiii'), 'number', ['array', 'number', 'number', 'number'], [response, response.length, 1, s]); xhr.resend(); }; xhr.onerror = function(e) { - Module.print('xhr' + get + ' status:' - + xhr.status + ':' + xhr.statusText); + //console.debug('xhr' + get + ' status:' + // + xhr.status + ':' + xhr.statusText); ccallFunc( getFuncWrapper(session_disconnect, 'iii'), 'number', @@ -72,10 +72,10 @@ mergeInto(LibraryManager.library, { [plugin, s]); }; xhr.onabort = function() { - Module.print('xhr' + get + ' aborted'); + //console.debug('xhr' + get + ' aborted'); }; xhr.ontimeout = function() { - Module.print('xhr' + get + ' timedout'); + //console.debug('xhr' + get + ' timedout'); xhr.resend(); }; xhr.resend(); diff --git a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc_int.js b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc_int.js index cafc2f7..a682c15 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc_int.js +++ b/gnunet-build/packages/gnunet/gnunet/files/plugin_transport_webrtc_int.js @@ -21,7 +21,7 @@ mergeInto(LibraryManager.library, { peer_connect: function(offer_cb, answer_cb, message_cb, offer_ptr, offer_size, cls) { var offer; if (0 != offer_ptr) { - offer = Pointer_stringify(offer_ptr, offer_size); + offer = UTF8ToString(offer_ptr, offer_size); } var channel = new MessageChannel(); var port = channel.port1; @@ -56,7 +56,7 @@ mergeInto(LibraryManager.library, { set_remote_answer__deps: ["$CONNECTIONS"], set_remote_answer: function(num, answer_ptr, answer_size) { var port = CONNECTIONS[num]; - port.postMessage({type: 'answer', sdp: Pointer_stringify(answer_ptr, answer_size)}); + port.postMessage({type: 'answer', sdp: UTF8ToString(answer_ptr, answer_size)}); }, peer_disconnect__deps: ["$CONNECTIONS"], peer_disconnect: function(num) { @@ -67,4 +67,4 @@ mergeInto(LibraryManager.library, { } }); -// vim: set expandtab ts=2 sw=2: \ No newline at end of file +// vim: set expandtab ts=2 sw=2: diff --git a/gnunet-build/packages/gnunet/gnunet/files/pre.js b/gnunet-build/packages/gnunet/gnunet/files/pre.js index af0ba65..dae5bba 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/pre.js +++ b/gnunet-build/packages/gnunet/gnunet/files/pre.js @@ -46,7 +46,7 @@ gnunet_prerun = function() { random_bytes[random_offset++] = 0; } if (i < length) - Module.printErr('Random bytes exausted!'); + console.error('Random bytes exausted!'); return i; }, }); @@ -78,7 +78,7 @@ gnunet_prerun = function() { } if (typeof(Module['preInit']) === "undefined") Module = { 'preInit': [] }; Module['preInit'].push(gnunet_prerun); -Module['arguments'] = ["-L", "DEBUG"]; +Module['arguments'] = ["-L", "ERROR"]; // a map of window index to port var windows = {}; @@ -175,7 +175,7 @@ function ccallFunc(func, returnType, argTypes, args) { } } var ret = func.apply(null, cArgs); - if (returnType === 'string') ret = Pointer_stringify(ret); + if (returnType === 'string') ret = UTF8ToString(ret); if (stack !== 0) { stackRestore(stack); } diff --git a/gnunet-build/packages/gnunet/gnunet/files/scheduler.c b/gnunet-build/packages/gnunet/gnunet/files/scheduler.c deleted file mode 100644 index ba3c5aa..0000000 --- a/gnunet-build/packages/gnunet/gnunet/files/scheduler.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * scheduler.c - gnunet-web version of util/scheduler.c - * Copyright (C) 2015 David Barksdale - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "platform.h" -#include "gnunet_util_lib.h" - -extern struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_delayed_with_priority_js (double delay, - enum GNUNET_SCHEDULER_Priority priority, - GNUNET_SCHEDULER_TaskCallback task, - void *task_cls); - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, - enum GNUNET_SCHEDULER_Priority priority, - GNUNET_SCHEDULER_TaskCallback task, - void *task_cls) -{ - if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == delay.rel_value_us) { - // This is the shutdown task, ignore for now - return (struct GNUNET_SCHEDULER_Task *)-1; - } - return GNUNET_SCHEDULER_add_delayed_with_priority_js( - (double)(delay.rel_value_us / 1000), priority, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, - GNUNET_SCHEDULER_TaskCallback task, - void *task_cls) -{ - return GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_ZERO, - prio, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, - GNUNET_SCHEDULER_TaskCallback task, void *task_cls) -{ - return GNUNET_SCHEDULER_add_delayed_with_priority (delay, - GNUNET_SCHEDULER_PRIORITY_DEFAULT, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task, void *task_cls) -{ - return GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_ZERO, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, - GNUNET_SCHEDULER_TaskCallback task, void *task_cls) -{ - return GNUNET_SCHEDULER_add_now (task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at, - enum GNUNET_SCHEDULER_Priority priority, - GNUNET_SCHEDULER_TaskCallback task, - void *task_cls) -{ - return GNUNET_SCHEDULER_add_delayed_with_priority ( - GNUNET_TIME_absolute_get_remaining (at), priority, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_at (struct GNUNET_TIME_Absolute at, - GNUNET_SCHEDULER_TaskCallback task, - void *task_cls) -{ - return GNUNET_SCHEDULER_add_at_with_priority (at, - GNUNET_SCHEDULER_PRIORITY_DEFAULT, task, task_cls); -} - -struct GNUNET_SCHEDULER_Task * -GNUNET_SCHEDULER_add_shutdown (GNUNET_SCHEDULER_TaskCallback task, - void *task_cls) -{ - return NULL; -} - -void -GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_TaskCallback task, - void *task_cls, - enum GNUNET_SCHEDULER_Reason reason) -{ - GNUNET_SCHEDULER_add_now(task, task_cls); -} - -const struct GNUNET_SCHEDULER_TaskContext tc = { - .reason = GNUNET_SCHEDULER_REASON_WRITE_READY, - .read_ready = (void *)(intptr_t)1, - .write_ready = (void *)(intptr_t)2, -}; - -const struct GNUNET_SCHEDULER_TaskContext * -GNUNET_SCHEDULER_get_task_context () -{ - return &tc; -} - -void -GNUNET_SCHEDULER_shutdown (void) -{ - // TODO: do we even need this? -} - -/* vim: set expandtab ts=2 sw=2: */ diff --git a/gnunet-build/packages/gnunet/gnunet/files/scheduler.js b/gnunet-build/packages/gnunet/gnunet/files/scheduler.js index bb470fa..23e4373 100644 --- a/gnunet-build/packages/gnunet/gnunet/files/scheduler.js +++ b/gnunet-build/packages/gnunet/gnunet/files/scheduler.js @@ -19,7 +19,7 @@ mergeInto(LibraryManager.library, { GNUNET_SCHEDULER_add_delayed_with_priority_js__deps: ['$SCHEDULER_TASKS'], GNUNET_SCHEDULER_add_delayed_with_priority_js: function(delay, priority, task, task_cls) { - //Module.print('GNUNET_SCHEDULER_add_delayed_with_priority(delay='+delay+',pirority='+priority+',task='+task+',task_cls='+task_cls+')'); + //console.log('GNUNET_SCHEDULER_add_delayed_with_priority(delay=', delay, ',pirority=', priority, ',task=', task, ',task_cls=', task_cls, ')'); var id; id = setTimeout(function() { delete SCHEDULER_TASKS[id]; @@ -33,7 +33,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_SCHEDULER_cancel__deps: ['$SCHEDULER_TASKS'], GNUNET_SCHEDULER_cancel: function(task) { - console.debug("cancelling task", task); + //console.debug("cancelling task", task); clearTimeout(task); if (task in SCHEDULER_TASKS) { var t = SCHEDULER_TASKS[task]; @@ -49,7 +49,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_SCHEDULER_add_read_net__deps: ['$SOCKETS'], GNUNET_SCHEDULER_add_read_net: function(delay, rfd, task, task_cls) { - console.debug("add_read_net(", delay, rfd, task, task_cls, ")"); + //console.debug("add_read_net(", delay, rfd, task, task_cls, ")"); if (!(rfd in SOCKETS)) { console.error("socket is not connected?"); return 0; @@ -80,7 +80,7 @@ mergeInto(LibraryManager.library, { socket["handler"] = task; socket["cls"] = task_cls; socket["task"] = id; - console.debug("read task is", id); + //console.debug("read task is", id); return id; }, GNUNET_SCHEDULER_add_read_net_with_priority__deps: [ @@ -92,7 +92,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_SCHEDULER_add_write_net__deps: ['$SOCKETS'], GNUNET_SCHEDULER_add_write_net: function(delay, wfd, task, task_cls) { - console.debug("add_write_net(", delay, wfd, task, task_cls, ")"); + //console.debug("add_write_net(", delay, wfd, task, task_cls, ")"); if (!(wfd in SOCKETS)) { console.error("socket is not connected?"); return 0; @@ -110,7 +110,7 @@ mergeInto(LibraryManager.library, { }, GNUNET_SCHEDULER_run: function(task, task_cls) { dynCall('vi', task, [task_cls]); - throw 'SimulateInfiniteLoop'; + throw 'unwind'; }, }); diff --git a/gnunet-build/packages/gnunet/gnunet/files/scheduler_em.c b/gnunet-build/packages/gnunet/gnunet/files/scheduler_em.c new file mode 100644 index 0000000..ba3c5aa --- /dev/null +++ b/gnunet-build/packages/gnunet/gnunet/files/scheduler_em.c @@ -0,0 +1,124 @@ +/* + * scheduler.c - gnunet-web version of util/scheduler.c + * Copyright (C) 2015 David Barksdale + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "platform.h" +#include "gnunet_util_lib.h" + +extern struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_delayed_with_priority_js (double delay, + enum GNUNET_SCHEDULER_Priority priority, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls); + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_delayed_with_priority (struct GNUNET_TIME_Relative delay, + enum GNUNET_SCHEDULER_Priority priority, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == delay.rel_value_us) { + // This is the shutdown task, ignore for now + return (struct GNUNET_SCHEDULER_Task *)-1; + } + return GNUNET_SCHEDULER_add_delayed_with_priority_js( + (double)(delay.rel_value_us / 1000), priority, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + return GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_ZERO, + prio, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_delayed (struct GNUNET_TIME_Relative delay, + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) +{ + return GNUNET_SCHEDULER_add_delayed_with_priority (delay, + GNUNET_SCHEDULER_PRIORITY_DEFAULT, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_now (GNUNET_SCHEDULER_TaskCallback task, void *task_cls) +{ + return GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_ZERO, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_now_with_lifeness (int lifeness, + GNUNET_SCHEDULER_TaskCallback task, void *task_cls) +{ + return GNUNET_SCHEDULER_add_now (task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at, + enum GNUNET_SCHEDULER_Priority priority, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + return GNUNET_SCHEDULER_add_delayed_with_priority ( + GNUNET_TIME_absolute_get_remaining (at), priority, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_at (struct GNUNET_TIME_Absolute at, + GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + return GNUNET_SCHEDULER_add_at_with_priority (at, + GNUNET_SCHEDULER_PRIORITY_DEFAULT, task, task_cls); +} + +struct GNUNET_SCHEDULER_Task * +GNUNET_SCHEDULER_add_shutdown (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls) +{ + return NULL; +} + +void +GNUNET_SCHEDULER_add_continuation (GNUNET_SCHEDULER_TaskCallback task, + void *task_cls, + enum GNUNET_SCHEDULER_Reason reason) +{ + GNUNET_SCHEDULER_add_now(task, task_cls); +} + +const struct GNUNET_SCHEDULER_TaskContext tc = { + .reason = GNUNET_SCHEDULER_REASON_WRITE_READY, + .read_ready = (void *)(intptr_t)1, + .write_ready = (void *)(intptr_t)2, +}; + +const struct GNUNET_SCHEDULER_TaskContext * +GNUNET_SCHEDULER_get_task_context () +{ + return &tc; +} + +void +GNUNET_SCHEDULER_shutdown (void) +{ + // TODO: do we even need this? +} + +/* vim: set expandtab ts=2 sw=2: */ -- cgit v1.2.3-18-g5258