concurrent signing implementation
This commit is contained in:
parent
449c2c013d
commit
3e1111c6b3
2
msg.go
2
msg.go
|
@ -45,7 +45,7 @@ var (
|
|||
ErrSecret error = &Error{Err: "dns: no secrets defined"}
|
||||
ErrSigGen error = &Error{Err: "dns: bad signature generation"}
|
||||
ErrAuth error = &Error{Err: "dns: bad authentication"}
|
||||
ErrSoa error = &Error{Err: "dns: no SOA"}
|
||||
ErrSoa error = &Error{Err: "dns: no SOA"}
|
||||
ErrHandle error = &Error{Err: "dns: handle is nil"}
|
||||
ErrChan error = &Error{Err: "dns: channel is nil"}
|
||||
ErrName error = &Error{Err: "dns: type not found for name"}
|
||||
|
|
18
zone.go
18
zone.go
|
@ -316,7 +316,6 @@ func (z *Zone) Sign(keys map[*RR_DNSKEY]PrivateKey, config *SignatureConfig) err
|
|||
|
||||
// Start the signer goroutines
|
||||
for i := 0; i < config.SignerRoutines; i++ {
|
||||
println("Signer", i, "started")
|
||||
go signerRoutine(keys, keytags, config, signChan, errChan)
|
||||
}
|
||||
|
||||
|
@ -329,14 +328,23 @@ func (z *Zone) Sign(keys map[*RR_DNSKEY]PrivateKey, config *SignatureConfig) err
|
|||
next := apex.Next()
|
||||
signChan <- &signData{apex.Value.(*ZoneData), next.Value.(*ZoneData)}
|
||||
|
||||
var err error
|
||||
Sign:
|
||||
for next.Value.(*ZoneData).Name != z.Origin {
|
||||
nextnext := next.Next()
|
||||
signChan <- &signData{next.Value.(*ZoneData), nextnext.Value.(*ZoneData)}
|
||||
next = nextnext
|
||||
select {
|
||||
case err = <-errChan:
|
||||
break Sign
|
||||
default:
|
||||
nextnext := next.Next()
|
||||
signChan <- &signData{next.Value.(*ZoneData), nextnext.Value.(*ZoneData)}
|
||||
next = nextnext
|
||||
}
|
||||
}
|
||||
println("READY")
|
||||
close(signChan)
|
||||
close(errChan)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue