-
Notifications
You must be signed in to change notification settings - Fork 2
/
manyclient_dtbff
executable file
·172 lines (155 loc) · 4.31 KB
/
manyclient_dtbff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/bash
BASE_DIR=/root/alien-ofelia-conet-ccnx
RANGE_S=1
SERVER[0]=192.168.64.2
PORT=9699
BASE_NAME=example2
NAME=mb2_
N_CONTENT=20
i="0"
while [ "$i" -lt "$N_CONTENT" ]; do
NID[$i]=ccn:/$BASE_NAME/$NAME$i
i=$[$i+1]
done
RANGE=10
#NID[17]=ccn:/example2/mb2_17
#NID[18]=ccn:/example2/mb2_18
#NID[19]=ccn:/example2/mb2_19
NID_CCNX[0]=ccn:/$BASE_NAME
TIME=5
TIME2=5
while [ $# -gt 0 ]; do
if [ "$1" = "-s" ]; then
if [ $# -lt 2 ]; then
usage
fi
SERVER=$2
shift 2
elif [ "$1" = "-nx" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID_CCNX=$2
shift 2
elif [ "$1" = "-p" ]; then
if [ $# -lt 2 ]; then
usage
fi
PORT=$2
shift 2
elif [ "$1" = "-t" ]; then
if [ $# -lt 2 ]; then
usage
fi
TIME=$2
shift 2
elif [ "$1" = "-n" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID=$2
shift 2
else
break
fi
done
kill $(pidof ccnd) > /dev/null 2>&1
i="0"
j="0"
#while [ "$i" -lt "15" ]; do
while [ 1 ]; do
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep $TIME
echo "New CCND pid: $(pidof ccnd)"
fi #
# number=$RANDOM
# let "number %= $RANGE"
# if [ "$i" -eq "15" ];then
# j=$[$j+1]
# fi
echo ${SERVER[($j % $RANGE_S)]}
echo ${NID_CCNX[($j % $RANGE_S)]}
echo "$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT"
echo "$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}"
echo "j=$j"
echo "i=$i"
$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT
$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}
# $BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
# ip -s neigh flush all
echo ${NID[($i % $RANGE)]}
echo "$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &"
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &
sleep $TIME
if [ "$(pidof ccncatchunks2)" ];then
kill $(pidof ccnd) > /dev/null 2>&1
kill $(pidof ccncatchunks2) > /dev/null 2>&1
echo "((((((((((((((((( sveglia!!! )))))))))))))))))))"
fi
echo "@@@@ risveglio @@@@"
i=$[$i+1]
i=$(( $i % $RANGE ))
if [ "$i" -eq "0" ]; then
j=$[$j+1]
fi
if [ "$j" -eq "4" ]; then
break
fi
done
i=$[$i+10]
RANGE=20
j="0"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@"
sleep $TIME2
TIME=5
while [ 1 ]; do
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep $TIME
echo "New CCND pid: $(pidof ccnd)"
fi #
# number=$RANDOM
# let "number %= $RANGE"
# if [ "$i" -eq "15" ];then
# j=$[$j+1]
# fi
echo ${SERVER[($j % $RANGE_S)]}
echo ${NID_CCNX[($j % $RANGE_S)]}
echo "$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT"
echo "$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}"
echo "j=$j"
echo "i=$i"
$BASE_DIR/csrc/libexec/ccndc add ${NID_CCNX[($j % $RANGE_S)]} udp ${SERVER[($j % $RANGE_S)]} $PORT
$BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp ${SERVER[($j % $RANGE_S)]}
# $BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
echo ${NID[($i % $RANGE)]}
echo "$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &"
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[($i % $RANGE)]} &
sleep $TIME
if [ "$(pidof ccncatchunks2)" ];then
kill $(pidof ccnd) > /dev/null 2>&1
kill $(pidof ccncatchunks2) > /dev/null 2>&1
echo "((((((((((((((((( sveglia!!! )))))))))))))))))))"
fi
echo "@@@@ risveglio @@@@"
i=$[$i+1]
i=$(( $i % $RANGE ))
if [ "$i" -eq "0" ]; then
j=$[$j+1]
i=$[$i+10]
fi
if [ "$j" -eq "4" ]; then
break
fi
done