diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-10 05:57:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-10 05:57:55 +0000 |
commit | d5e4648c1a755af9d9b47d446e750d228ce66f99 (patch) | |
tree | 562a0b5f17ede06d961b113e951eef16d790c2bd | |
parent | 18bd5e0a920729f0baf414311130e0a92e775bbb (diff) | |
download | gnunet-d5e4648c1a755af9d9b47d446e750d228ce66f99.tar.gz gnunet-d5e4648c1a755af9d9b47d446e750d228ce66f99.zip |
timeout code
-rw-r--r-- | contrib/defaults.conf | 5 | ||||
-rw-r--r-- | m4/argz.m4 | 4 | ||||
-rw-r--r-- | m4/libtool.m4 | 131 | ||||
-rw-r--r-- | m4/ltdl.m4 | 32 | ||||
-rw-r--r-- | m4/ltoptions.m4 | 2 | ||||
-rw-r--r-- | m4/ltsugar.m4 | 20 | ||||
-rw-r--r-- | m4/ltversion.m4 | 10 | ||||
-rw-r--r-- | src/core/core.h | 2 | ||||
-rw-r--r-- | src/core/core_api.c | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 223 | ||||
-rw-r--r-- | src/core/test_core_api.c | 2 | ||||
-rw-r--r-- | src/include/Makefile.am | 1 | ||||
-rw-r--r-- | src/include/gnunet_constants.h | 60 | ||||
-rw-r--r-- | src/include/gnunet_core_service.h | 4 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 55 | ||||
-rw-r--r-- | src/transport/transport_api.c | 2 |
16 files changed, 354 insertions, 203 deletions
diff --git a/contrib/defaults.conf b/contrib/defaults.conf index d6100b77d..0dcf5d087 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf | |||
@@ -104,8 +104,6 @@ HOSTNAME = localhost | |||
104 | HOME = $SERVICEHOME | 104 | HOME = $SERVICEHOME |
105 | CONFIG = $DEFAULTCONFIG | 105 | CONFIG = $DEFAULTCONFIG |
106 | BINARY = gnunet-service-transport | 106 | BINARY = gnunet-service-transport |
107 | DEFAULT_QUOTA_IN = 50000 | ||
108 | DEFAULT_QUOTA_OUT = 50000 | ||
109 | NEIGHBOUR_LIMIT = 50 | 107 | NEIGHBOUR_LIMIT = 50 |
110 | ACCEPT_FROM = 127.0.0.1; | 108 | ACCEPT_FROM = 127.0.0.1; |
111 | ACCEPT_FROM6 = ::1; | 109 | ACCEPT_FROM6 = ::1; |
@@ -129,6 +127,9 @@ BINARY = gnunet-service-core | |||
129 | ACCEPT_FROM = 127.0.0.1; | 127 | ACCEPT_FROM = 127.0.0.1; |
130 | ACCEPT_FROM6 = ::1; | 128 | ACCEPT_FROM6 = ::1; |
131 | ALLOW_SHUTDOWN = YES | 129 | ALLOW_SHUTDOWN = YES |
130 | # quotas are in bytes per minute now! | ||
131 | TOTAL_QUOTA_IN = 3932160 | ||
132 | TOTAL_QUOTA_OUT = 3932160 | ||
132 | # USERNAME = | 133 | # USERNAME = |
133 | # MAXBUF = | 134 | # MAXBUF = |
134 | # TIMEOUT = | 135 | # TIMEOUT = |
diff --git a/m4/argz.m4 b/m4/argz.m4 index 37c1b11e4..edc99bbce 100644 --- a/m4/argz.m4 +++ b/m4/argz.m4 | |||
@@ -28,14 +28,14 @@ ARGZ_H= | |||
28 | AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ | 28 | AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ |
29 | argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) | 29 | argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) |
30 | 30 | ||
31 | dnl if have system argz functions, allow forced use of | 31 | dnl if have system argz functions, allow forced use of |
32 | dnl libltdl-supplied implementation (and default to do so | 32 | dnl libltdl-supplied implementation (and default to do so |
33 | dnl on "known bad" systems). Could use a runtime check, but | 33 | dnl on "known bad" systems). Could use a runtime check, but |
34 | dnl (a) detecting malloc issues is notoriously unreliable | 34 | dnl (a) detecting malloc issues is notoriously unreliable |
35 | dnl (b) only known system that declares argz functions, | 35 | dnl (b) only known system that declares argz functions, |
36 | dnl provides them, yet they are broken, is cygwin | 36 | dnl provides them, yet they are broken, is cygwin |
37 | dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) | 37 | dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) |
38 | dnl So, it's more straightforward simply to special case | 38 | dnl So, it's more straightforward simply to special case |
39 | dnl this for known bad systems. | 39 | dnl this for known bad systems. |
40 | AS_IF([test -z "$ARGZ_H"], | 40 | AS_IF([test -z "$ARGZ_H"], |
41 | [AC_CACHE_CHECK( | 41 | [AC_CACHE_CHECK( |
diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 1e7ea47c0..6e86e5b43 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 | |||
@@ -380,12 +380,12 @@ m4_define([lt_decl_dquote_varnames], | |||
380 | # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) | 380 | # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) |
381 | # --------------------------------------------------- | 381 | # --------------------------------------------------- |
382 | m4_define([lt_decl_varnames_tagged], | 382 | m4_define([lt_decl_varnames_tagged], |
383 | [m4_assert([$# <= 2])dnl | 383 | [_$0(m4_quote(m4_default([$1], [[, ]])), |
384 | _$0(m4_quote(m4_default([$1], [[, ]])), | 384 | m4_quote(m4_if([$2], [], |
385 | m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), | 385 | m4_quote(lt_decl_tag_varnames), |
386 | m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) | 386 | m4_quote(m4_shift($@)))), |
387 | m4_define([_lt_decl_varnames_tagged], | 387 | m4_split(m4_normalize(m4_quote(_LT_TAGS))))]) |
388 | [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) | 388 | m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)]) |
389 | 389 | ||
390 | 390 | ||
391 | # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) | 391 | # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) |
@@ -945,10 +945,10 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ | |||
945 | _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; | 945 | _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; |
946 | darwin1.*) | 946 | darwin1.*) |
947 | _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; | 947 | _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; |
948 | darwin*) # darwin 5.x on | 948 | darwin*) # darwin 5.x on |
949 | # if running on 10.5 or later, the deployment target defaults | 949 | # if running on 10.5 or later, the deployment target defaults |
950 | # to the OS version, if on x86, and 10.4, the deployment | 950 | # to the OS version, if on x86, and 10.4, the deployment |
951 | # target defaults to 10.4. Don't you love it? | 951 | # target defaults to 10.4. Don't you love it? |
952 | case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in | 952 | case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in |
953 | 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) | 953 | 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) |
954 | _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; | 954 | _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; |
@@ -990,11 +990,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], | |||
990 | _LT_TAGVAR(whole_archive_flag_spec, $1)='' | 990 | _LT_TAGVAR(whole_archive_flag_spec, $1)='' |
991 | _LT_TAGVAR(link_all_deplibs, $1)=yes | 991 | _LT_TAGVAR(link_all_deplibs, $1)=yes |
992 | _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" | 992 | _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" |
993 | case $cc_basename in | 993 | if test "$GCC" = "yes"; then |
994 | ifort*) _lt_dar_can_shared=yes ;; | ||
995 | *) _lt_dar_can_shared=$GCC ;; | ||
996 | esac | ||
997 | if test "$_lt_dar_can_shared" = "yes"; then | ||
998 | output_verbose_link_cmd=echo | 994 | output_verbose_link_cmd=echo |
999 | _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" | 995 | _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" |
1000 | _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" | 996 | _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" |
@@ -1516,7 +1512,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl | |||
1516 | lt_cv_sys_max_cmd_len=-1; | 1512 | lt_cv_sys_max_cmd_len=-1; |
1517 | ;; | 1513 | ;; |
1518 | 1514 | ||
1519 | cygwin* | mingw* | cegcc*) | 1515 | cygwin* | mingw*) |
1520 | # On Win9x/ME, this test blows up -- it succeeds, but takes | 1516 | # On Win9x/ME, this test blows up -- it succeeds, but takes |
1521 | # about 5 minutes as the teststring grows exponentially. | 1517 | # about 5 minutes as the teststring grows exponentially. |
1522 | # Worse, since 9x/ME are not pre-emptively multitasking, | 1518 | # Worse, since 9x/ME are not pre-emptively multitasking, |
@@ -1684,6 +1680,10 @@ else | |||
1684 | # endif | 1680 | # endif |
1685 | #endif | 1681 | #endif |
1686 | 1682 | ||
1683 | #ifdef __cplusplus | ||
1684 | extern "C" void exit (int); | ||
1685 | #endif | ||
1686 | |||
1687 | void fnord() { int i=42;} | 1687 | void fnord() { int i=42;} |
1688 | int main () | 1688 | int main () |
1689 | { | 1689 | { |
@@ -1699,7 +1699,7 @@ int main () | |||
1699 | else | 1699 | else |
1700 | puts (dlerror ()); | 1700 | puts (dlerror ()); |
1701 | 1701 | ||
1702 | return status; | 1702 | exit (status); |
1703 | }] | 1703 | }] |
1704 | _LT_EOF | 1704 | _LT_EOF |
1705 | if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then | 1705 | if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then |
@@ -1738,7 +1738,7 @@ else | |||
1738 | lt_cv_dlopen_self=yes | 1738 | lt_cv_dlopen_self=yes |
1739 | ;; | 1739 | ;; |
1740 | 1740 | ||
1741 | mingw* | pw32* | cegcc*) | 1741 | mingw* | pw32*) |
1742 | lt_cv_dlopen="LoadLibrary" | 1742 | lt_cv_dlopen="LoadLibrary" |
1743 | lt_cv_dlopen_libs= | 1743 | lt_cv_dlopen_libs= |
1744 | ;; | 1744 | ;; |
@@ -2035,7 +2035,6 @@ m4_defun([_LT_SYS_DYNAMIC_LINKER], | |||
2035 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl | 2035 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl |
2036 | m4_require([_LT_DECL_EGREP])dnl | 2036 | m4_require([_LT_DECL_EGREP])dnl |
2037 | m4_require([_LT_FILEUTILS_DEFAULTS])dnl | 2037 | m4_require([_LT_FILEUTILS_DEFAULTS])dnl |
2038 | m4_require([_LT_DECL_OBJDUMP])dnl | ||
2039 | m4_require([_LT_DECL_SED])dnl | 2038 | m4_require([_LT_DECL_SED])dnl |
2040 | AC_MSG_CHECKING([dynamic linker characteristics]) | 2039 | AC_MSG_CHECKING([dynamic linker characteristics]) |
2041 | m4_if([$1], | 2040 | m4_if([$1], |
@@ -2200,14 +2199,14 @@ bsdi[[45]]*) | |||
2200 | # libtool to hard-code these into programs | 2199 | # libtool to hard-code these into programs |
2201 | ;; | 2200 | ;; |
2202 | 2201 | ||
2203 | cygwin* | mingw* | pw32* | cegcc*) | 2202 | cygwin* | mingw* | pw32*) |
2204 | version_type=windows | 2203 | version_type=windows |
2205 | shrext_cmds=".dll" | 2204 | shrext_cmds=".dll" |
2206 | need_version=no | 2205 | need_version=no |
2207 | need_lib_prefix=no | 2206 | need_lib_prefix=no |
2208 | 2207 | ||
2209 | case $GCC,$host_os in | 2208 | case $GCC,$host_os in |
2210 | yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) | 2209 | yes,cygwin* | yes,mingw* | yes,pw32*) |
2211 | library_names_spec='$libname.dll.a' | 2210 | library_names_spec='$libname.dll.a' |
2212 | # DLL is installed to $(libdir)/../bin by postinstall_cmds | 2211 | # DLL is installed to $(libdir)/../bin by postinstall_cmds |
2213 | postinstall_cmds='base_file=`basename \${file}`~ | 2212 | postinstall_cmds='base_file=`basename \${file}`~ |
@@ -2230,7 +2229,7 @@ cygwin* | mingw* | pw32* | cegcc*) | |||
2230 | soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' | 2229 | soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' |
2231 | sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" | 2230 | sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" |
2232 | ;; | 2231 | ;; |
2233 | mingw* | cegcc*) | 2232 | mingw*) |
2234 | # MinGW DLLs use traditional 'lib' prefix | 2233 | # MinGW DLLs use traditional 'lib' prefix |
2235 | soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' | 2234 | soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' |
2236 | sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` | 2235 | sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` |
@@ -2668,7 +2667,7 @@ tpf*) | |||
2668 | version_type=linux | 2667 | version_type=linux |
2669 | need_lib_prefix=no | 2668 | need_lib_prefix=no |
2670 | need_version=no | 2669 | need_version=no |
2671 | library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' | 2670 | library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' |
2672 | shlibpath_var=LD_LIBRARY_PATH | 2671 | shlibpath_var=LD_LIBRARY_PATH |
2673 | shlibpath_overrides_runpath=no | 2672 | shlibpath_overrides_runpath=no |
2674 | hardcode_into_libs=yes | 2673 | hardcode_into_libs=yes |
@@ -2692,7 +2691,7 @@ variables_saved_for_relink="PATH $shlibpath_var $runpath_var" | |||
2692 | if test "$GCC" = yes; then | 2691 | if test "$GCC" = yes; then |
2693 | variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" | 2692 | variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" |
2694 | fi | 2693 | fi |
2695 | 2694 | ||
2696 | if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then | 2695 | if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then |
2697 | sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" | 2696 | sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" |
2698 | fi | 2697 | fi |
@@ -2969,7 +2968,6 @@ _LT_DECL([], [reload_cmds], [2])dnl | |||
2969 | # -- PORTME fill in with the dynamic library characteristics | 2968 | # -- PORTME fill in with the dynamic library characteristics |
2970 | m4_defun([_LT_CHECK_MAGIC_METHOD], | 2969 | m4_defun([_LT_CHECK_MAGIC_METHOD], |
2971 | [m4_require([_LT_DECL_EGREP]) | 2970 | [m4_require([_LT_DECL_EGREP]) |
2972 | m4_require([_LT_DECL_OBJDUMP]) | ||
2973 | AC_CACHE_CHECK([how to recognize dependent libraries], | 2971 | AC_CACHE_CHECK([how to recognize dependent libraries], |
2974 | lt_cv_deplibs_check_method, | 2972 | lt_cv_deplibs_check_method, |
2975 | [lt_cv_file_magic_cmd='$MAGIC_CMD' | 2973 | [lt_cv_file_magic_cmd='$MAGIC_CMD' |
@@ -3020,12 +3018,6 @@ mingw* | pw32*) | |||
3020 | fi | 3018 | fi |
3021 | ;; | 3019 | ;; |
3022 | 3020 | ||
3023 | cegcc) | ||
3024 | # use the weaker test based on 'objdump'. See mingw*. | ||
3025 | lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' | ||
3026 | lt_cv_file_magic_cmd='$OBJDUMP -f' | ||
3027 | ;; | ||
3028 | |||
3029 | darwin* | rhapsody*) | 3021 | darwin* | rhapsody*) |
3030 | lt_cv_deplibs_check_method=pass_all | 3022 | lt_cv_deplibs_check_method=pass_all |
3031 | ;; | 3023 | ;; |
@@ -3337,7 +3329,7 @@ case $host_os in | |||
3337 | aix*) | 3329 | aix*) |
3338 | symcode='[[BCDT]]' | 3330 | symcode='[[BCDT]]' |
3339 | ;; | 3331 | ;; |
3340 | cygwin* | mingw* | pw32* | cegcc*) | 3332 | cygwin* | mingw* | pw32*) |
3341 | symcode='[[ABCDGISTW]]' | 3333 | symcode='[[ABCDGISTW]]' |
3342 | ;; | 3334 | ;; |
3343 | hpux*) | 3335 | hpux*) |
@@ -3583,7 +3575,7 @@ m4_if([$1], [CXX], [ | |||
3583 | beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) | 3575 | beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) |
3584 | # PIC is the default for these OSes. | 3576 | # PIC is the default for these OSes. |
3585 | ;; | 3577 | ;; |
3586 | mingw* | cygwin* | os2* | pw32* | cegcc*) | 3578 | mingw* | cygwin* | os2* | pw32*) |
3587 | # This hack is so that the source file can tell whether it is being | 3579 | # This hack is so that the source file can tell whether it is being |
3588 | # built for inclusion in a dll (and should export symbols for example). | 3580 | # built for inclusion in a dll (and should export symbols for example). |
3589 | # Although the cygwin gcc ignores -fPIC, still need this for old-style | 3581 | # Although the cygwin gcc ignores -fPIC, still need this for old-style |
@@ -3610,11 +3602,10 @@ m4_if([$1], [CXX], [ | |||
3610 | fi | 3602 | fi |
3611 | ;; | 3603 | ;; |
3612 | hpux*) | 3604 | hpux*) |
3613 | # PIC is the default for 64-bit PA HP-UX, but not for 32-bit | 3605 | # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but |
3614 | # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag | 3606 | # not for PA HP-UX. |
3615 | # sets the default TLS model and affects inlining. | ||
3616 | case $host_cpu in | 3607 | case $host_cpu in |
3617 | hppa*64*) | 3608 | hppa*64*|ia64*) |
3618 | ;; | 3609 | ;; |
3619 | *) | 3610 | *) |
3620 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' | 3611 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' |
@@ -3712,19 +3703,12 @@ m4_if([$1], [CXX], [ | |||
3712 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' | 3703 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' |
3713 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' | 3704 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' |
3714 | ;; | 3705 | ;; |
3715 | ecpc* ) | 3706 | icpc* | ecpc* ) |
3716 | # old Intel C++ for x86_64 which still supported -KPIC. | 3707 | # Intel C++ |
3717 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | 3708 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' |
3718 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' | 3709 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' |
3719 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' | 3710 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' |
3720 | ;; | 3711 | ;; |
3721 | icpc* ) | ||
3722 | # Intel C++, used to be incompatible with GCC. | ||
3723 | # ICC 10 doesn't accept -KPIC any more. | ||
3724 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | ||
3725 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' | ||
3726 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' | ||
3727 | ;; | ||
3728 | pgCC* | pgcpp*) | 3712 | pgCC* | pgcpp*) |
3729 | # Portland Group C++ compiler | 3713 | # Portland Group C++ compiler |
3730 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | 3714 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' |
@@ -3890,7 +3874,7 @@ m4_if([$1], [CXX], [ | |||
3890 | # PIC is the default for these OSes. | 3874 | # PIC is the default for these OSes. |
3891 | ;; | 3875 | ;; |
3892 | 3876 | ||
3893 | mingw* | cygwin* | pw32* | os2* | cegcc*) | 3877 | mingw* | cygwin* | pw32* | os2*) |
3894 | # This hack is so that the source file can tell whether it is being | 3878 | # This hack is so that the source file can tell whether it is being |
3895 | # built for inclusion in a dll (and should export symbols for example). | 3879 | # built for inclusion in a dll (and should export symbols for example). |
3896 | # Although the cygwin gcc ignores -fPIC, still need this for old-style | 3880 | # Although the cygwin gcc ignores -fPIC, still need this for old-style |
@@ -3906,11 +3890,10 @@ m4_if([$1], [CXX], [ | |||
3906 | ;; | 3890 | ;; |
3907 | 3891 | ||
3908 | hpux*) | 3892 | hpux*) |
3909 | # PIC is the default for 64-bit PA HP-UX, but not for 32-bit | 3893 | # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but |
3910 | # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag | 3894 | # not for PA HP-UX. |
3911 | # sets the default TLS model and affects inlining. | ||
3912 | case $host_cpu in | 3895 | case $host_cpu in |
3913 | hppa*64*) | 3896 | hppa*64*|ia64*) |
3914 | # +Z the default | 3897 | # +Z the default |
3915 | ;; | 3898 | ;; |
3916 | *) | 3899 | *) |
@@ -3960,7 +3943,7 @@ m4_if([$1], [CXX], [ | |||
3960 | fi | 3943 | fi |
3961 | ;; | 3944 | ;; |
3962 | 3945 | ||
3963 | mingw* | cygwin* | pw32* | os2* | cegcc*) | 3946 | mingw* | cygwin* | pw32* | os2*) |
3964 | # This hack is so that the source file can tell whether it is being | 3947 | # This hack is so that the source file can tell whether it is being |
3965 | # built for inclusion in a dll (and should export symbols for example). | 3948 | # built for inclusion in a dll (and should export symbols for example). |
3966 | m4_if([$1], [GCJ], [], | 3949 | m4_if([$1], [GCJ], [], |
@@ -3991,25 +3974,11 @@ m4_if([$1], [CXX], [ | |||
3991 | 3974 | ||
3992 | linux* | k*bsd*-gnu) | 3975 | linux* | k*bsd*-gnu) |
3993 | case $cc_basename in | 3976 | case $cc_basename in |
3994 | # old Intel for x86_64 which still supported -KPIC. | 3977 | icc* | ecc* | ifort*) |
3995 | ecc*) | ||
3996 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | 3978 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' |
3997 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' | 3979 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' |
3998 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' | 3980 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' |
3999 | ;; | 3981 | ;; |
4000 | # icc used to be incompatible with GCC. | ||
4001 | # ICC 10 doesn't accept -KPIC any more. | ||
4002 | icc* | ifort*) | ||
4003 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | ||
4004 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' | ||
4005 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' | ||
4006 | ;; | ||
4007 | # Lahey Fortran 8.1. | ||
4008 | lf95*) | ||
4009 | _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' | ||
4010 | _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' | ||
4011 | _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' | ||
4012 | ;; | ||
4013 | pgcc* | pgf77* | pgf90* | pgf95*) | 3982 | pgcc* | pgf77* | pgf90* | pgf95*) |
4014 | # Portland Group compilers (*not* the Pentium gcc compiler, | 3983 | # Portland Group compilers (*not* the Pentium gcc compiler, |
4015 | # which looks to be a dead project) | 3984 | # which looks to be a dead project) |
@@ -4191,7 +4160,7 @@ m4_if([$1], [CXX], [ | |||
4191 | pw32*) | 4160 | pw32*) |
4192 | _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" | 4161 | _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" |
4193 | ;; | 4162 | ;; |
4194 | cygwin* | mingw* | cegcc*) | 4163 | cygwin* | mingw*) |
4195 | _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' | 4164 | _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' |
4196 | ;; | 4165 | ;; |
4197 | linux* | k*bsd*-gnu) | 4166 | linux* | k*bsd*-gnu) |
@@ -4246,7 +4215,7 @@ dnl Note also adjust exclude_expsyms for C++ above. | |||
4246 | extract_expsyms_cmds= | 4215 | extract_expsyms_cmds= |
4247 | 4216 | ||
4248 | case $host_os in | 4217 | case $host_os in |
4249 | cygwin* | mingw* | pw32* | cegcc*) | 4218 | cygwin* | mingw* | pw32*) |
4250 | # FIXME: the MSVC++ port hasn't been tested in a loooong time | 4219 | # FIXME: the MSVC++ port hasn't been tested in a loooong time |
4251 | # When not using gcc, we currently assume that we are using | 4220 | # When not using gcc, we currently assume that we are using |
4252 | # Microsoft Visual C++. | 4221 | # Microsoft Visual C++. |
@@ -4261,9 +4230,6 @@ dnl Note also adjust exclude_expsyms for C++ above. | |||
4261 | openbsd*) | 4230 | openbsd*) |
4262 | with_gnu_ld=no | 4231 | with_gnu_ld=no |
4263 | ;; | 4232 | ;; |
4264 | linux* | k*bsd*-gnu) | ||
4265 | _LT_TAGVAR(link_all_deplibs, $1)=no | ||
4266 | ;; | ||
4267 | esac | 4233 | esac |
4268 | 4234 | ||
4269 | _LT_TAGVAR(ld_shlibs, $1)=yes | 4235 | _LT_TAGVAR(ld_shlibs, $1)=yes |
@@ -4336,7 +4302,7 @@ _LT_EOF | |||
4336 | fi | 4302 | fi |
4337 | ;; | 4303 | ;; |
4338 | 4304 | ||
4339 | cygwin* | mingw* | pw32* | cegcc*) | 4305 | cygwin* | mingw* | pw32*) |
4340 | # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, | 4306 | # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, |
4341 | # as there is no search path for DLLs. | 4307 | # as there is no search path for DLLs. |
4342 | _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' | 4308 | _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' |
@@ -4402,9 +4368,6 @@ _LT_EOF | |||
4402 | tmp_addflag=' -i_dynamic -nofor_main' ;; | 4368 | tmp_addflag=' -i_dynamic -nofor_main' ;; |
4403 | ifc* | ifort*) # Intel Fortran compiler | 4369 | ifc* | ifort*) # Intel Fortran compiler |
4404 | tmp_addflag=' -nofor_main' ;; | 4370 | tmp_addflag=' -nofor_main' ;; |
4405 | lf95*) # Lahey Fortran 8.1 | ||
4406 | _LT_TAGVAR(whole_archive_flag_spec, $1)= | ||
4407 | tmp_sharedflag='--shared' ;; | ||
4408 | xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) | 4371 | xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) |
4409 | tmp_sharedflag='-qmkshrobj' | 4372 | tmp_sharedflag='-qmkshrobj' |
4410 | tmp_addflag= ;; | 4373 | tmp_addflag= ;; |
@@ -4637,7 +4600,6 @@ _LT_EOF | |||
4637 | fi | 4600 | fi |
4638 | fi | 4601 | fi |
4639 | 4602 | ||
4640 | _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' | ||
4641 | # It seems that -bexpall does not export symbols beginning with | 4603 | # It seems that -bexpall does not export symbols beginning with |
4642 | # underscore (_), so it is better to generate a list of symbols to export. | 4604 | # underscore (_), so it is better to generate a list of symbols to export. |
4643 | _LT_TAGVAR(always_export_symbols, $1)=yes | 4605 | _LT_TAGVAR(always_export_symbols, $1)=yes |
@@ -4692,7 +4654,7 @@ _LT_EOF | |||
4692 | _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic | 4654 | _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic |
4693 | ;; | 4655 | ;; |
4694 | 4656 | ||
4695 | cygwin* | mingw* | pw32* | cegcc*) | 4657 | cygwin* | mingw* | pw32*) |
4696 | # When not using gcc, we currently assume that we are using | 4658 | # When not using gcc, we currently assume that we are using |
4697 | # Microsoft Visual C++. | 4659 | # Microsoft Visual C++. |
4698 | # hardcode_libdir_flag_spec is actually meaningless, as there is | 4660 | # hardcode_libdir_flag_spec is actually meaningless, as there is |
@@ -4796,7 +4758,7 @@ _LT_EOF | |||
4796 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' | 4758 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' |
4797 | ;; | 4759 | ;; |
4798 | ia64*) | 4760 | ia64*) |
4799 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' | 4761 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' |
4800 | ;; | 4762 | ;; |
4801 | *) | 4763 | *) |
4802 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' | 4764 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' |
@@ -5581,7 +5543,6 @@ if test "$_lt_caught_CXX_error" != yes; then | |||
5581 | fi | 5543 | fi |
5582 | fi | 5544 | fi |
5583 | 5545 | ||
5584 | _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' | ||
5585 | # It seems that -bexpall does not export symbols beginning with | 5546 | # It seems that -bexpall does not export symbols beginning with |
5586 | # underscore (_), so it is better to generate a list of symbols to | 5547 | # underscore (_), so it is better to generate a list of symbols to |
5587 | # export. | 5548 | # export. |
@@ -5640,7 +5601,7 @@ if test "$_lt_caught_CXX_error" != yes; then | |||
5640 | esac | 5601 | esac |
5641 | ;; | 5602 | ;; |
5642 | 5603 | ||
5643 | cygwin* | mingw* | pw32* | cegcc*) | 5604 | cygwin* | mingw* | pw32*) |
5644 | # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, | 5605 | # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, |
5645 | # as there is no search path for DLLs. | 5606 | # as there is no search path for DLLs. |
5646 | _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' | 5607 | _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' |
@@ -7025,18 +6986,6 @@ AC_SUBST([GREP]) | |||
7025 | ]) | 6986 | ]) |
7026 | 6987 | ||
7027 | 6988 | ||
7028 | # _LT_DECL_OBJDUMP | ||
7029 | # -------------- | ||
7030 | # If we don't have a new enough Autoconf to choose the best objdump | ||
7031 | # available, choose the one first in the user's PATH. | ||
7032 | m4_defun([_LT_DECL_OBJDUMP], | ||
7033 | [AC_CHECK_TOOL(OBJDUMP, objdump, false) | ||
7034 | test -z "$OBJDUMP" && OBJDUMP=objdump | ||
7035 | _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) | ||
7036 | AC_SUBST([OBJDUMP]) | ||
7037 | ]) | ||
7038 | |||
7039 | |||
7040 | # _LT_DECL_SED | 6989 | # _LT_DECL_SED |
7041 | # ------------ | 6990 | # ------------ |
7042 | # Check for a fully-functional sed program, that truncates | 6991 | # Check for a fully-functional sed program, that truncates |
diff --git a/m4/ltdl.m4 b/m4/ltdl.m4 index 46535e2e1..eb8db0cd1 100644 --- a/m4/ltdl.m4 +++ b/m4/ltdl.m4 | |||
@@ -7,7 +7,7 @@ | |||
7 | # unlimited permission to copy and/or distribute it, with or without | 7 | # unlimited permission to copy and/or distribute it, with or without |
8 | # modifications, as long as this notice is preserved. | 8 | # modifications, as long as this notice is preserved. |
9 | 9 | ||
10 | # serial 17 LTDL_INIT | 10 | # serial 15 LTDL_INIT |
11 | 11 | ||
12 | # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) | 12 | # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) |
13 | # ------------------------------------------ | 13 | # ------------------------------------------ |
@@ -212,10 +212,26 @@ m4_define([$0], []) | |||
212 | # of into LIBOBJS. | 212 | # of into LIBOBJS. |
213 | AC_DEFUN([_LT_LIBOBJ], [ | 213 | AC_DEFUN([_LT_LIBOBJ], [ |
214 | m4_pattern_allow([^_LT_LIBOBJS$]) | 214 | m4_pattern_allow([^_LT_LIBOBJS$]) |
215 | AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl | ||
215 | _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" | 216 | _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" |
216 | ])# _LT_LIBOBJS | 217 | ])# _LT_LIBOBJS |
217 | 218 | ||
218 | 219 | ||
220 | # _LT_LIBSOURCES(MODULE_NAMES) | ||
221 | # ---------------------------- | ||
222 | # Like AC_LIBSOURCES, except the directory where the libltdl source files | ||
223 | # are expected is distinct from the user LIBOBJ directory. | ||
224 | AC_DEFUN([_LT_LIBSOURCES], [ | ||
225 | m4_foreach([_LTNAME], [$1], [ | ||
226 | m4_syscmd([test -r "$lt_libobj_prefix]_LTNAME[" || | ||
227 | test -z "$lt_libobj_prefix" || | ||
228 | test ! -d "$lt_libobj_prefix"])dnl | ||
229 | m4_if(m4_sysval, [0], [], | ||
230 | [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)]) | ||
231 | ]) | ||
232 | ])# _LT_LIBSOURCES | ||
233 | |||
234 | |||
219 | # LTDL_INIT([OPTIONS]) | 235 | # LTDL_INIT([OPTIONS]) |
220 | # -------------------- | 236 | # -------------------- |
221 | # Clients of libltdl can use this macro to allow the installer to | 237 | # Clients of libltdl can use this macro to allow the installer to |
@@ -229,9 +245,9 @@ _LT_SET_OPTIONS([$0], [$1]) | |||
229 | 245 | ||
230 | dnl We need to keep our own list of libobjs separate from our parent project, | 246 | dnl We need to keep our own list of libobjs separate from our parent project, |
231 | dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while | 247 | dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while |
232 | dnl we look for our own LIBOBJs. | 248 | dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4. |
233 | m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) | 249 | m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) |
234 | m4_pushdef([AC_LIBSOURCES]) | 250 | m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES])) |
235 | 251 | ||
236 | dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: | 252 | dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: |
237 | m4_if(_LTDL_MODE, [], | 253 | m4_if(_LTDL_MODE, [], |
@@ -248,7 +264,7 @@ if test "x$with_included_ltdl" != xyes; then | |||
248 | # decide whether there is a useful installed version we can use. | 264 | # decide whether there is a useful installed version we can use. |
249 | AC_CHECK_HEADER([ltdl.h], | 265 | AC_CHECK_HEADER([ltdl.h], |
250 | [AC_CHECK_DECL([lt_dlinterface_register], | 266 | [AC_CHECK_DECL([lt_dlinterface_register], |
251 | [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], | 267 | [AC_CHECK_LIB([ltdl], [lt_dlinterface_register], |
252 | [with_included_ltdl=no], | 268 | [with_included_ltdl=no], |
253 | [with_included_ltdl=yes])], | 269 | [with_included_ltdl=yes])], |
254 | [with_included_ltdl=yes], | 270 | [with_included_ltdl=yes], |
@@ -380,6 +396,12 @@ m4_require([_LT_HEADER_DLFCN])dnl | |||
380 | m4_require([_LT_CHECK_DLPREOPEN])dnl | 396 | m4_require([_LT_CHECK_DLPREOPEN])dnl |
381 | m4_require([_LT_DECL_SED])dnl | 397 | m4_require([_LT_DECL_SED])dnl |
382 | 398 | ||
399 | # lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT | ||
400 | if test "$lt_cv_dlopen_self" = yes; then | ||
401 | AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1], | ||
402 | [Define if dlopen(NULL) is able to resolve symbols from the main program.]) | ||
403 | fi | ||
404 | |||
383 | dnl Don't require this, or it will be expanded earlier than the code | 405 | dnl Don't require this, or it will be expanded earlier than the code |
384 | dnl that sets the variables it relies on: | 406 | dnl that sets the variables it relies on: |
385 | _LT_ENABLE_INSTALL | 407 | _LT_ENABLE_INSTALL |
@@ -407,8 +429,6 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], | |||
407 | AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) | 429 | AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) |
408 | AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) | 430 | AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) |
409 | 431 | ||
410 | AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) | ||
411 | |||
412 | name=ltdl | 432 | name=ltdl |
413 | LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""` | 433 | LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""` |
414 | AC_SUBST([LTDLOPEN]) | 434 | AC_SUBST([LTDLOPEN]) |
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index 34151a3ba..e97011948 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 | |||
@@ -125,7 +125,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll], | |||
125 | [enable_win32_dll=yes | 125 | [enable_win32_dll=yes |
126 | 126 | ||
127 | case $host in | 127 | case $host in |
128 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) | 128 | *-*-cygwin* | *-*-mingw* | *-*-pw32*) |
129 | AC_CHECK_TOOL(AS, as, false) | 129 | AC_CHECK_TOOL(AS, as, false) |
130 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) | 130 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) |
131 | AC_CHECK_TOOL(OBJDUMP, objdump, false) | 131 | AC_CHECK_TOOL(OBJDUMP, objdump, false) |
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index 9000a057d..0d258e070 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- | 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- |
2 | # | 2 | # |
3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. | 3 | # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. |
4 | # Written by Gary V. Vaughan, 2004 | 4 | # Written by Gary V. Vaughan, 2004 |
5 | # | 5 | # |
6 | # This file is free software; the Free Software Foundation gives | 6 | # This file is free software; the Free Software Foundation gives |
7 | # unlimited permission to copy and/or distribute it, with or without | 7 | # unlimited permission to copy and/or distribute it, with or without |
8 | # modifications, as long as this notice is preserved. | 8 | # modifications, as long as this notice is preserved. |
9 | 9 | ||
10 | # serial 6 ltsugar.m4 | 10 | # serial 5 ltsugar.m4 |
11 | 11 | ||
12 | # This is to help aclocal find these macros, as it can't see m4_define. | 12 | # This is to help aclocal find these macros, as it can't see m4_define. |
13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) | 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) |
@@ -63,14 +63,14 @@ m4_define([lt_append], | |||
63 | # Produce a SEP delimited list of all paired combinations of elements of | 63 | # Produce a SEP delimited list of all paired combinations of elements of |
64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list | 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list |
65 | # has the form PREFIXmINFIXSUFFIXn. | 65 | # has the form PREFIXmINFIXSUFFIXn. |
66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. | ||
67 | m4_define([lt_combine], | 66 | m4_define([lt_combine], |
68 | [m4_if(m4_eval([$# > 3]), [1], | 67 | [m4_if([$2], [], [], |
69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl | 68 | [m4_if([$4], [], [], |
70 | [[m4_foreach([_Lt_prefix], [$2], | 69 | [lt_join(m4_quote(m4_default([$1], [[, ]])), |
71 | [m4_foreach([_Lt_suffix], | 70 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2], |
72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, | 71 | [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]), |
73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) | 72 | [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl |
73 | ]) | ||
74 | 74 | ||
75 | 75 | ||
76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) |
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index b8e154fe6..45cb1557c 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 | |||
@@ -9,15 +9,15 @@ | |||
9 | 9 | ||
10 | # Generated from ltversion.in. | 10 | # Generated from ltversion.in. |
11 | 11 | ||
12 | # serial 3012 ltversion.m4 | 12 | # serial 2976 ltversion.m4 |
13 | # This file is part of GNU Libtool | 13 | # This file is part of GNU Libtool |
14 | 14 | ||
15 | m4_define([LT_PACKAGE_VERSION], [2.2.6]) | 15 | m4_define([LT_PACKAGE_VERSION], [2.2.4]) |
16 | m4_define([LT_PACKAGE_REVISION], [1.3012]) | 16 | m4_define([LT_PACKAGE_REVISION], [1.2976]) |
17 | 17 | ||
18 | AC_DEFUN([LTVERSION_VERSION], | 18 | AC_DEFUN([LTVERSION_VERSION], |
19 | [macro_version='2.2.6' | 19 | [macro_version='2.2.4' |
20 | macro_revision='1.3012' | 20 | macro_revision='1.2976' |
21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) | 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) |
22 | _LT_DECL(, macro_revision, 0) | 22 | _LT_DECL(, macro_revision, 0) |
23 | ]) | 23 | ]) |
diff --git a/src/core/core.h b/src/core/core.h index fe8bcf9cc..ebdac0aaa 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -198,7 +198,7 @@ struct RequestConfigureMessage | |||
198 | * the specified amont. The traffic preference is used to determine | 198 | * the specified amont. The traffic preference is used to determine |
199 | * the share of bandwidth this peer will typcially be assigned. | 199 | * the share of bandwidth this peer will typcially be assigned. |
200 | */ | 200 | */ |
201 | double preference_change GNUNET_PACKED; | 201 | uint64_t preference_change GNUNET_PACKED; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Identity of the peer being configured. | 204 | * Identity of the peer being configured. |
diff --git a/src/core/core_api.c b/src/core/core_api.c index 02379e36e..931ffe97e 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -904,7 +904,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle, | |||
904 | struct GNUNET_TIME_Relative timeout, | 904 | struct GNUNET_TIME_Relative timeout, |
905 | unsigned int bpm_out, | 905 | unsigned int bpm_out, |
906 | int amount, | 906 | int amount, |
907 | double preference, | 907 | unsigned long long preference, |
908 | GNUNET_CORE_PeerConfigurationInfoCallback info, | 908 | GNUNET_CORE_PeerConfigurationInfoCallback info, |
909 | void *info_cls) | 909 | void *info_cls) |
910 | { | 910 | { |
@@ -938,7 +938,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle, | |||
938 | rcm->reserved = htonl (0); | 938 | rcm->reserved = htonl (0); |
939 | rcm->limit_outbound_bpm = htonl (bpm_out); | 939 | rcm->limit_outbound_bpm = htonl (bpm_out); |
940 | rcm->reserve_inbound = htonl (amount); | 940 | rcm->reserve_inbound = htonl (amount); |
941 | rcm->preference_change = preference; | 941 | rcm->preference_change = GNUNET_htonll(preference); |
942 | rcm->peer = *peer; | 942 | rcm->peer = *peer; |
943 | if (handle->pending_head == th) | 943 | if (handle->pending_head == th) |
944 | trigger_next_request (handle); | 944 | trigger_next_request (handle); |
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 5996a81bf..0d714be3f 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -25,11 +25,7 @@ | |||
25 | * | 25 | * |
26 | * POST-TESTING: | 26 | * POST-TESTING: |
27 | * - revisit API (which arguments are used, needed)? | 27 | * - revisit API (which arguments are used, needed)? |
28 | * - add code to re-transmit key if first attempt failed | 28 | * - add code to send PINGs if we are about to time-out otherwise (?) |
29 | * + timeout on connect / key exchange, etc. | ||
30 | * + timeout for automatic re-try, etc. | ||
31 | * - add code to give up re-transmission of key if many attempts fail | ||
32 | * - add code to send PINGs if we are about to time-out otherwise | ||
33 | * ? add heuristic to do another send_key in "handle_set_key" | 29 | * ? add heuristic to do another send_key in "handle_set_key" |
34 | * in case previous attempt failed / didn't work / persist | 30 | * in case previous attempt failed / didn't work / persist |
35 | * (but don't do it always to avoid storm of SET_KEY's going | 31 | * (but don't do it always to avoid storm of SET_KEY's going |
@@ -47,6 +43,7 @@ | |||
47 | * could ideally be changed to O(1) hash map lookups) | 43 | * could ideally be changed to O(1) hash map lookups) |
48 | */ | 44 | */ |
49 | #include "platform.h" | 45 | #include "platform.h" |
46 | #include "gnunet_constants.h" | ||
50 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
51 | #include "gnunet_hello_lib.h" | 48 | #include "gnunet_hello_lib.h" |
52 | #include "gnunet_peerinfo_service.h" | 49 | #include "gnunet_peerinfo_service.h" |
@@ -63,14 +60,18 @@ | |||
63 | */ | 60 | */ |
64 | #define MAX_WINDOW_TIME (5 * 60 * 1000) | 61 | #define MAX_WINDOW_TIME (5 * 60 * 1000) |
65 | 62 | ||
66 | |||
67 | /** | 63 | /** |
68 | * Amount of bytes per minute (in/out) to assume initially | 64 | * Minimum of bytes per minute (out) to assign to any connected peer. |
69 | * (before either peer has communicated any particular | 65 | * Should be rather low; values larger than DEFAULT_BPM_IN_OUT make no |
70 | * preference). Should be rather low. | 66 | * sense. |
71 | */ | 67 | */ |
72 | #define DEFAULT_BPM_IN_OUT 2048 | 68 | #define MIN_BPM_PER_PEER GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT |
73 | 69 | ||
70 | /** | ||
71 | * What is the smallest change (in number of bytes per minute) | ||
72 | * that we consider significant enough to bother triggering? | ||
73 | */ | ||
74 | #define MIN_BPM_CHANGE 32 | ||
74 | 75 | ||
75 | /** | 76 | /** |
76 | * After how much time past the "official" expiration time do | 77 | * After how much time past the "official" expiration time do |
@@ -81,61 +82,56 @@ | |||
81 | */ | 82 | */ |
82 | #define PAST_EXPIRATION_DISCARD_TIME GNUNET_TIME_UNIT_SECONDS | 83 | #define PAST_EXPIRATION_DISCARD_TIME GNUNET_TIME_UNIT_SECONDS |
83 | 84 | ||
84 | |||
85 | /** | 85 | /** |
86 | * What is the maximum delay for a SET_KEY message? | 86 | * What is the maximum delay for a SET_KEY message? |
87 | */ | 87 | */ |
88 | #define MAX_SET_KEY_DELAY GNUNET_TIME_UNIT_SECONDS | 88 | #define MAX_SET_KEY_DELAY GNUNET_TIME_UNIT_SECONDS |
89 | 89 | ||
90 | |||
91 | /** | 90 | /** |
92 | * What how long do we wait for SET_KEY confirmation initially? | 91 | * What how long do we wait for SET_KEY confirmation initially? |
93 | */ | 92 | */ |
94 | #define INITIAL_SET_KEY_RETRY_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | 93 | #define INITIAL_SET_KEY_RETRY_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) |
95 | 94 | ||
96 | |||
97 | /** | 95 | /** |
98 | * What is the maximum delay for a PING message? | 96 | * What is the maximum delay for a PING message? |
99 | */ | 97 | */ |
100 | #define MAX_PING_DELAY GNUNET_TIME_UNIT_SECONDS | 98 | #define MAX_PING_DELAY GNUNET_TIME_UNIT_SECONDS |
101 | 99 | ||
102 | |||
103 | /** | 100 | /** |
104 | * What is the maximum delay for a PONG message? | 101 | * What is the maximum delay for a PONG message? |
105 | */ | 102 | */ |
106 | #define MAX_PONG_DELAY GNUNET_TIME_UNIT_SECONDS | 103 | #define MAX_PONG_DELAY GNUNET_TIME_UNIT_SECONDS |
107 | 104 | ||
105 | /** | ||
106 | * How often do we recalculate bandwidth quotas? | ||
107 | */ | ||
108 | #define QUOTA_UPDATE_FREQUENCY GNUNET_TIME_UNIT_SECONDS | ||
108 | 109 | ||
109 | /** | 110 | /** |
110 | * What is the priority for a SET_KEY message? | 111 | * What is the priority for a SET_KEY message? |
111 | */ | 112 | */ |
112 | #define SET_KEY_PRIORITY 0xFFFFFF | 113 | #define SET_KEY_PRIORITY 0xFFFFFF |
113 | 114 | ||
114 | |||
115 | /** | 115 | /** |
116 | * What is the priority for a PING message? | 116 | * What is the priority for a PING message? |
117 | */ | 117 | */ |
118 | #define PING_PRIORITY 0xFFFFFF | 118 | #define PING_PRIORITY 0xFFFFFF |
119 | 119 | ||
120 | |||
121 | /** | 120 | /** |
122 | * What is the priority for a PONG message? | 121 | * What is the priority for a PONG message? |
123 | */ | 122 | */ |
124 | #define PONG_PRIORITY 0xFFFFFF | 123 | #define PONG_PRIORITY 0xFFFFFF |
125 | 124 | ||
126 | |||
127 | /** | 125 | /** |
128 | * How many messages do we queue per peer at most? | 126 | * How many messages do we queue per peer at most? |
129 | */ | 127 | */ |
130 | #define MAX_PEER_QUEUE_SIZE 16 | 128 | #define MAX_PEER_QUEUE_SIZE 16 |
131 | 129 | ||
132 | |||
133 | /** | 130 | /** |
134 | * How many non-mandatory messages do we queue per client at most? | 131 | * How many non-mandatory messages do we queue per client at most? |
135 | */ | 132 | */ |
136 | #define MAX_CLIENT_QUEUE_SIZE 32 | 133 | #define MAX_CLIENT_QUEUE_SIZE 32 |
137 | 134 | ||
138 | |||
139 | /** | 135 | /** |
140 | * What is the maximum age of a message for us to consider | 136 | * What is the maximum age of a message for us to consider |
141 | * processing it? Note that this looks at the timestamp used | 137 | * processing it? Note that this looks at the timestamp used |
@@ -146,7 +142,6 @@ | |||
146 | */ | 142 | */ |
147 | #define MAX_MESSAGE_AGE GNUNET_TIME_UNIT_DAYS | 143 | #define MAX_MESSAGE_AGE GNUNET_TIME_UNIT_DAYS |
148 | 144 | ||
149 | |||
150 | /** | 145 | /** |
151 | * What is the maximum size for encrypted messages? Note that this | 146 | * What is the maximum size for encrypted messages? Note that this |
152 | * number imposes a clear limit on the maximum size of any message. | 147 | * number imposes a clear limit on the maximum size of any message. |
@@ -179,6 +174,7 @@ enum PeerStateMachine | |||
179 | */ | 174 | */ |
180 | #define ENCRYPTED_HEADER_SIZE (sizeof(struct GNUNET_MessageHeader) + sizeof(uint32_t) + sizeof(GNUNET_HashCode)) | 175 | #define ENCRYPTED_HEADER_SIZE (sizeof(struct GNUNET_MessageHeader) + sizeof(uint32_t) + sizeof(GNUNET_HashCode)) |
181 | 176 | ||
177 | |||
182 | /** | 178 | /** |
183 | * Encapsulation for encrypted messages exchanged between | 179 | * Encapsulation for encrypted messages exchanged between |
184 | * peers. Followed by the actual encrypted data. | 180 | * peers. Followed by the actual encrypted data. |
@@ -403,6 +399,11 @@ struct Neighbour | |||
403 | GNUNET_SCHEDULER_TaskIdentifier retry_set_key_task; | 399 | GNUNET_SCHEDULER_TaskIdentifier retry_set_key_task; |
404 | 400 | ||
405 | /** | 401 | /** |
402 | * ID of task used for updating bandwidth quota for this neighbour. | ||
403 | */ | ||
404 | GNUNET_SCHEDULER_TaskIdentifier quota_update_task; | ||
405 | |||
406 | /** | ||
406 | * At what time did we generate our encryption key? | 407 | * At what time did we generate our encryption key? |
407 | */ | 408 | */ |
408 | struct GNUNET_TIME_Absolute encrypt_key_created; | 409 | struct GNUNET_TIME_Absolute encrypt_key_created; |
@@ -430,7 +431,7 @@ struct Neighbour | |||
430 | struct GNUNET_TIME_Relative last_latency; | 431 | struct GNUNET_TIME_Relative last_latency; |
431 | 432 | ||
432 | /** | 433 | /** |
433 | * At what frequency are we currently re-trying SET KEY messages? | 434 | * At what frequency are we currently re-trying SET_KEY messages? |
434 | */ | 435 | */ |
435 | struct GNUNET_TIME_Relative set_key_retry_frequency; | 436 | struct GNUNET_TIME_Relative set_key_retry_frequency; |
436 | 437 | ||
@@ -465,7 +466,7 @@ struct Neighbour | |||
465 | /** | 466 | /** |
466 | * How valueable were the messages of this peer recently? | 467 | * How valueable were the messages of this peer recently? |
467 | */ | 468 | */ |
468 | double current_preference; | 469 | unsigned long long current_preference; |
469 | 470 | ||
470 | /** | 471 | /** |
471 | * Bit map indicating which of the 32 sequence numbers before the last | 472 | * Bit map indicating which of the 32 sequence numbers before the last |
@@ -501,7 +502,7 @@ struct Neighbour | |||
501 | 502 | ||
502 | /** | 503 | /** |
503 | * Internal bandwidth limit set for this peer (initially | 504 | * Internal bandwidth limit set for this peer (initially |
504 | * typcially set to "-1"). "bpm_out" is MAX of | 505 | * typically set to "-1"). "bpm_out" is MAX of |
505 | * "bpm_out_internal_limit" and "bpm_out_external_limit". | 506 | * "bpm_out_internal_limit" and "bpm_out_external_limit". |
506 | */ | 507 | */ |
507 | uint32_t bpm_out_internal_limit; | 508 | uint32_t bpm_out_internal_limit; |
@@ -641,14 +642,63 @@ static struct GNUNET_SERVER_Handle *server; | |||
641 | static struct GNUNET_TRANSPORT_Handle *transport; | 642 | static struct GNUNET_TRANSPORT_Handle *transport; |
642 | 643 | ||
643 | /** | 644 | /** |
645 | * Linked list of our clients. | ||
646 | */ | ||
647 | static struct Client *clients; | ||
648 | |||
649 | /** | ||
644 | * We keep neighbours in a linked list (for now). | 650 | * We keep neighbours in a linked list (for now). |
645 | */ | 651 | */ |
646 | static struct Neighbour *neighbours; | 652 | static struct Neighbour *neighbours; |
647 | 653 | ||
648 | /** | 654 | /** |
649 | * Linked list of our clients. | 655 | * Sum of all preferences among all neighbours. |
650 | */ | 656 | */ |
651 | static struct Client *clients; | 657 | static unsigned long long preference_sum; |
658 | |||
659 | /** | ||
660 | * Total number of neighbours we have. | ||
661 | */ | ||
662 | static unsigned int neighbour_count; | ||
663 | |||
664 | /** | ||
665 | * How much inbound bandwidth are we supposed to be using? | ||
666 | */ | ||
667 | static unsigned long long bandwidth_target_in; | ||
668 | |||
669 | /** | ||
670 | * How much outbound bandwidth are we supposed to be using? | ||
671 | */ | ||
672 | static unsigned long long bandwidth_target_out; | ||
673 | |||
674 | |||
675 | |||
676 | /** | ||
677 | * A preference value for a neighbour was update. Update | ||
678 | * the preference sum accordingly. | ||
679 | * | ||
680 | * @param inc how much was a preference value increased? | ||
681 | */ | ||
682 | static void | ||
683 | update_preference_sum (unsigned long long inc) | ||
684 | { | ||
685 | struct Neighbour *n; | ||
686 | unsigned long long os; | ||
687 | |||
688 | os = preference_sum; | ||
689 | preference_sum += inc; | ||
690 | if (preference_sum >= os) | ||
691 | return; /* done! */ | ||
692 | /* overflow! compensate by cutting all values in half! */ | ||
693 | preference_sum = 0; | ||
694 | n = neighbours; | ||
695 | while (n != NULL) | ||
696 | { | ||
697 | n->current_preference /= 2; | ||
698 | preference_sum += n->current_preference; | ||
699 | n = n->next; | ||
700 | } | ||
701 | } | ||
652 | 702 | ||
653 | 703 | ||
654 | /** | 704 | /** |
@@ -1010,6 +1060,7 @@ handle_client_request_configure (void *cls, | |||
1010 | struct ConfigurationInfoMessage cim; | 1060 | struct ConfigurationInfoMessage cim; |
1011 | struct Client *c; | 1061 | struct Client *c; |
1012 | int reserv; | 1062 | int reserv; |
1063 | unsigned long long old_preference; | ||
1013 | 1064 | ||
1014 | #if DEBUG_CORE_CLIENT | 1065 | #if DEBUG_CORE_CLIENT |
1015 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1066 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1036,9 +1087,14 @@ handle_client_request_configure (void *cls, | |||
1036 | reserv = n->available_recv_window; | 1087 | reserv = n->available_recv_window; |
1037 | n->available_recv_window -= reserv; | 1088 | n->available_recv_window -= reserv; |
1038 | } | 1089 | } |
1039 | n->current_preference += rcm->preference_change; | 1090 | old_preference = n->current_preference; |
1040 | if (n->current_preference < 0) | 1091 | n->current_preference += GNUNET_ntohll(rcm->preference_change); |
1041 | n->current_preference = 0; | 1092 | if (old_preference > n->current_preference) |
1093 | { | ||
1094 | /* overflow; cap at maximum value */ | ||
1095 | n->current_preference = (unsigned long long) -1; | ||
1096 | } | ||
1097 | update_preference_sum (n->current_preference - old_preference); | ||
1042 | cim.reserved_amount = htonl (reserv); | 1098 | cim.reserved_amount = htonl (reserv); |
1043 | cim.bpm_in = htonl (n->bpm_in); | 1099 | cim.bpm_in = htonl (n->bpm_in); |
1044 | cim.bpm_out = htonl (n->bpm_out); | 1100 | cim.bpm_out = htonl (n->bpm_out); |
@@ -2800,6 +2856,87 @@ handle_transport_receive (void *cls, | |||
2800 | 2856 | ||
2801 | 2857 | ||
2802 | /** | 2858 | /** |
2859 | * Function that recalculates the bandwidth quota for the | ||
2860 | * given neighbour and transmits it to the transport service. | ||
2861 | * | ||
2862 | * @param cls neighbour for the quota update | ||
2863 | * @param tc context | ||
2864 | */ | ||
2865 | static void | ||
2866 | neighbour_quota_update (void *cls, | ||
2867 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
2868 | |||
2869 | |||
2870 | /** | ||
2871 | * Schedule the task that will recalculate the bandwidth | ||
2872 | * quota for this peer (and possibly force a disconnect of | ||
2873 | * idle peers by calculating a bandwidth of zero). | ||
2874 | */ | ||
2875 | static void | ||
2876 | schedule_quota_update (struct Neighbour *n) | ||
2877 | { | ||
2878 | GNUNET_assert (n->quota_update_task == | ||
2879 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK); | ||
2880 | n->quota_update_task | ||
2881 | = GNUNET_SCHEDULER_add_delayed (sched, | ||
2882 | GNUNET_NO, | ||
2883 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
2884 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | ||
2885 | QUOTA_UPDATE_FREQUENCY, | ||
2886 | &neighbour_quota_update, | ||
2887 | n); | ||
2888 | } | ||
2889 | |||
2890 | |||
2891 | /** | ||
2892 | * Function that recalculates the bandwidth quota for the | ||
2893 | * given neighbour and transmits it to the transport service. | ||
2894 | * | ||
2895 | * @param cls neighbour for the quota update | ||
2896 | * @param tc context | ||
2897 | */ | ||
2898 | static void | ||
2899 | neighbour_quota_update (void *cls, | ||
2900 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
2901 | { | ||
2902 | struct Neighbour *n = cls; | ||
2903 | uint32_t q_in; | ||
2904 | double pref_rel; | ||
2905 | double share; | ||
2906 | unsigned long long distributable; | ||
2907 | |||
2908 | n->quota_update_task = GNUNET_SCHEDULER_NO_PREREQUISITE_TASK; | ||
2909 | /* calculate relative preference among all neighbours; | ||
2910 | divides by a bit more to avoid division by zero AND to | ||
2911 | account for possibility of new neighbours joining any time | ||
2912 | AND to convert to double... */ | ||
2913 | pref_rel = n->current_preference / (1.0 + preference_sum); | ||
2914 | share = 0; | ||
2915 | distributable = 0; | ||
2916 | if (bandwidth_target_out > neighbour_count * MIN_BPM_PER_PEER) | ||
2917 | distributable = bandwidth_target_out - neighbour_count * MIN_BPM_PER_PEER; | ||
2918 | share = distributable * pref_rel; | ||
2919 | q_in = MIN_BPM_PER_PEER + (unsigned long long) share; | ||
2920 | /* check if we want to disconnect for good due to inactivity */ | ||
2921 | if ( (GNUNET_TIME_absolute_get_duration (n->last_activity).value > GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.value) && | ||
2922 | (GNUNET_TIME_absolute_get_duration (n->time_established).value > GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.value) ) | ||
2923 | q_in = 0; /* force disconnect */ | ||
2924 | if ( (n->bpm_in + MIN_BPM_CHANGE < q_in) || | ||
2925 | (n->bpm_in - MIN_BPM_CHANGE > q_in) ) | ||
2926 | { | ||
2927 | n->bpm_in = q_in; | ||
2928 | GNUNET_TRANSPORT_set_quota (transport, | ||
2929 | &n->peer, | ||
2930 | n->bpm_in, | ||
2931 | n->bpm_out, | ||
2932 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2933 | NULL, NULL); | ||
2934 | } | ||
2935 | schedule_quota_update (n); | ||
2936 | } | ||
2937 | |||
2938 | |||
2939 | /** | ||
2803 | * Function called by transport to notify us that | 2940 | * Function called by transport to notify us that |
2804 | * a peer connected to us (on the network level). | 2941 | * a peer connected to us (on the network level). |
2805 | * | 2942 | * |
@@ -2827,6 +2964,7 @@ handle_transport_notify_connect (void *cls, | |||
2827 | n = GNUNET_malloc (sizeof (struct Neighbour)); | 2964 | n = GNUNET_malloc (sizeof (struct Neighbour)); |
2828 | n->next = neighbours; | 2965 | n->next = neighbours; |
2829 | neighbours = n; | 2966 | neighbours = n; |
2967 | neighbour_count++; | ||
2830 | n->peer = *peer; | 2968 | n->peer = *peer; |
2831 | n->last_latency = latency; | 2969 | n->last_latency = latency; |
2832 | GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key); | 2970 | GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key); |
@@ -2834,10 +2972,10 @@ handle_transport_notify_connect (void *cls, | |||
2834 | n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; | 2972 | n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; |
2835 | n->last_asw_update = now; | 2973 | n->last_asw_update = now; |
2836 | n->last_arw_update = now; | 2974 | n->last_arw_update = now; |
2837 | n->bpm_in = DEFAULT_BPM_IN_OUT; | 2975 | n->bpm_in = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT; |
2838 | n->bpm_out = DEFAULT_BPM_IN_OUT; | 2976 | n->bpm_out = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT; |
2839 | n->bpm_out_internal_limit = (uint32_t) - 1; | 2977 | n->bpm_out_internal_limit = (uint32_t) - 1; |
2840 | n->bpm_out_external_limit = DEFAULT_BPM_IN_OUT; | 2978 | n->bpm_out_external_limit = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT; |
2841 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2979 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2842 | (uint32_t) - 1); | 2980 | (uint32_t) - 1); |
2843 | #if DEBUG_CORE | 2981 | #if DEBUG_CORE |
@@ -2845,9 +2983,10 @@ handle_transport_notify_connect (void *cls, | |||
2845 | "Received connection from `%4s'.\n", | 2983 | "Received connection from `%4s'.\n", |
2846 | GNUNET_i2s (&n->peer)); | 2984 | GNUNET_i2s (&n->peer)); |
2847 | #endif | 2985 | #endif |
2986 | schedule_quota_update (n); | ||
2848 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 2987 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
2849 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 2988 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
2850 | cnm.bpm_available = htonl (DEFAULT_BPM_IN_OUT); | 2989 | cnm.bpm_available = htonl (n->bpm_out); |
2851 | cnm.peer = *peer; | 2990 | cnm.peer = *peer; |
2852 | cnm.last_activity = GNUNET_TIME_absolute_hton (now); | 2991 | cnm.last_activity = GNUNET_TIME_absolute_hton (now); |
2853 | send_to_all_clients (&cnm.header, GNUNET_YES); | 2992 | send_to_all_clients (&cnm.header, GNUNET_YES); |
@@ -2857,6 +2996,7 @@ handle_transport_notify_connect (void *cls, | |||
2857 | /** | 2996 | /** |
2858 | * Free the given entry for the neighbour (it has | 2997 | * Free the given entry for the neighbour (it has |
2859 | * already been removed from the list at this point). | 2998 | * already been removed from the list at this point). |
2999 | * | ||
2860 | * @param n neighbour to free | 3000 | * @param n neighbour to free |
2861 | */ | 3001 | */ |
2862 | static void | 3002 | static void |
@@ -2880,6 +3020,8 @@ free_neighbour (struct Neighbour *n) | |||
2880 | GNUNET_SCHEDULER_cancel (sched, n->retry_plaintext_task); | 3020 | GNUNET_SCHEDULER_cancel (sched, n->retry_plaintext_task); |
2881 | if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK) | 3021 | if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK) |
2882 | GNUNET_SCHEDULER_cancel (sched, n->retry_set_key_task); | 3022 | GNUNET_SCHEDULER_cancel (sched, n->retry_set_key_task); |
3023 | if (n->quota_update_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK) | ||
3024 | GNUNET_SCHEDULER_cancel (sched, n->quota_update_task); | ||
2883 | GNUNET_free_non_null (n->public_key); | 3025 | GNUNET_free_non_null (n->public_key); |
2884 | GNUNET_free_non_null (n->pending_ping); | 3026 | GNUNET_free_non_null (n->pending_ping); |
2885 | GNUNET_free (n); | 3027 | GNUNET_free (n); |
@@ -2922,6 +3064,8 @@ handle_transport_notify_disconnect (void *cls, | |||
2922 | neighbours = n->next; | 3064 | neighbours = n->next; |
2923 | else | 3065 | else |
2924 | p->next = n->next; | 3066 | p->next = n->next; |
3067 | GNUNET_assert (neighbour_count > 0); | ||
3068 | neighbour_count--; | ||
2925 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 3069 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
2926 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); | 3070 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT); |
2927 | cnm.bpm_available = htonl (0); | 3071 | cnm.bpm_available = htonl (0); |
@@ -2952,6 +3096,8 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2952 | while (NULL != (n = neighbours)) | 3096 | while (NULL != (n = neighbours)) |
2953 | { | 3097 | { |
2954 | neighbours = n->next; | 3098 | neighbours = n->next; |
3099 | GNUNET_assert (neighbour_count > 0); | ||
3100 | neighbour_count--; | ||
2955 | free_neighbour (n); | 3101 | free_neighbour (n); |
2956 | } | 3102 | } |
2957 | while (NULL != (c = clients)) | 3103 | while (NULL != (c = clients)) |
@@ -2983,12 +3129,17 @@ run (void *cls, | |||
2983 | cfg = c; | 3129 | cfg = c; |
2984 | /* parse configuration */ | 3130 | /* parse configuration */ |
2985 | if ( | 3131 | if ( |
2986 | #if 0 | ||
2987 | (GNUNET_OK != | 3132 | (GNUNET_OK != |
2988 | GNUNET_CONFIGURATION_get_value_number (c, | 3133 | GNUNET_CONFIGURATION_get_value_number (c, |
2989 | "CORE", | 3134 | "CORE", |
2990 | "XX", | 3135 | "TOTAL_QUOTA_IN", |
2991 | &qin)) || | 3136 | &bandwidth_target_in)) || |
3137 | (GNUNET_OK != | ||
3138 | GNUNET_CONFIGURATION_get_value_number (c, | ||
3139 | "CORE", | ||
3140 | "TOTAL_QUOTA_OUT", | ||
3141 | &bandwidth_target_out)) || | ||
3142 | #if 0 | ||
2992 | (GNUNET_OK != | 3143 | (GNUNET_OK != |
2993 | GNUNET_CONFIGURATION_get_value_number (c, | 3144 | GNUNET_CONFIGURATION_get_value_number (c, |
2994 | "CORE", | 3145 | "CORE", |
@@ -3052,8 +3203,6 @@ run (void *cls, | |||
3052 | static void | 3203 | static void |
3053 | cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) | 3204 | cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) |
3054 | { | 3205 | { |
3055 | |||
3056 | |||
3057 | if (my_private_key != NULL) | 3206 | if (my_private_key != NULL) |
3058 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | 3207 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
3059 | } | 3208 | } |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 8e572a583..d52b24a4f 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include "gnunet_scheduler_lib.h" | 34 | #include "gnunet_scheduler_lib.h" |
35 | #include "gnunet_transport_service.h" | 35 | #include "gnunet_transport_service.h" |
36 | 36 | ||
37 | #define VERBOSE GNUNET_YES | 37 | #define VERBOSE GNUNET_NO |
38 | 38 | ||
39 | #define START_ARM GNUNET_YES | 39 | #define START_ARM GNUNET_YES |
40 | 40 | ||
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 8c49690e7..bc832c444 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -15,6 +15,7 @@ gnunetinclude_HEADERS = \ | |||
15 | gnunet_arm_service.h \ | 15 | gnunet_arm_service.h \ |
16 | gnunet_client_lib.h \ | 16 | gnunet_client_lib.h \ |
17 | gnunet_common.h \ | 17 | gnunet_common.h \ |
18 | gnunet_constants.h \ | ||
18 | gnunet_configuration_lib.h \ | 19 | gnunet_configuration_lib.h \ |
19 | gnunet_container_lib.h \ | 20 | gnunet_container_lib.h \ |
20 | gnunet_core_service.h \ | 21 | gnunet_core_service.h \ |
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h new file mode 100644 index 000000000..99ed77537 --- /dev/null +++ b/src/include/gnunet_constants.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/gnunet_constants.h | ||
23 | * @brief "global" constants for performance tuning | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #ifndef GNUNET_CONSTANTS_H | ||
28 | #define GNUNET_CONSTANTS_H | ||
29 | |||
30 | #ifdef __cplusplus | ||
31 | extern "C" | ||
32 | { | ||
33 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
34 | } | ||
35 | #endif | ||
36 | #endif | ||
37 | |||
38 | /** | ||
39 | * Amount of bytes per minute (in/out) to assume initially (before | ||
40 | * either peer has communicated any particular preference). Should be | ||
41 | * rather low; set so that at least one maximum-size message can be | ||
42 | * send each minute. | ||
43 | */ | ||
44 | #define GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT GNUNET_SERVER_MAX_MESSAGE_SIZE | ||
45 | |||
46 | /** | ||
47 | * After how long do we consider a connection to a peer dead | ||
48 | * if we don't receive messages from the peer? | ||
49 | */ | ||
50 | #define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
51 | |||
52 | |||
53 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
54 | { | ||
55 | #endif | ||
56 | #ifdef __cplusplus | ||
57 | } | ||
58 | #endif | ||
59 | |||
60 | #endif | ||
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 8b75271b9..be8f4baa0 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -219,7 +219,7 @@ typedef void | |||
219 | unsigned int bpm_out, | 219 | unsigned int bpm_out, |
220 | struct GNUNET_TIME_Relative | 220 | struct GNUNET_TIME_Relative |
221 | latency, int amount, | 221 | latency, int amount, |
222 | double preference); | 222 | unsigned long long preference); |
223 | 223 | ||
224 | 224 | ||
225 | /** | 225 | /** |
@@ -251,7 +251,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle, | |||
251 | struct GNUNET_TIME_Relative timeout, | 251 | struct GNUNET_TIME_Relative timeout, |
252 | unsigned int bpm_out, | 252 | unsigned int bpm_out, |
253 | int amount, | 253 | int amount, |
254 | double preference, | 254 | unsigned long long preference, |
255 | GNUNET_CORE_PeerConfigurationInfoCallback info, | 255 | GNUNET_CORE_PeerConfigurationInfoCallback info, |
256 | void *info_cls); | 256 | void *info_cls); |
257 | 257 | ||
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index da6ee9df8..f689b54c0 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_client_lib.h" | 31 | #include "gnunet_client_lib.h" |
32 | #include "gnunet_constants.h" | ||
32 | #include "gnunet_getopt_lib.h" | 33 | #include "gnunet_getopt_lib.h" |
33 | #include "gnunet_hello_lib.h" | 34 | #include "gnunet_hello_lib.h" |
34 | #include "gnunet_os_lib.h" | 35 | #include "gnunet_os_lib.h" |
@@ -82,12 +83,6 @@ | |||
82 | */ | 83 | */ |
83 | #define HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12) | 84 | #define HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12) |
84 | 85 | ||
85 | /** | ||
86 | * After how long do we consider a connection to a peer dead | ||
87 | * if we don't receive messages from the peer? | ||
88 | */ | ||
89 | #define IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) | ||
90 | |||
91 | 86 | ||
92 | /** | 87 | /** |
93 | * Entry in linked list of network addresses. | 88 | * Entry in linked list of network addresses. |
@@ -356,7 +351,7 @@ struct NeighbourList | |||
356 | uint64_t last_received; | 351 | uint64_t last_received; |
357 | 352 | ||
358 | /** | 353 | /** |
359 | * Global quota for outbound traffic for the neighbour in bytes/ms. | 354 | * Global quota for inbound traffic for the neighbour in bytes/ms. |
360 | */ | 355 | */ |
361 | uint32_t quota_in; | 356 | uint32_t quota_in; |
362 | 357 | ||
@@ -641,16 +636,6 @@ static struct GNUNET_SERVER_Handle *server; | |||
641 | static struct NeighbourList *neighbours; | 636 | static struct NeighbourList *neighbours; |
642 | 637 | ||
643 | /** | 638 | /** |
644 | * Default bandwidth quota for receiving for new peers in bytes/ms. | ||
645 | */ | ||
646 | static uint32_t default_quota_in; | ||
647 | |||
648 | /** | ||
649 | * Default bandwidth quota for sending for new peers in bytes/ms. | ||
650 | */ | ||
651 | static uint32_t default_quota_out; | ||
652 | |||
653 | /** | ||
654 | * Number of neighbours we'd like to have. | 639 | * Number of neighbours we'd like to have. |
655 | */ | 640 | */ |
656 | static uint32_t max_connect_per_transport; | 641 | static uint32_t max_connect_per_transport; |
@@ -930,7 +915,7 @@ transmit_send_continuation (void *cls, | |||
930 | } | 915 | } |
931 | if (result == GNUNET_OK) | 916 | if (result == GNUNET_OK) |
932 | { | 917 | { |
933 | rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT); | 918 | rl->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
934 | } | 919 | } |
935 | else | 920 | else |
936 | { | 921 | { |
@@ -1139,7 +1124,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1139 | rl, | 1124 | rl, |
1140 | &neighbour->id, | 1125 | &neighbour->id, |
1141 | mq->message, | 1126 | mq->message, |
1142 | IDLE_CONNECTION_TIMEOUT, | 1127 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
1143 | &transmit_send_continuation, mq); | 1128 | &transmit_send_continuation, mq); |
1144 | } | 1129 | } |
1145 | 1130 | ||
@@ -1510,7 +1495,7 @@ notify_clients_connect (const struct GNUNET_PeerIdentity *peer, | |||
1510 | #endif | 1495 | #endif |
1511 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); | 1496 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); |
1512 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 1497 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
1513 | cim.quota_out = htonl (default_quota_out); | 1498 | cim.quota_out = htonl (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT / (60*1000)); |
1514 | cim.latency = GNUNET_TIME_relative_hton (latency); | 1499 | cim.latency = GNUNET_TIME_relative_hton (latency); |
1515 | memcpy (&cim.id, peer, sizeof (struct GNUNET_PeerIdentity)); | 1500 | memcpy (&cim.id, peer, sizeof (struct GNUNET_PeerIdentity)); |
1516 | cpos = clients; | 1501 | cpos = clients; |
@@ -2196,15 +2181,15 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
2196 | n->id = *peer; | 2181 | n->id = *peer; |
2197 | n->last_quota_update = GNUNET_TIME_absolute_get (); | 2182 | n->last_quota_update = GNUNET_TIME_absolute_get (); |
2198 | n->peer_timeout = | 2183 | n->peer_timeout = |
2199 | GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT); | 2184 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2200 | n->quota_in = default_quota_in; | 2185 | n->quota_in = (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT + 59999) / (60 * 1000); |
2201 | add_plugins (n); | 2186 | add_plugins (n); |
2202 | n->hello_version_sent = our_hello_version; | 2187 | n->hello_version_sent = our_hello_version; |
2203 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 2188 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, |
2204 | GNUNET_NO, | 2189 | GNUNET_NO, |
2205 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 2190 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
2206 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | 2191 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, |
2207 | IDLE_CONNECTION_TIMEOUT, | 2192 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
2208 | &neighbour_timeout_task, n); | 2193 | &neighbour_timeout_task, n); |
2209 | transmit_to_peer (NULL, | 2194 | transmit_to_peer (NULL, |
2210 | (const struct GNUNET_MessageHeader *) our_hello, | 2195 | (const struct GNUNET_MessageHeader *) our_hello, |
@@ -2297,7 +2282,7 @@ plugin_env_receive (void *cls, | |||
2297 | service_context->connect_attempts++; | 2282 | service_context->connect_attempts++; |
2298 | } | 2283 | } |
2299 | service_context->timeout | 2284 | service_context->timeout |
2300 | = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT); | 2285 | = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2301 | service_context->plugin_handle = plugin_context; | 2286 | service_context->plugin_handle = plugin_context; |
2302 | service_context->latency = latency; | 2287 | service_context->latency = latency; |
2303 | } | 2288 | } |
@@ -2306,12 +2291,12 @@ plugin_env_receive (void *cls, | |||
2306 | n->last_received += msize; | 2291 | n->last_received += msize; |
2307 | GNUNET_SCHEDULER_cancel (sched, n->timeout_task); | 2292 | GNUNET_SCHEDULER_cancel (sched, n->timeout_task); |
2308 | n->peer_timeout = | 2293 | n->peer_timeout = |
2309 | GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT); | 2294 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
2310 | n->timeout_task = | 2295 | n->timeout_task = |
2311 | GNUNET_SCHEDULER_add_delayed (sched, GNUNET_NO, | 2296 | GNUNET_SCHEDULER_add_delayed (sched, GNUNET_NO, |
2312 | GNUNET_SCHEDULER_PRIORITY_IDLE, | 2297 | GNUNET_SCHEDULER_PRIORITY_IDLE, |
2313 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, | 2298 | GNUNET_SCHEDULER_NO_PREREQUISITE_TASK, |
2314 | IDLE_CONNECTION_TIMEOUT, | 2299 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
2315 | &neighbour_timeout_task, n); | 2300 | &neighbour_timeout_task, n); |
2316 | update_quota (n); | 2301 | update_quota (n); |
2317 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) | 2302 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) |
@@ -2426,7 +2411,7 @@ handle_start (void *cls, | |||
2426 | /* tell new client about all existing connections */ | 2411 | /* tell new client about all existing connections */ |
2427 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); | 2412 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); |
2428 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 2413 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
2429 | cim.quota_out = htonl (default_quota_out); | 2414 | cim.quota_out = htonl (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT / (60 * 1000)); |
2430 | cim.latency = GNUNET_TIME_relative_hton (GNUNET_TIME_UNIT_ZERO); /* FIXME? */ | 2415 | cim.latency = GNUNET_TIME_relative_hton (GNUNET_TIME_UNIT_ZERO); /* FIXME? */ |
2431 | im = GNUNET_malloc (sizeof (struct InboundMessage) + | 2416 | im = GNUNET_malloc (sizeof (struct InboundMessage) + |
2432 | sizeof (struct GNUNET_MessageHeader)); | 2417 | sizeof (struct GNUNET_MessageHeader)); |
@@ -2639,7 +2624,7 @@ create_environment (struct TransportPlugin *plug) | |||
2639 | plug->env.receive = &plugin_env_receive; | 2624 | plug->env.receive = &plugin_env_receive; |
2640 | plug->env.lookup = &plugin_env_lookup_address; | 2625 | plug->env.lookup = &plugin_env_lookup_address; |
2641 | plug->env.notify_address = &plugin_env_notify_address; | 2626 | plug->env.notify_address = &plugin_env_notify_address; |
2642 | plug->env.default_quota_in = default_quota_in; | 2627 | plug->env.default_quota_in = (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT + 59999) / (60 * 1000); |
2643 | plug->env.max_connections = max_connect_per_transport; | 2628 | plug->env.max_connections = max_connect_per_transport; |
2644 | } | 2629 | } |
2645 | 2630 | ||
@@ -2738,8 +2723,6 @@ run (void *cls, | |||
2738 | char *plugs; | 2723 | char *plugs; |
2739 | char *pos; | 2724 | char *pos; |
2740 | int no_transports; | 2725 | int no_transports; |
2741 | unsigned long long qin; | ||
2742 | unsigned long long qout; | ||
2743 | unsigned long long tneigh; | 2726 | unsigned long long tneigh; |
2744 | char *keyfile; | 2727 | char *keyfile; |
2745 | 2728 | ||
@@ -2749,16 +2732,6 @@ run (void *cls, | |||
2749 | if ((GNUNET_OK != | 2732 | if ((GNUNET_OK != |
2750 | GNUNET_CONFIGURATION_get_value_number (c, | 2733 | GNUNET_CONFIGURATION_get_value_number (c, |
2751 | "TRANSPORT", | 2734 | "TRANSPORT", |
2752 | "DEFAULT_QUOTA_IN", | ||
2753 | &qin)) || | ||
2754 | (GNUNET_OK != | ||
2755 | GNUNET_CONFIGURATION_get_value_number (c, | ||
2756 | "TRANSPORT", | ||
2757 | "DEFAULT_QUOTA_OUT", | ||
2758 | &qout)) || | ||
2759 | (GNUNET_OK != | ||
2760 | GNUNET_CONFIGURATION_get_value_number (c, | ||
2761 | "TRANSPORT", | ||
2762 | "NEIGHBOUR_LIMIT", | 2735 | "NEIGHBOUR_LIMIT", |
2763 | &tneigh)) || | 2736 | &tneigh)) || |
2764 | (GNUNET_OK != | 2737 | (GNUNET_OK != |
@@ -2773,8 +2746,6 @@ run (void *cls, | |||
2773 | return; | 2746 | return; |
2774 | } | 2747 | } |
2775 | max_connect_per_transport = (uint32_t) tneigh; | 2748 | max_connect_per_transport = (uint32_t) tneigh; |
2776 | default_quota_in = (uint32_t) qin; | ||
2777 | default_quota_out = (uint32_t) qout; | ||
2778 | my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 2749 | my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
2779 | GNUNET_free (keyfile); | 2750 | GNUNET_free (keyfile); |
2780 | if (my_private_key == NULL) | 2751 | if (my_private_key == NULL) |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index fb2451447..d38954445 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -92,7 +92,7 @@ struct NeighbourList | |||
92 | uint64_t last_sent; | 92 | uint64_t last_sent; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Global quota for outbound traffic to the neighbour in bytes/ms. | 95 | * Quota for outbound traffic to the neighbour in bytes/ms. |
96 | */ | 96 | */ |
97 | uint32_t quota_out; | 97 | uint32_t quota_out; |
98 | 98 | ||