author | aidan |
Wed, 10 Aug 2011 13:38:52 +0100 | |
changeset 29 | 00dfdf113d87 |
parent 28 | 406d4f7eb00d |
child 30 | bdf6aee9aa70 |
--- a/servlib/bundling/BundleDaemon.cc Wed Aug 03 14:35:09 2011 +0100 +++ b/servlib/bundling/BundleDaemon.cc Wed Aug 10 13:38:52 2011 +0100 @@ -717,12 +717,14 @@ stats_.generated_bundles_++; source_str = " (from fragmentation)"; s10_bundle(S10_OHCRAP,bundle,NULL,0,0,NULL,"__FILE__:__LINE__"); + log_debug("S10_OHCRAP - eventsrc: %s", source_str); break; case EVENTSRC_ROUTER: stats_.generated_bundles_++; source_str = " (from router)"; s10_bundle(S10_OHCRAP,bundle,NULL,0,0,NULL,"__FILE__:__LINE__"); + log_debug("S10_OHCRAP - eventsrc: %s", source_str); break; case EVENTSRC_CACHE: @@ -734,6 +736,7 @@ default: s10_bundle(S10_OHCRAP,bundle,NULL,0,0,NULL,"__FILE__:__LINE__"); + log_debug("S10_OHCRAP - nknown eventsrc: %s", event->source_); NOTREACHED; } @@ -873,11 +876,12 @@ */ Bundle* duplicate = find_duplicate(bundle); if (duplicate != NULL) { - log_notice("got duplicate bundle: %s -> %s creation %llu.%llu", + log_notice("got duplicate bundle: %s -> %s creation %llu.%llu frag_offset %llu", bundle->source().c_str(), bundle->dest().c_str(), bundle->creation_ts().seconds_, - bundle->creation_ts().seqno_); + bundle->creation_ts().seqno_, + bundle->frag_offset()); s10_bundle(S10_DUP,bundle,NULL,0,0,NULL,"__FILE__:__LINE__"); stats_.duplicate_bundles_++;
--- a/tools/dtnd-control Wed Aug 03 14:35:09 2011 +0100 +++ b/tools/dtnd-control Wed Aug 10 13:38:52 2011 +0100 @@ -5,6 +5,8 @@ proc usage {} { puts stderr "dtnd-control \[-port port\] stop|check|logrotate|bundle_stats|daemon_stats" puts "|reset_stats|route_dump|link_dump|bundle_list|registration_list|gettimeofday" + puts "|\[-name name]\ link_open" + puts "|\[-name name]\ link_close" puts "|\[-id id]\ bundle_info" puts "|\[-id id]\ bundle_del" puts "|\[-id id]\ bundle_dump" @@ -30,7 +32,7 @@ } switch -- $arg { - -port { set port [shift argv] } -id { set id [shift argv] } + -port { set port [shift argv] } -id { set id [shift argv] } -name { set name [shift argv] } default { puts stderr "unknown argument $arg" usage @@ -42,7 +44,7 @@ set operation [shift argv] switch -- $operation { - stop - check - status - logrotate - daemon_stats - reset_stats - route_dump - link_dump - bundle_stats - bundle_list - bundle_info - bundle_del - bundle_expire - bundle_dump - registration_list - gettimeofday {} + stop - check - status - logrotate - daemon_stats - reset_stats - route_dump - link_dump - link_open - link_close - bundle_stats - bundle_list - bundle_info - bundle_del - bundle_expire - bundle_dump - registration_list - gettimeofday {} default { puts "unknown operation $operation" usage @@ -89,6 +91,12 @@ } elseif {$operation == "link_dump"} { set cmd "link dump" +} elseif {$operation == "link_open"} { + set cmd "link open $name" + +} elseif {$operation == "link_close"} { + set cmd "link close $name" + } elseif {$operation == "bundle_list"} { set cmd "bundle list"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/dtnd-run Wed Aug 10 13:38:52 2011 +0100 @@ -0,0 +1,114 @@ +#!/bin/bash + +usage() { +cat << EOF +usage: $0 options + +This script runs the dtn daemon with optional disruptions. + +OPTIONS: + -h Show this message + -i n Restart the daemon every n seconds (used to force fragmentation) + -l n Drop all links every n seconds (used to force fragmentation) + -r Remove log file at start + -t tidy the daemon the first time + -T tidy the daemon every time +EOF +} + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +DTND="/home/aidan/build/DTN2-BPQ/daemon/dtnd" +LOG="/var/log/dtn/dtnd.log" + +INT=0 +INT_LINK=0 +RM_LOG=0 +TIDY=0 +TIDY_ALL=0 +while getopts “hi:l:rtT” OPTION; do + case $OPTION in + h) + usage + exit 1 + ;; + i) + INT=1 + SEC=$OPTARG + ;; + l) + INT_LINK=1 + SEC=$OPTARG + ;; + r) + RM_LOG=1 + ;; + t) + TIDY=1 + ;; + T) + TIDY=1 + TIDY_ALL=1 + ;; + ?) + usage + exit 1 + esac +done + + +echo "stop dtnd (if running)" +dtnd-control stop + +if [[ $RM_LOG -eq 1 ]]; then + echo "removing old log file" + rm -f $LOG +fi + +if [[ $TIDY -eq 1 ]]; then + echo "starting dtnd (tidy)" + $DTND -o $LOG -l debug -dt +else + echo "starting dtnd" + $DTND -o $LOG -l debug -d +fi + +while [[ $INT -eq 1 ]]; do + echo "sleep for $SEC seconds..." + sleep $SEC + echo "stop dtnd" + dtnd-control stop + + echo "sleep for 5 seconds..." + sleep 5 + if [[ $TIDY_ALL -eq 1 ]]; then + echo "starting dtnd (tidy)" + $DTND -o $LOG -l debug -dt + else + echo "starting dtnd" + $DTND -o $LOG -l debug -d + fi +done + +while [[ $INT_LINK -eq 1 ]]; do + echo "sleep for $SEC seconds..." + sleep $SEC + + dtnd-control link_dump | \ + grep -v "^$" | \ + awk '{print $1}' | \ + while read link; do + echo "closing link: $link..." + dtnd-control -name $link link_close + done +done + +sleep 2 +echo "check if the daemon is running before exiting" +dtnd-control check + +exit 0 +