Commit 83631025 authored by Mike Hibler's avatar Mike Hibler

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 };
void KernelTcp::init(void)
{
// Set up the peerAccept socket
global::peerAccept = createServer(global::peerServerPort,
"Peer accept socket (No incoming peer "
"connections will be accepted)");
logWrite(PEER_CYCLE, "Created peer server on port %d",
global::peerServerPort);
if (global::peerServerPort != 0) {
global::peerAccept = createServer(global::peerServerPort,
"Peer accept socket (No incoming peer "
"connections will be accepted)");
logWrite(PEER_CYCLE, "Created peer server on port %d",
global::peerServerPort);
}
// Set up the connectionModelExemplar
global::connectionModelExemplar.reset(new KernelTcp());
......
......@@ -10,16 +10,26 @@ ARGS=$*
#
cd $LOGDIR
TARGETS=$MAGENT
#
# 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
$SH ${MAGENT_DIR}/run-magent.sh --daemonize $ARGS
# Kill the agent if we get killed - TODO: harsher kill?
# Because the magent backgrounds itself, it's harder to figure out
# what its pid is, just just do a killall
# 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
......
Markdown is supported
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