X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=blobdiff_plain;f=src%2Fcfg.go;h=8a7cb34ddc2099fea8f92b35333bad5d8a762f2d;hp=a57277e88be3462aee9c4dcc4ab1d1282d07cd62;hb=2e22bda93fdf8f2f84e4d19b3f1d46318b497139;hpb=16b44ce6e0f7e3d668c8cf7edf0ecf0bb38e1a4c diff --git a/src/cfg.go b/src/cfg.go index a57277e..8a7cb34 100644 --- a/src/cfg.go +++ b/src/cfg.go @@ -56,6 +56,7 @@ type NodeJSON struct { Incoming *string `json:"incoming,omitempty"` Exec map[string][]string `json:"exec,omitempty"` Freq *NodeFreqJSON `json:"freq,omitempty"` + ACK *NodeACKJSON `json:"ack,omitempty"` Via []string `json:"via,omitempty"` Calls []CallJSON `json:"calls,omitempty"` @@ -74,6 +75,11 @@ type NodeFreqJSON struct { MaxSize *uint64 `json:"maxsize,omitempty"` } +type NodeACKJSON struct { + MinSize *uint64 `json:"minsize,omitempty"` + Nice *string `json:"nice,omitempty"` +} + type CallJSON struct { Cron string `json:"cron"` Nice *string `json:"nice,omitempty"` @@ -94,6 +100,8 @@ type CallJSON struct { AutoTossNoExec bool `json:"autotoss-noexec,omitempty"` AutoTossNoTrns bool `json:"autotoss-notrns,omitempty"` AutoTossNoArea bool `json:"autotoss-noarea,omitempty"` + AutoTossNoACK bool `json:"autotoss-noack,omitempty"` + AutoTossGenACK bool `json:"autotoss-gen-ack,omitempty"` } type NodeOurJSON struct { @@ -220,6 +228,20 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) { } } + ackNice := uint8(255) + var ackMinSize int64 + if cfg.ACK != nil { + if cfg.ACK.Nice != nil { + ackNice, err = NicenessParse(*cfg.ACK.Nice) + if err != nil { + return nil, err + } + } + if cfg.ACK.MinSize != nil { + ackMinSize = int64(*cfg.ACK.MinSize) * 1024 + } + } + defRxRate := 0 if cfg.RxRate != nil && *cfg.RxRate > 0 { defRxRate = *cfg.RxRate @@ -317,6 +339,8 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) { call.AutoTossNoExec = callCfg.AutoTossNoExec call.AutoTossNoTrns = callCfg.AutoTossNoTrns call.AutoTossNoArea = callCfg.AutoTossNoArea + call.AutoTossNoACK = callCfg.AutoTossNoACK + call.AutoTossGenACK = callCfg.AutoTossGenACK calls = append(calls, &call) } @@ -332,6 +356,8 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) { FreqChunked: freqChunked, FreqMinSize: freqMinSize, FreqMaxSize: freqMaxSize, + ACKNice: ackNice, + ACKMinSize: ackMinSize, Calls: calls, Addrs: cfg.Addrs, RxRate: defRxRate,