node: customizable protocol and service stacks
This commit is contained in:
@ -90,12 +90,11 @@ type transport interface {
|
||||
// that was most recently active is the first element in entries.
|
||||
type bucket struct{ entries []*Node }
|
||||
|
||||
func newTable(t transport, ourID NodeID, ourAddr *net.UDPAddr, nodeDBPath string) *Table {
|
||||
func newTable(t transport, ourID NodeID, ourAddr *net.UDPAddr, nodeDBPath string) (*Table, error) {
|
||||
// If no node database was given, use an in-memory one
|
||||
db, err := newNodeDB(nodeDBPath, Version, ourID)
|
||||
if err != nil {
|
||||
glog.V(logger.Warn).Infoln("Failed to open node database:", err)
|
||||
db, _ = newNodeDB("", Version, ourID)
|
||||
return nil, err
|
||||
}
|
||||
tab := &Table{
|
||||
net: t,
|
||||
@ -114,7 +113,7 @@ func newTable(t transport, ourID NodeID, ourAddr *net.UDPAddr, nodeDBPath string
|
||||
tab.buckets[i] = new(bucket)
|
||||
}
|
||||
go tab.refreshLoop()
|
||||
return tab
|
||||
return tab, nil
|
||||
}
|
||||
|
||||
// Self returns the local node.
|
||||
|
Reference in New Issue
Block a user