Skip to content

Commit

Permalink
better handling of service-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Jan 27, 2017
1 parent 6bb85fe commit b974f0e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
6 changes: 4 additions & 2 deletions app/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ RUNOUT=/tmp/run.out

startTest(){
set +m
buildDir
if [ "$CLEANBUILD" ]; then
rm -f conode $APP
fi
Expand Down Expand Up @@ -290,8 +289,11 @@ case $i in
shift # past argument=value
;;
-nt|--notemp)
BUILDDIR=build
BUILDDIR=$(pwd)/build
shift # past argument=value
;;
esac
done
buildDir

export CONODE_SERVICE_PATH=$BUILDDIR/service_storage
9 changes: 1 addition & 8 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (

"os"

"flag"

"sync"

"github.com/dedis/onet/log"
Expand Down Expand Up @@ -51,10 +49,7 @@ func newContext(c *Server, o *Overlay, servID ServiceID, manager *serviceManager
var contextDataPath = ""

func init() {
log.Print("hi", flag.Lookup("test.v"))
if flag.Lookup("test.v") == nil {
initContextDataPath()
}
initContextDataPath()
}

// NewTreeNodeInstance creates a TreeNodeInstance that is bound to a
Expand Down Expand Up @@ -209,7 +204,6 @@ func (c *Context) absFilename(id string) string {
// Returns the path to the file for storage/retrieval of the service-state.
func initContextDataPath() {
p := os.Getenv(ENVServiceData)
log.Print("path is", p)
if p == "" {
u, err := user.Current()
if err != nil {
Expand All @@ -235,7 +229,6 @@ var cdpMutex sync.Mutex
func setContextDataPath(path string) {
cdpMutex.Lock()
defer cdpMutex.Unlock()
log.Print(log.Stack())
contextDataPath = path
}

Expand Down
2 changes: 2 additions & 0 deletions local.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func NewLocalTest() *LocalTest {
log.Lvl4("Removing config-dir")
os.RemoveAll("config")
}
setContextDataPath("")
return &LocalTest{
Servers: make(map[network.ServerIdentityID]*Server),
Overlays: make(map[network.ServerIdentityID]*Overlay),
Expand All @@ -69,6 +70,7 @@ func NewLocalTest() *LocalTest {
func NewTCPTest() *LocalTest {
t := NewLocalTest()
t.mode = TCP
setContextDataPath("")
return t
}

Expand Down
9 changes: 4 additions & 5 deletions simul/manage/count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"testing"
"time"

"gopkg.in/dedis/onet.v1"
"gopkg.in/dedis/onet.v1/log"
"gopkg.in/dedis/onet.v1/network"
"gopkg.in/dedis/onet.v1/simul/manage"
"github.com/dedis/onet"
"github.com/dedis/onet/log"
"github.com/dedis/onet/network"
)

// Tests a 2-node system
Expand All @@ -21,7 +20,7 @@ func TestCount(t *testing.T) {
if err != nil {
t.Fatal("Couldn't start protocol:", err)
}
protocol := pi.(*manage.ProtocolCount)
protocol := pi.(*ProtocolCount)
timeout := network.WaitRetry * time.Duration(network.MaxRetryConnect*nbrNodes*2) * time.Millisecond
select {
case children := <-protocol.Count:
Expand Down

0 comments on commit b974f0e

Please sign in to comment.