Skip to content

Commit

Permalink
logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Jan 27, 2017
1 parent 59f5147 commit 141c684
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
8 changes: 4 additions & 4 deletions simul/manage/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (p *ProtocolCount) Dispatch() error {
if p.Parent() != nil {
err := p.SendTo(p.Parent(), &NodeIsUp{})
if err != nil {
log.Error(p.Info(), "couldn't send to parent",
log.Lvl2(p.Info(), "couldn't send to parent",
p.Parent().Name(), err)
}
} else {
Expand All @@ -138,7 +138,7 @@ func (p *ProtocolCount) FuncPC() {
if !p.IsRoot() {
err := p.SendTo(p.Parent(), &NodeIsUp{})
if err != nil {
log.Error(p.Info(), "couldn't send to parent",
log.Lvl2(p.Info(), "couldn't send to parent",
p.Parent().Name(), err)
}
}
Expand All @@ -148,7 +148,7 @@ func (p *ProtocolCount) FuncPC() {
log.Lvl3(p.Info(), "sending to", c.ServerIdentity.Address, c.ID, p.timeout)
err := p.SendTo(c, &PrepareCount{Timeout: p.timeout})
if err != nil {
log.Error(p.Info(), "couldn't send to child",
log.Lvl2(p.Info(), "couldn't send to child",
c.Name())
}
}(child)
Expand All @@ -168,7 +168,7 @@ func (p *ProtocolCount) FuncC(cc []CountMsg) {
if !p.IsRoot() {
log.Lvl3(p.Info(), "Sends to", p.Parent().ID, p.Parent().ServerIdentity.Address)
if err := p.SendTo(p.Parent(), &Count{count}); err != nil {
log.Error(p.Name(), "coouldn't send to parent",
log.Lvl2(p.Name(), "coouldn't send to parent",
p.Parent().Name())
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions simul/platform/mininet/setup_iccluster.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cd "$(dirname ${BASH_SOURCE[0]})"
mininet="$(dirname ${BASH_SOURCE[0]})"

if [ -z "$1" ]; then
echo "Syntax: $0 #1 #2 ..."
Expand All @@ -13,4 +13,4 @@ for s in $@; do
ICCLUSTERS="$ICCLUSTERS $SERVER"
done

./setup_servers.sh $ICCLUSTERS
"$mininet/setup_servers.sh" $ICCLUSTERS
2 changes: 1 addition & 1 deletion simul/platform/mininet/setup_servers.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cd "$(dirname ${BASH_SOURCE[0]})"
mininet="$(dirname ${BASH_SOURCE[0]})"
set -e

SERVER_GW="$1"
Expand Down
15 changes: 6 additions & 9 deletions simul/platform/mininet/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Whether to redirect all socats to the main-gateway at 10.1.0.1
socatDirect = True
# If we want to end up in the CLI
startCLI = True
startCLI = False

def dbg(lvl, *str):
if lvl <= debugLvl:
Expand Down Expand Up @@ -100,19 +100,16 @@ def startConode(self):
socat="socat - %s:%s:%d" % (socatSend, self.gw, socatPort)

args = "-debug %s -address %s:2000 -simul %s" % (debugLvl, self.IP(), self.simul)
if False:
if True:
args += " -monitor %s:10000" % global_root
ldone = ""
# When the first conode on a physical server ends, tell `start.py`
# to go on. ".0.1" is the BaseRouter.
if self.IP().endswith(".0.2"):
ldone = "> /tmp/conode.log"
# ldone = "; date > " + logdone
dbg( 3, "Starting conode on node", self.IP(), ldone, args )
# self.cmd('( %s ./conode %s 2>&1 %s ) | %s &' %
self.cmd('( %s ./conode %s 2>&1 %s ) &' %
(debugStr, args, ldone ))
# (debugStr, args, ldone, socat ))
ldone = "; date > " + logdone
dbg( 3, "Starting conode on node", self.IP(), args, ldone, socat )
self.cmd('( %s ./conode %s 2>&1 %s ) | %s &' %
(debugStr, args, ldone, socat ))

def terminate(self):
dbg( 3, "Stopping conode" )
Expand Down
2 changes: 1 addition & 1 deletion simul/platform/runsimul.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// Simulate starts the server and will setup the protocol.
func Simulate(serverAddress, simul, monitorAddress string) error {
log.Lvl3("Flags are:", serverAddress, simul, log.DebugVisible, monitorAddress)
log.Lvl3("Flags are:", serverAddress, simul, log.DebugVisible(), monitorAddress)

scs, err := onet.LoadSimulationConfig(".", serverAddress)
if err != nil {
Expand Down

0 comments on commit 141c684

Please sign in to comment.