Browse Source

Barak registration fix. Retries every hour now.

pull/67/head
Jae Kwon 10 years ago
parent
commit
01b21fcbf2
2 changed files with 26 additions and 6 deletions
  1. +16
    -0
      NOTES
  2. +10
    -6
      cmd/barak/main.go

+ 16
- 0
NOTES View File

@ -0,0 +1,16 @@
debugging this thing.
Why doesn't the network boot up quicker?
Why does the VI:0 Precommit for height 1 not come around after round 1 and before round 6?
[Vote VI:0 V:Precommit{1/0 4B634C4301EA#PartSet{T:1 67344F9BB237} 9974E3F32592}]
[Vote VI:0 V:Precommit{1/1 4B634C4301EA#PartSet{T:1 67344F9BB237} B600DBFA00B3}]
[Vote VI:0 V:Precommit{1/6 4B634C4301EA#PartSet{T:1 67344F9BB237} 2C51D4B6047C}]
Yet blackshadow did send a Prevote for 1/2 to whiteferret...
DBUG[05-04|14:19:36] Send module=p2p channel=22 connection=MConn{162.243.85.60:52630} msg="[Vote VI:0 V:Prevote{1/2 4B634C4301EA#PartSet{T:1 67344F9BB237} 2CFCF951C4D9}]"
Why did blackshadow not send Prevote{1/2} to any other peer?
Did whiteferret not broadcast the Prevote to anyone else?
What is the capacity of our buffers? (the defaultSendQueueCapcity for the VotesCh is 1. Oops)
Blackshadow was locked, so it did:
INFO[05-04|14:19:36] Signed and added vote module=consensus height=1 round=2 vote="Prevote{1/2 4B634C4301EA#PartSet{T:1 67344F9BB237} 2CFCF951C4D9}"

+ 10
- 6
cmd/barak/main.go View File

@ -103,13 +103,17 @@ func main() {
// Register this barak with central listener
for _, registry := range barak.registries {
go func(registry string) {
resp, err := http.Get(registry + "/register")
if err != nil {
fmt.Printf("Error registering to registry %v:\n %v\n", registry, err)
for {
resp, err := http.Get(registry + "/register")
if err != nil {
fmt.Printf("Error registering to registry %v:\n %v\n", registry, err)
time.Sleep(1 * time.Hour)
continue
}
body, _ := ioutil.ReadAll(resp.Body)
fmt.Printf("Successfully registered with registry %v\n %v\n", registry, string(body))
return
}
body, _ := ioutil.ReadAll(resp.Body)
fmt.Printf("Successfully registered with registry %v\n %v\n", registry, string(body))
}(registry)
}
@ -276,7 +280,7 @@ func ListProcesses() (*ResponseListProcesses, error) {
// Another barak instance registering its external
// address to a remote barak.
func Register(w http.ResponseWriter, req *http.Request) {
registry, err := os.OpenFile(barak.rootDir+"/registry.log", os.O_RDWR|os.O_APPEND|os.O_CREATE, 0x600)
registry, err := os.OpenFile(barak.rootDir+"/registry.log", os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600)
if err != nil {
http.Error(w, "Could not open registry file. Please contact the administrator", 500)
return


Loading…
Cancel
Save