Commit 83631025 authored by Mike Hibler's avatar Mike Hibler
Browse files

In magent, if --peerserverport=0, then do not create a peer server port.

This is in support of Jon's desire to have the stub not be a traffic
receiver.

Currently if the auto-magent.sh script is started up with the environment
variable MAGENT_NORECV set, it will use the magent option and also start
up an iperfd on what would have been the peer server port.
parent 7ab91cd4
...@@ -291,11 +291,13 @@ enum { SNIFF_WAIT = 10 }; ...@@ -291,11 +291,13 @@ enum { SNIFF_WAIT = 10 };
void KernelTcp::init(void) void KernelTcp::init(void)
{ {
// Set up the peerAccept socket // Set up the peerAccept socket
global::peerAccept = createServer(global::peerServerPort, if (global::peerServerPort != 0) {
"Peer accept socket (No incoming peer " global::peerAccept = createServer(global::peerServerPort,
"connections will be accepted)"); "Peer accept socket (No incoming peer "
logWrite(PEER_CYCLE, "Created peer server on port %d", "connections will be accepted)");
global::peerServerPort); logWrite(PEER_CYCLE, "Created peer server on port %d",
global::peerServerPort);
}
// Set up the connectionModelExemplar // Set up the connectionModelExemplar
global::connectionModelExemplar.reset(new KernelTcp()); global::connectionModelExemplar.reset(new KernelTcp());
......
...@@ -10,16 +10,26 @@ ARGS=$* ...@@ -10,16 +10,26 @@ ARGS=$*
# #
cd $LOGDIR cd $LOGDIR
TARGETS=$MAGENT
# #
# Start up our own measurement agent # Start up our own measurement agent
# #
if [ $MAGENT_NORECV -ne 0 ]; then
port=`echo $ARGS | sed -e 's/.*--peerserverport=\([0-9][0-9]*\).*/\1/'`
ARGS=`echo $ARGS | sed -e "s/--peerserverport=$port/--peerserverport=0/"`
echo "${IPERFD_DIR}/$IPERFD -p $port"
${IPERFD_DIR}/$IPERFD -p $port &
TARGETS="$TARGETS $IPERFD"
fi
echo $SH ${MAGENT_DIR}/run-magent.sh $ARGS echo $SH ${MAGENT_DIR}/run-magent.sh $ARGS
$SH ${MAGENT_DIR}/run-magent.sh --daemonize $ARGS $SH ${MAGENT_DIR}/run-magent.sh --daemonize $ARGS
# Kill the agent if we get killed - TODO: harsher kill? # Kill the agent if we get killed - TODO: harsher kill?
# Because the magent backgrounds itself, it's harder to figure out # Because the magent backgrounds itself, it's harder to figure out
# what its pid is, just just do a killall # what its pid is, just just do a killall
# Note that we assume that a kill of us is "normal" and just exit 0. # Note that we assume that a kill of us is "normal" and just exit 0.
trap "$AS_ROOT killall $MAGENT; exit 0" TERM trap "$AS_ROOT killall $TARGETS; exit 0" TERM
# #
# Wait for all of the agents to start # Wait for all of the agents to start
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment