timeout code
authorChristian Grothoff <christian@grothoff.org>
Wed, 10 Jun 2009 05:57:55 +0000 (05:57 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 10 Jun 2009 05:57:55 +0000 (05:57 +0000)
16 files changed:
contrib/defaults.conf
m4/argz.m4
m4/libtool.m4
m4/ltdl.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
src/core/core.h
src/core/core_api.c
src/core/gnunet-service-core.c
src/core/test_core_api.c
src/include/Makefile.am
src/include/gnunet_constants.h [new file with mode: 0644]
src/include/gnunet_core_service.h
src/transport/gnunet-service-transport.c
src/transport/transport_api.c

index d6100b77dba09e1b80ec0b0bc967aa8c78efa425..0dcf5d087dd41e0cf61518fe0845105d6191f5d7 100644 (file)
@@ -104,8 +104,6 @@ HOSTNAME = localhost
 HOME = $SERVICEHOME
 CONFIG = $DEFAULTCONFIG
 BINARY = gnunet-service-transport
-DEFAULT_QUOTA_IN = 50000
-DEFAULT_QUOTA_OUT = 50000
 NEIGHBOUR_LIMIT = 50
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
@@ -129,6 +127,9 @@ BINARY = gnunet-service-core
 ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 ALLOW_SHUTDOWN = YES
+# quotas are in bytes per minute now!
+TOTAL_QUOTA_IN = 3932160
+TOTAL_QUOTA_OUT = 3932160
 # USERNAME = 
 # MAXBUF =
 # TIMEOUT =
index 37c1b11e4b954d784dfc9662dbd3a71b6ead5b73..edc99bbce24acaa8f35b990630c34d2c070cf3b3 100644 (file)
@@ -28,14 +28,14 @@ ARGZ_H=
 AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \
        argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])])
 
-dnl if have system argz functions, allow forced use of
+dnl if have system argz functions, allow forced use of 
 dnl libltdl-supplied implementation (and default to do so
 dnl on "known bad" systems). Could use a runtime check, but
 dnl (a) detecting malloc issues is notoriously unreliable
 dnl (b) only known system that declares argz functions,
 dnl     provides them, yet they are broken, is cygwin
 dnl     releases prior to 16-Mar-2007 (1.5.24 and earlier)
-dnl So, it's more straightforward simply to special case
+dnl So, it's more straightforward simply to special case 
 dnl this for known bad systems.
 AS_IF([test -z "$ARGZ_H"],
     [AC_CACHE_CHECK(
index 1e7ea47c080122c2411d3b703333f404d19ff314..6e86e5b43e2e90432f6690c6c59706daf8557075 100644 (file)
@@ -380,12 +380,12 @@ m4_define([lt_decl_dquote_varnames],
 # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
 # ---------------------------------------------------
 m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
-    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
-    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_quote(m4_if([$2], [],
+                    m4_quote(lt_decl_tag_varnames),
+                 m4_quote(m4_shift($@)))),
+     m4_split(m4_normalize(m4_quote(_LT_TAGS))))])
+m4_define([_lt_decl_varnames_tagged], [lt_combine([$1], [$2], [_], $3)])
 
 
 # lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
@@ -945,10 +945,10 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
     darwin1.*)
       _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
+    darwin*) # darwin 5.x on 
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
+      # target defaults to 10.4. Don't you love it? 
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
          _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
@@ -990,11 +990,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
+  if test "$GCC" = "yes"; then
     output_verbose_link_cmd=echo
     _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}"
     _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
     lt_cv_sys_max_cmd_len=-1;
     ;;
 
-  cygwin* | mingw* | cegcc*)
+  cygwin* | mingw*)
     # On Win9x/ME, this test blows up -- it succeeds, but takes
     # about 5 minutes as the teststring grows exponentially.
     # Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1684,6 +1680,10 @@ else
 #  endif
 #endif
 
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
 void fnord() { int i=42;}
 int main ()
 {
@@ -1699,7 +1699,7 @@ int main ()
   else
     puts (dlerror ());
 
-  return status;
+    exit (status);
 }]
 _LT_EOF
   if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
@@ -1738,7 +1738,7 @@ else
     lt_cv_dlopen_self=yes
     ;;
 
-  mingw* | pw32* | cegcc*)
+  mingw* | pw32*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=
     ;;
@@ -2035,7 +2035,6 @@ m4_defun([_LT_SYS_DYNAMIC_LINKER],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
@@ -2200,14 +2199,14 @@ bsdi[[45]]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
   case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+  yes,cygwin* | yes,mingw* | yes,pw32*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2230,7 +2229,7 @@ cygwin* | mingw* | pw32* | cegcc*)
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
-    mingw* | cegcc*)
+    mingw*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
@@ -2668,7 +2667,7 @@ tpf*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -2692,7 +2691,7 @@ variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
-
 if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
   sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
