diff --git a/bzz/bzzup/bzzup.sh b/bzz/bzzup/bzzup.sh index 035cbfc266..fd1e03d31a 100755 --- a/bzz/bzzup/bzzup.sh +++ b/bzz/bzzup/bzzup.sh @@ -5,7 +5,7 @@ INDEX='index.html' bzzroot="$1" [ "_$1" = _ ] && bzzroot=. -delimiter='[{' +delimiter='{"entries":[{' pushd "$bzzroot" > /dev/null @@ -16,11 +16,11 @@ name=`echo "$path" | cut -c2-` echo -n "$delimiter" hash=`wget -q -O- --post-file="$path" http://localhost:8500/raw` mime=`mimetype -b "$path"` -echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"content_type\":\"$mime\"" +echo -n "\"hash\":\"$hash\",\"path\":\"$name\",\"contentType\":\"$mime\"" delimiter='},{' done -echo -n '}]') | wget -q -O- --post-data=`cat` http://localhost:8500/raw +echo -n '}]}') | wget -q -O- --post-data=`cat` http://localhost:8500/raw echo diff --git a/bzz/dpa.go b/bzz/dpa.go index 8f3ba50e7c..9310c83b92 100644 --- a/bzz/dpa.go +++ b/bzz/dpa.go @@ -108,6 +108,7 @@ func (self *DPA) Start() { self.quitC = make(chan bool) self.storeLoop() self.retrieveLoop() + dpaLogger.Infof("Swarm started.") } func (self *DPA) Stop() { diff --git a/bzz/httpaccess.go b/bzz/httpaccess.go index 3225b3a204..b60066e6a5 100644 --- a/bzz/httpaccess.go +++ b/bzz/httpaccess.go @@ -141,7 +141,7 @@ func handler(w http.ResponseWriter, r *http.Request, dpa *DPA) { if int64(size) < manifestReader.Size() { dpaLogger.Debugf("Swarm: Manifest %s not found.", name) if err == nil { - http.Error(w, "Manifest retrieval cut short: "+string(size)+"<"+string(manifestReader.Size()), + http.Error(w, "Manifest retrieval cut short: "+string(size)+"<"+string(manifestReader.Size()), http.StatusNotFound) } else { http.Error(w, err.Error(), http.StatusNotFound) @@ -215,5 +215,6 @@ func StartHttpServer(dpa *DPA) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { handler(w, r, dpa) }) - http.ListenAndServe(port, nil) + go http.ListenAndServe(port, nil) + dpaLogger.Infof("Swarm HTTP proxy started.") } diff --git a/eth/backend.go b/eth/backend.go index 62cd506f71..470cb55930 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -103,7 +103,7 @@ type Ethereum struct { func New(config *Config) (*Ethereum, error) { // Boostrap database logger := ethlogger.New(config.DataDir, config.LogFile, config.LogLevel, config.LogFormat) - db, err := ethdb.NewLDBDatabase("blockchain") + db, err := ethdb.NewLDBDatabase(config.DataDir + "/blockchain") if err != nil { return nil, err } @@ -112,7 +112,7 @@ func New(config *Config) (*Ethereum, error) { d, _ := db.Get([]byte("ProtocolVersion")) protov := ethutil.NewValue(d).Uint() if protov != ProtocolVersion && protov != 0 { - return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, ethutil.Config.ExecPath+"/database") + return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, config.DataDir+"/blockchain") } // Create new keymanager @@ -164,8 +164,6 @@ func New(config *Config) (*Ethereum, error) { Chunker: chunker, ChunkStore: netStore, } - eth.dpa.Start() - go bzz.StartHttpServer(eth.dpa) netprv := config.NodeKey if netprv == nil { @@ -276,6 +274,9 @@ func (s *Ethereum) Start(p string, pull string) error { s.whisper.Start() } + s.dpa.Start() + bzz.StartHttpServer(s.dpa) + // broadcast transactions s.txSub = s.eventMux.Subscribe(core.TxPreEvent{}) go s.txBroadcastLoop()