]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cfg.go
Fixed freq.chunked calculation
[nncp.git] / src / cfg.go
index 22da596baf206e6e61447d9ddd8974c5f55aa915..d46bf0e08ce8dbbed9dfddef04f6fc722100b02e 100644 (file)
@@ -21,6 +21,7 @@ import (
        "bytes"
        "encoding/json"
        "errors"
+       "fmt"
        "log"
        "os"
        "path"
@@ -190,7 +191,7 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) {
        }
 
        var freqPath *string
-       freqChunked := int64(MaxFileSize)
+       var freqChunked int64
        var freqMinSize int64
        freqMaxSize := int64(MaxFileSize)
        if cfg.Freq != nil {
@@ -445,6 +446,9 @@ func NewArea(ctx *Ctx, name string, cfg *AreaJSON) (*Area, error) {
                copy(area.Pub[:], pub)
        }
        if cfg.Prv != nil {
+               if area.Pub == nil {
+                       return nil, fmt.Errorf("area %s: prv requires pub presence", name)
+               }
                prv, err := Base32Codec.DecodeString(*cfg.Prv)
                if err != nil {
                        return nil, err