@@ -2969,7 +2968,6 @@ _LT_DECL([], [reload_cmds], [2])dnl
 #  -- PORTME fill in with the dynamic library characteristics
 m4_defun([_LT_CHECK_MAGIC_METHOD],
 [m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
 AC_CACHE_CHECK([how to recognize dependent libraries],
 lt_cv_deplibs_check_method,
 [lt_cv_file_magic_cmd='$MAGIC_CMD'
@@ -3020,12 +3018,6 @@ mingw* | pw32*)
   fi
   ;;
 
-cegcc)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3337,7 +3329,7 @@ case $host_os in
 aix*)
   symcode='[[BCDT]]'
   ;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
   symcode='[[ABCDGISTW]]'
   ;;
 hpux*)
@@ -3583,7 +3575,7 @@ m4_if([$1], [CXX], [
     beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
+    mingw* | cygwin* | os2* | pw32*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3610,11 +3602,10 @@ m4_if([$1], [CXX], [
       fi
       ;;
     hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
       case $host_cpu in
-      hppa*64*)
+      hppa*64*|ia64*)
        ;;
       *)
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
@@ -3712,19 +3703,12 @@ m4_if([$1], [CXX], [
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
            ;;
-         ecpc* )
-           # old Intel C++ for x86_64 which still supported -KPIC.
+         icpc* | ecpc* )
+           # Intel C++
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
            ;;
-         icpc* )
-           # Intel C++, used to be incompatible with GCC.
-           # ICC 10 doesn't accept -KPIC any more.
-           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-           ;;
          pgCC* | pgcpp*)
            # Portland Group C++ compiler
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -3890,7 +3874,7 @@ m4_if([$1], [CXX], [
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -3906,11 +3890,10 @@ m4_if([$1], [CXX], [
       ;;
 
     hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
       case $host_cpu in
-      hppa*64*)
+      hppa*64*|ia64*)
        # +Z the default
        ;;
       *)
@@ -3960,7 +3943,7 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
+    mingw* | cygwin* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       m4_if([$1], [GCJ], [],
@@ -3991,25 +3974,11 @@ m4_if([$1], [CXX], [
 
     linux* | k*bsd*-gnu)
       case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
+      icc* | ecc* | ifort*)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
         ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-       _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
-       _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
-       ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
@@ -4191,7 +4160,7 @@ m4_if([$1], [CXX], [
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
   ;;
-  cygwin* | mingw* | cegcc*)
+  cygwin* | mingw*)
     _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'
   ;;
   linux* | k*bsd*-gnu)
@@ -4246,7 +4215,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   extract_expsyms_cmds=
 
   case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
+  cygwin* | mingw* | pw32*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -4261,9 +4230,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4336,7 +4302,7 @@ _LT_EOF
       fi
       ;;
 
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | mingw* | pw32*)
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -4402,9 +4368,6 @@ _LT_EOF
          tmp_addflag=' -i_dynamic -nofor_main' ;;
        ifc* | ifort*)                  # Intel Fortran compiler
          tmp_addflag=' -nofor_main' ;;
-       lf95*)                          # Lahey Fortran 8.1
-         _LT_TAGVAR(whole_archive_flag_spec, $1)=
-         tmp_sharedflag='--shared' ;;
        xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
@@ -4637,7 +4600,6 @@ _LT_EOF
        fi
       fi
 
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
@@ -4692,7 +4654,7 @@ _LT_EOF
       _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
       ;;
 
-    cygwin* | mingw* | pw32* | cegcc*)
+    cygwin* | mingw* | pw32*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -4796,7 +4758,7 @@ _LT_EOF
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
          _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
           fi
         fi
 
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
        # export.
@@ -5640,7 +5601,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      cygwin* | mingw* | pw32* | cegcc*)
+      cygwin* | mingw* | pw32*)
         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
         # as there is no search path for DLLs.
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
@@ -7025,18 +6986,6 @@ AC_SUBST([GREP])
 ])
 
 
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
-
-
 # _LT_DECL_SED
 # ------------
 # Check for a fully-functional sed program, that truncates
index 46535e2e11559aa79db0363152cce41b8f36b872..eb8db0cd123f670fd7d7fd5a109f58e4315c1b3c 100644 (file)
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 17 LTDL_INIT
+# serial 15 LTDL_INIT
 
 # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE])
 # ------------------------------------------
@@ -212,10 +212,26 @@ m4_define([$0], [])
 # of into LIBOBJS.
 AC_DEFUN([_LT_LIBOBJ], [
   m4_pattern_allow([^_LT_LIBOBJS$])
+  AS_LITERAL_IF([$1], [_LT_LIBSOURCES([$1.c])])dnl
   _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext"
 ])# _LT_LIBOBJS
 
 
+# _LT_LIBSOURCES(MODULE_NAMES)
+# ----------------------------
+# Like AC_LIBSOURCES, except the directory where the libltdl source files
+# are expected is distinct from the user LIBOBJ directory.
+AC_DEFUN([_LT_LIBSOURCES], [
+  m4_foreach([_LTNAME], [$1], [
+    m4_syscmd([test -r "$lt_libobj_prefix]_LTNAME[" ||
+               test -z "$lt_libobj_prefix" ||
+               test ! -d "$lt_libobj_prefix"])dnl
+    m4_if(m4_sysval, [0], [],
+      [AC_FATAL([missing $lt_libobj_prefix/]_LTNAME)])
+  ])
+])# _LT_LIBSOURCES
+
+
 # LTDL_INIT([OPTIONS])
 # --------------------
 # Clients of libltdl can use this macro to allow the installer to
@@ -229,9 +245,9 @@ _LT_SET_OPTIONS([$0], [$1])
 
 dnl We need to keep our own list of libobjs separate from our parent project,
 dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while
-dnl we look for our own LIBOBJs.
+dnl we look for our own LIBOBJs. Definitions in ltdl-libobj.m4.
 m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ]))
-m4_pushdef([AC_LIBSOURCES])
+m4_pushdef([AC_LIBSOURCES], m4_defn([_LT_LIBSOURCES]))
 
 dnl If not otherwise defined, default to the 1.5.x compatible subproject mode:
 m4_if(_LTDL_MODE, [],
@@ -248,7 +264,7 @@ if test "x$with_included_ltdl" != xyes; then
   # decide whether there is a useful installed version we can use.
   AC_CHECK_HEADER([ltdl.h],
       [AC_CHECK_DECL([lt_dlinterface_register],
-          [AC_CHECK_LIB([ltdl], [lt_dladvise_preload],
+          [AC_CHECK_LIB([ltdl], [lt_dlinterface_register],
               [with_included_ltdl=no],
               [with_included_ltdl=yes])],
           [with_included_ltdl=yes],
@@ -380,6 +396,12 @@ m4_require([_LT_HEADER_DLFCN])dnl
 m4_require([_LT_CHECK_DLPREOPEN])dnl
 m4_require([_LT_DECL_SED])dnl
 
+# lt_cv_dlopen_self gets defined by LT_SYS_DLOPEN_SELF, called by LT_INIT
+if test "$lt_cv_dlopen_self" = yes; then
+  AC_DEFINE([LTDL_DLOPEN_SELF_WORKS], [1],
+    [Define if dlopen(NULL) is able to resolve symbols from the main program.])
+fi
+
 dnl Don't require this, or it will be expanded earlier than the code
 dnl that sets the variables it relies on:
 _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],
 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 
-AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
-
 name=ltdl
 LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
 AC_SUBST([LTDLOPEN])
index 34151a3ba625f326e6645d6afc79586f10746a3e..e97011948b481651bdfb2cb9c3acd88b80a74831 100644 (file)
@@ -125,7 +125,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
index 9000a057d31ddf75cb85ccda8757de4493bcdbe7..0d258e070a24d695ceba7e2f3a6071b6915e1d01 100644 (file)
@@ -1,13 +1,13 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 6 ltsugar.m4
+# serial 5 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -63,14 +63,14 @@ m4_define([lt_append],
 # Produce a SEP delimited list of all paired combinations of elements of
 # PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
 # has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
 m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-            [m4_foreach([_Lt_suffix],
-               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+[m4_if([$2], [], [],
+  [m4_if([$4], [], [],
+    [lt_join(m4_quote(m4_default([$1], [[, ]])),
+      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
+                  [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
+                              [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
+])
 
 
 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
index b8e154fe6e10fb20e2cf7d9e3a59116fb27cb79b..45cb1557c3af3e759b210080388311d2b29ac217 100644 (file)
@@ -9,15 +9,15 @@
 
 # Generated from ltversion.in.
 
-# serial 3012 ltversion.m4
+# serial 2976 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6])
-m4_define([LT_PACKAGE_REVISION], [1.3012])
+m4_define([LT_PACKAGE_VERSION], [2.2.4])
+m4_define([LT_PACKAGE_REVISION], [1.2976])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6'
-macro_revision='1.3012'
+[macro_version='2.2.4'
+macro_revision='1.2976'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
index fe8bcf9ccf6ae19a148cfcf2ae42e7c5eb267186..ebdac0aaaf216965059f3a1c39502382d9050bef 100644 (file)
@@ -198,7 +198,7 @@ struct RequestConfigureMessage
    * the specified amont.  The traffic preference is used to determine
    * the share of bandwidth this peer will typcially be assigned.
    */
-  double preference_change GNUNET_PACKED;
+  uint64_t preference_change GNUNET_PACKED;
 
   /**
    * Identity of the peer being configured.
index 02379e36e75910a0b5b4c25164979dfbd3cae3de..931ffe97e457f5239a9144ab48b8ca2dab235c6c 100644 (file)
@@ -904,7 +904,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle,
                             struct GNUNET_TIME_Relative timeout,
                             unsigned int bpm_out,
                             int amount,
-                            double preference,
+                            unsigned long long preference,
                             GNUNET_CORE_PeerConfigurationInfoCallback info,
                             void *info_cls)
 {
@@ -938,7 +938,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle,
   rcm->reserved = htonl (0);
   rcm->limit_outbound_bpm = htonl (bpm_out);
   rcm->reserve_inbound = htonl (amount);
-  rcm->preference_change = preference;
+  rcm->preference_change = GNUNET_htonll(preference);
   rcm->peer = *peer;
   if (handle->pending_head == th)
     trigger_next_request (handle);
index 5996a81bfb55d8bbd1ebd2a39745939f3f5d15c1..0d714be3f1354ae9d46c0631a885a5dc2d998b6d 100644 (file)
  *
  * POST-TESTING:
  * - revisit API (which arguments are used, needed)?
- * - add code to re-transmit key if first attempt failed
- *   + timeout on connect / key exchange, etc.
- *   + timeout for automatic re-try, etc.
- * - add code to give up re-transmission of key if many attempts fail
- * - add code to send PINGs if we are about to time-out otherwise
+ * - add code to send PINGs if we are about to time-out otherwise (?)
  * ? add heuristic to do another send_key in "handle_set_key"
  *   in case previous attempt failed / didn't work / persist
  *   (but don't do it always to avoid storm of SET_KEY's going
@@ -47,6 +43,7 @@
  *   could ideally be changed to O(1) hash map lookups)
  */
 #include "platform.h"
+#include "gnunet_constants.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_hello_lib.h"
 #include "gnunet_peerinfo_service.h"
  */
 #define MAX_WINDOW_TIME (5 * 60 * 1000)
 
-
 /**
- * Amount of bytes per minute (in/out) to assume initially
- * (before either peer has communicated any particular
- * preference).  Should be rather low.
+ * Minimum of bytes per minute (out) to assign to any connected peer.
+ * Should be rather low; values larger than DEFAULT_BPM_IN_OUT make no
+ * sense.
  */
-#define DEFAULT_BPM_IN_OUT 2048
+#define MIN_BPM_PER_PEER GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT
 
+/**
+ * What is the smallest change (in number of bytes per minute)
+ * that we consider significant enough to bother triggering?
+ */
+#define MIN_BPM_CHANGE 32
 
 /**
  * After how much time past the "official" expiration time do
  */
 #define PAST_EXPIRATION_DISCARD_TIME GNUNET_TIME_UNIT_SECONDS
 
-
 /**
  * What is the maximum delay for a SET_KEY message?
  */
 #define MAX_SET_KEY_DELAY GNUNET_TIME_UNIT_SECONDS
 
-
 /**
  * What how long do we wait for SET_KEY confirmation initially?
  */
 #define INITIAL_SET_KEY_RETRY_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
 
-
 /**
  * What is the maximum delay for a PING message?
  */
 #define MAX_PING_DELAY GNUNET_TIME_UNIT_SECONDS
 
-
 /**
  * What is the maximum delay for a PONG message?
  */
 #define MAX_PONG_DELAY GNUNET_TIME_UNIT_SECONDS
 
+/**
+ * How often do we recalculate bandwidth quotas?
+ */
+#define QUOTA_UPDATE_FREQUENCY GNUNET_TIME_UNIT_SECONDS
 
 /**
  * What is the priority for a SET_KEY message?
  */
 #define SET_KEY_PRIORITY 0xFFFFFF
 
-
 /**
  * What is the priority for a PING message?
  */
 #define PING_PRIORITY 0xFFFFFF
 
-
 /**
  * What is the priority for a PONG message?
  */
 #define PONG_PRIORITY 0xFFFFFF
 
-
 /**
  * How many messages do we queue per peer at most?
  */
 #define MAX_PEER_QUEUE_SIZE 16
 
-
 /**
  * How many non-mandatory messages do we queue per client at most?
  */
 #define MAX_CLIENT_QUEUE_SIZE 32
 
-
 /**
  * What is the maximum age of a message for us to consider
  * processing it?  Note that this looks at the timestamp used
  */
 #define MAX_MESSAGE_AGE GNUNET_TIME_UNIT_DAYS
 
-
 /**
  * What is the maximum size for encrypted messages?  Note that this
  * number imposes a clear limit on the maximum size of any message.
@@ -179,6 +174,7 @@ enum PeerStateMachine
  */
 #define ENCRYPTED_HEADER_SIZE (sizeof(struct GNUNET_MessageHeader) + sizeof(uint32_t) + sizeof(GNUNET_HashCode))
 
+
 /**
  * Encapsulation for encrypted messages exchanged between
  * peers.  Followed by the actual encrypted data.
@@ -402,6 +398,11 @@ struct Neighbour
    */
   GNUNET_SCHEDULER_TaskIdentifier retry_set_key_task;
 
+  /**
+   * ID of task used for updating bandwidth quota for this neighbour.
+   */
+  GNUNET_SCHEDULER_TaskIdentifier quota_update_task;
+
   /**
    * At what time did we generate our encryption key?
    */
@@ -430,7 +431,7 @@ struct Neighbour
   struct GNUNET_TIME_Relative last_latency;
 
   /**
-   * At what frequency are we currently re-trying SET KEY messages?
+   * At what frequency are we currently re-trying SET_KEY messages?
    */
   struct GNUNET_TIME_Relative set_key_retry_frequency;
 
@@ -465,7 +466,7 @@ struct Neighbour
   /**
    * How valueable were the messages of this peer recently?
    */
-  double current_preference;
+  unsigned long long current_preference;
 
   /**
    * Bit map indicating which of the 32 sequence numbers before the last
@@ -501,7 +502,7 @@ struct Neighbour
 
   /**
    * Internal bandwidth limit set for this peer (initially
-   * typcially set to "-1").  "bpm_out" is MAX of
+   * typically set to "-1").  "bpm_out" is MAX of
    * "bpm_out_internal_limit" and "bpm_out_external_limit".
    */
   uint32_t bpm_out_internal_limit;
@@ -640,15 +641,64 @@ static struct GNUNET_SERVER_Handle *server;
  */
 static struct GNUNET_TRANSPORT_Handle *transport;
 
+/**
+ * Linked list of our clients.
+ */
+static struct Client *clients;
+
 /**
  * We keep neighbours in a linked list (for now).
  */
 static struct Neighbour *neighbours;
 
 /**
- * Linked list of our clients.
+ * Sum of all preferences among all neighbours.
  */
-static struct Client *clients;
+static unsigned long long preference_sum;
+
+/**
+ * Total number of neighbours we have.
+ */
+static unsigned int neighbour_count;
+
+/**
+ * How much inbound bandwidth are we supposed to be using?
+ */
+static unsigned long long bandwidth_target_in;
+
+/**
+ * How much outbound bandwidth are we supposed to be using?
+ */
+static unsigned long long bandwidth_target_out;
+
+
+
+/**
+ * A preference value for a neighbour was update.  Update
+ * the preference sum accordingly.
+ *
+ * @param inc how much was a preference value increased?
+ */
+static void
+update_preference_sum (unsigned long long inc)
+{
+  struct Neighbour *n;
+  unsigned long long os;
+
+  os = preference_sum;
+  preference_sum += inc;
+  if (preference_sum >= os)
+    return; /* done! */
+  /* overflow! compensate by cutting all values in half! */
+  preference_sum = 0;
+  n = neighbours;
+  while (n != NULL)
+    {
+      n->current_preference /= 2;
+      preference_sum += n->current_preference;
+      n = n->next;
+    }    
+}
 
 
 /**
@@ -1010,6 +1060,7 @@ handle_client_request_configure (void *cls,
   struct ConfigurationInfoMessage cim;
   struct Client *c;
   int reserv;
+  unsigned long long old_preference;
 
 #if DEBUG_CORE_CLIENT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1036,9 +1087,14 @@ handle_client_request_configure (void *cls,
             reserv = n->available_recv_window;
           n->available_recv_window -= reserv;
         }
-      n->current_preference += rcm->preference_change;
-      if (n->current_preference < 0)
-        n->current_preference = 0;
+      old_preference = n->current_preference;
+      n->current_preference += GNUNET_ntohll(rcm->preference_change);
+      if (old_preference > n->current_preference) 
+       {
+         /* overflow; cap at maximum value */
+         n->current_preference = (unsigned long long) -1;
+       }
+      update_preference_sum (n->current_preference - old_preference);
       cim.reserved_amount = htonl (reserv);
       cim.bpm_in = htonl (n->bpm_in);
       cim.bpm_out = htonl (n->bpm_out);
@@ -2799,6 +2855,87 @@ handle_transport_receive (void *cls,
 }
 
 
+/**
+ * Function that recalculates the bandwidth quota for the
+ * given neighbour and transmits it to the transport service.
+ * 
+ * @param cls neighbour for the quota update
+ * @param tc context
+ */
+static void
+neighbour_quota_update (void *cls,
+                       const struct GNUNET_SCHEDULER_TaskContext *tc);
+
+
+/**
+ * Schedule the task that will recalculate the bandwidth
+ * quota for this peer (and possibly force a disconnect of
+ * idle peers by calculating a bandwidth of zero).
+ */
+static void
+schedule_quota_update (struct Neighbour *n)
+{
+  GNUNET_assert (n->quota_update_task ==
+                GNUNET_SCHEDULER_NO_PREREQUISITE_TASK);
+  n->quota_update_task
+    = GNUNET_SCHEDULER_add_delayed (sched,
+                                   GNUNET_NO,
+                                   GNUNET_SCHEDULER_PRIORITY_IDLE,
+                                   GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
+                                   QUOTA_UPDATE_FREQUENCY,
+                                   &neighbour_quota_update,
+                                   n);
+}
+
+
+/**
+ * Function that recalculates the bandwidth quota for the
+ * given neighbour and transmits it to the transport service.
+ * 
+ * @param cls neighbour for the quota update
+ * @param tc context
+ */
+static void
+neighbour_quota_update (void *cls,
+                       const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct Neighbour *n = cls;
+  uint32_t q_in;
+  double pref_rel;
+  double share;
+  unsigned long long distributable;
+  
+  n->quota_update_task = GNUNET_SCHEDULER_NO_PREREQUISITE_TASK;
+  /* calculate relative preference among all neighbours;
+     divides by a bit more to avoid division by zero AND to
+     account for possibility of new neighbours joining any time 
+     AND to convert to double... */
+  pref_rel = n->current_preference / (1.0 + preference_sum);
+  share = 0;
+  distributable = 0;
+  if (bandwidth_target_out > neighbour_count * MIN_BPM_PER_PEER)
+    distributable = bandwidth_target_out - neighbour_count * MIN_BPM_PER_PEER;
+  share = distributable * pref_rel;
+  q_in = MIN_BPM_PER_PEER + (unsigned long long) share;
+  /* check if we want to disconnect for good due to inactivity */
+  if ( (GNUNET_TIME_absolute_get_duration (n->last_activity).value > GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.value) &&
+       (GNUNET_TIME_absolute_get_duration (n->time_established).value > GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.value) )
+    q_in = 0; /* force disconnect */
+  if ( (n->bpm_in + MIN_BPM_CHANGE < q_in) ||
+       (n->bpm_in - MIN_BPM_CHANGE > q_in) ) 
+    {
+      n->bpm_in = q_in;
+      GNUNET_TRANSPORT_set_quota (transport,
+                                 &n->peer,
+                                 n->bpm_in, 
+                                 n->bpm_out,
+                                 GNUNET_TIME_UNIT_FOREVER_REL,
+                                 NULL, NULL);
+    }
+  schedule_quota_update (n);
+}
+
+
 /**
  * Function called by transport to notify us that
  * a peer connected to us (on the network level).
@@ -2827,6 +2964,7 @@ handle_transport_notify_connect (void *cls,
   n = GNUNET_malloc (sizeof (struct Neighbour));
   n->next = neighbours;
   neighbours = n;
+  neighbour_count++;
   n->peer = *peer;
   n->last_latency = latency;
   GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key);
@@ -2834,10 +2972,10 @@ handle_transport_notify_connect (void *cls,
   n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY;
   n->last_asw_update = now;
   n->last_arw_update = now;
-  n->bpm_in = DEFAULT_BPM_IN_OUT;
-  n->bpm_out = DEFAULT_BPM_IN_OUT;
+  n->bpm_in = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT;
+  n->bpm_out = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT;
   n->bpm_out_internal_limit = (uint32_t) - 1;
-  n->bpm_out_external_limit = DEFAULT_BPM_IN_OUT;
+  n->bpm_out_external_limit = GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT;
   n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                                 (uint32_t) - 1);
 #if DEBUG_CORE
@@ -2845,9 +2983,10 @@ handle_transport_notify_connect (void *cls,
               "Received connection from `%4s'.\n",
               GNUNET_i2s (&n->peer));
 #endif
+  schedule_quota_update (n);
   cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
   cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
-  cnm.bpm_available = htonl (DEFAULT_BPM_IN_OUT);
+  cnm.bpm_available = htonl (n->bpm_out);
   cnm.peer = *peer;
   cnm.last_activity = GNUNET_TIME_absolute_hton (now);
   send_to_all_clients (&cnm.header, GNUNET_YES);
@@ -2857,6 +2996,7 @@ handle_transport_notify_connect (void *cls,
 /**
  * Free the given entry for the neighbour (it has
  * already been removed from the list at this point).
+ *
  * @param n neighbour to free
  */
 static void
@@ -2880,6 +3020,8 @@ free_neighbour (struct Neighbour *n)
     GNUNET_SCHEDULER_cancel (sched, n->retry_plaintext_task);
   if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK)
     GNUNET_SCHEDULER_cancel (sched, n->retry_set_key_task);
+  if (n->quota_update_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK)
+    GNUNET_SCHEDULER_cancel (sched, n->quota_update_task);
   GNUNET_free_non_null (n->public_key);
   GNUNET_free_non_null (n->pending_ping);
   GNUNET_free (n);
@@ -2922,6 +3064,8 @@ handle_transport_notify_disconnect (void *cls,
     neighbours = n->next;
   else
     p->next = n->next;
+  GNUNET_assert (neighbour_count > 0);
+  neighbour_count--;
   cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
   cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT);
   cnm.bpm_available = htonl (0);
@@ -2952,6 +3096,8 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   while (NULL != (n = neighbours))
     {
       neighbours = n->next;
+      GNUNET_assert (neighbour_count > 0);
+      neighbour_count--;
       free_neighbour (n);
     }
   while (NULL != (c = clients))
@@ -2983,12 +3129,17 @@ run (void *cls,
   cfg = c;
   /* parse configuration */
   if (
-#if 0
        (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_number (c,
                                                "CORE",
-                                               "XX",
-                                               &qin)) ||
+                                               "TOTAL_QUOTA_IN",
+                                               &bandwidth_target_in)) ||
+       (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_number (c,
+                                               "CORE",
+                                               "TOTAL_QUOTA_OUT",
+                                               &bandwidth_target_out)) ||
+#if 0
        (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_number (c,
                                                "CORE",
@@ -3052,8 +3203,6 @@ run (void *cls,
 static void
 cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-
-
   if (my_private_key != NULL)
     GNUNET_CRYPTO_rsa_key_free (my_private_key);
 }
index 8e572a583ae2ba2a111a330813cfc55fbfbe83c8..d52b24a4f054c34742ce32984ca3fbd6fad60a43 100644 (file)
@@ -34,7 +34,7 @@
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_transport_service.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define START_ARM GNUNET_YES
 
index 8c49690e79841ca934077d02daed6e929f1a9064..bc832c44477bdf5c3c84ac5135d37fdcf5e83e30 100644 (file)
@@ -15,6 +15,7 @@ gnunetinclude_HEADERS = \
   gnunet_arm_service.h \
   gnunet_client_lib.h \
   gnunet_common.h \
+  gnunet_constants.h \
   gnunet_configuration_lib.h \
   gnunet_container_lib.h \
   gnunet_core_service.h \
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h
new file mode 100644 (file)
index 0000000..99ed775
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+     This file is part of GNUnet.
+     (C) 2009 Christian Grothoff (and other contributing authors)
+
+     GNUnet 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 2, or (at your
+     option) any later version.
+
+     GNUnet 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 GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file include/gnunet_constants.h
+ * @brief "global" constants for performance tuning
+ * @author Christian Grothoff
+ */
+
+#ifndef GNUNET_CONSTANTS_H
+#define GNUNET_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0                           /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Amount of bytes per minute (in/out) to assume initially (before
+ * either peer has communicated any particular preference).  Should be
+ * rather low; set so that at least one maximum-size message can be
+ * send each minute.
+ */
+#define GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT GNUNET_SERVER_MAX_MESSAGE_SIZE
+
+/**
+ * After how long do we consider a connection to a peer dead
+ * if we don't receive messages from the peer?
+ */
+#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
+
+
+#if 0                           /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 8b75271b971ef704cd5f5e1b2826c397630bc2c9..be8f4baa0452cc57249b0eb0061179c69bd7f62d 100644 (file)
@@ -219,7 +219,7 @@ typedef void
                                                 unsigned int bpm_out,
                                                 struct GNUNET_TIME_Relative
                                                 latency, int amount,
-                                                double preference);
+                                                unsigned long long preference);
 
 
 /**
@@ -251,7 +251,7 @@ GNUNET_CORE_peer_configure (struct GNUNET_CORE_Handle *handle,
                             struct GNUNET_TIME_Relative timeout,
                             unsigned int bpm_out,
                             int amount,
-                            double preference,
+                            unsigned long long preference,
                             GNUNET_CORE_PeerConfigurationInfoCallback info,
                             void *info_cls);
 
index da6ee9df8c38a3cc601d602f55ce62add07a9116..f689b54c01a38d75a561fae6eb94bda015bec6c1 100644 (file)
@@ -29,6 +29,7 @@
  */
 #include "platform.h"
 #include "gnunet_client_lib.h"
+#include "gnunet_constants.h"
 #include "gnunet_getopt_lib.h"
 #include "gnunet_hello_lib.h"
 #include "gnunet_os_lib.h"
  */
 #define HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12)
 
-/**
- * After how long do we consider a connection to a peer dead
- * if we don't receive messages from the peer?
- */
-#define IDLE_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
-
 
 /**
  * Entry in linked list of network addresses.
@@ -356,7 +351,7 @@ struct NeighbourList
   uint64_t last_received;
 
   /**
-   * Global quota for outbound traffic for the neighbour in bytes/ms.
+   * Global quota for inbound traffic for the neighbour in bytes/ms.
    */
   uint32_t quota_in;
 
@@ -640,16 +635,6 @@ static struct GNUNET_SERVER_Handle *server;
  */
 static struct NeighbourList *neighbours;
 
-/**
- * Default bandwidth quota for receiving for new peers in bytes/ms.
- */
-static uint32_t default_quota_in;
-
-/**
- * Default bandwidth quota for sending for new peers in bytes/ms.
- */
-static uint32_t default_quota_out;
-
 /**
  * Number of neighbours we'd like to have.
  */
@@ -930,7 +915,7 @@ transmit_send_continuation (void *cls,
     }
   if (result == GNUNET_OK)
     {
-      rl->timeout = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
+      rl->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
     }
   else
     {
@@ -1139,7 +1124,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour)
                              rl,
                              &neighbour->id,
                              mq->message,
-                             IDLE_CONNECTION_TIMEOUT,
+                             GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                              &transmit_send_continuation, mq);
 }
 
@@ -1510,7 +1495,7 @@ notify_clients_connect (const struct GNUNET_PeerIdentity *peer,
 #endif
   cim.header.size = htons (sizeof (struct ConnectInfoMessage));
   cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
-  cim.quota_out = htonl (default_quota_out);
+  cim.quota_out = htonl (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT / (60*1000));
   cim.latency = GNUNET_TIME_relative_hton (latency);
   memcpy (&cim.id, peer, sizeof (struct GNUNET_PeerIdentity));
   cpos = clients;
@@ -2196,15 +2181,15 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer)
   n->id = *peer;
   n->last_quota_update = GNUNET_TIME_absolute_get ();
   n->peer_timeout =
-    GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
-  n->quota_in = default_quota_in;
+    GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+  n->quota_in = (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT + 59999) / (60 * 1000);
   add_plugins (n);
   n->hello_version_sent = our_hello_version;
   n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
                                                   GNUNET_NO,
                                                   GNUNET_SCHEDULER_PRIORITY_IDLE,
                                                   GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
-                                                  IDLE_CONNECTION_TIMEOUT,
+                                                  GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                                   &neighbour_timeout_task, n);
   transmit_to_peer (NULL,
                     (const struct GNUNET_MessageHeader *) our_hello,
@@ -2297,7 +2282,7 @@ plugin_env_receive (void *cls,
           service_context->connect_attempts++;
         }
       service_context->timeout
-        = GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
+        = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
       service_context->plugin_handle = plugin_context;
       service_context->latency = latency;
     }
@@ -2306,12 +2291,12 @@ plugin_env_receive (void *cls,
   n->last_received += msize;
   GNUNET_SCHEDULER_cancel (sched, n->timeout_task);
   n->peer_timeout =
-    GNUNET_TIME_relative_to_absolute (IDLE_CONNECTION_TIMEOUT);
+    GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
   n->timeout_task =
     GNUNET_SCHEDULER_add_delayed (sched, GNUNET_NO,
                                   GNUNET_SCHEDULER_PRIORITY_IDLE,
                                   GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
-                                  IDLE_CONNECTION_TIMEOUT,
+                                  GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                   &neighbour_timeout_task, n);
   update_quota (n);
   if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD)
@@ -2426,7 +2411,7 @@ handle_start (void *cls,
       /* tell new client about all existing connections */
       cim.header.size = htons (sizeof (struct ConnectInfoMessage));
       cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
-      cim.quota_out = htonl (default_quota_out);
+      cim.quota_out = htonl (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT / (60 * 1000));
       cim.latency = GNUNET_TIME_relative_hton (GNUNET_TIME_UNIT_ZERO);  /* FIXME? */
       im = GNUNET_malloc (sizeof (struct InboundMessage) +
                           sizeof (struct GNUNET_MessageHeader));
@@ -2639,7 +2624,7 @@ create_environment (struct TransportPlugin *plug)
   plug->env.receive = &plugin_env_receive;
   plug->env.lookup = &plugin_env_lookup_address;
   plug->env.notify_address = &plugin_env_notify_address;
-  plug->env.default_quota_in = default_quota_in;
+  plug->env.default_quota_in = (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT + 59999) / (60 * 1000);
   plug->env.max_connections = max_connect_per_transport;
 }
 
@@ -2738,8 +2723,6 @@ run (void *cls,
   char *plugs;
   char *pos;
   int no_transports;
-  unsigned long long qin;
-  unsigned long long qout;
   unsigned long long tneigh;
   char *keyfile;
 
@@ -2747,16 +2730,6 @@ run (void *cls,
   cfg = c;
   /* parse configuration */
   if ((GNUNET_OK !=
-       GNUNET_CONFIGURATION_get_value_number (c,
-                                              "TRANSPORT",
-                                              "DEFAULT_QUOTA_IN",
-                                              &qin)) ||
-      (GNUNET_OK !=
-       GNUNET_CONFIGURATION_get_value_number (c,
-                                              "TRANSPORT",
-                                              "DEFAULT_QUOTA_OUT",
-                                              &qout)) ||
-      (GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_number (c,
                                               "TRANSPORT",
                                               "NEIGHBOUR_LIMIT",
@@ -2773,8 +2746,6 @@ run (void *cls,
       return;
     }
   max_connect_per_transport = (uint32_t) tneigh;
-  default_quota_in = (uint32_t) qin;
-  default_quota_out = (uint32_t) qout;
   my_private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
   GNUNET_free (keyfile);
   if (my_private_key == NULL)
index fb24514479c77fde64b62203aeeff4405798632c..d389544455105499c45bd8da4332043c493339ef 100644 (file)
@@ -92,7 +92,7 @@ struct NeighbourList
   uint64_t last_sent;
 
   /**
-   * Global quota for outbound traffic to the neighbour in bytes/ms.
+   * Quota for outbound traffic to the neighbour in bytes/ms.
    */
   uint32_t quota_out;