refactor: simplify NewNaClEncryptor

- rely on default nil values on initialisation
- inline
This commit is contained in:
Matthias Radestock committed 2015-03-28 19:49:01 +00:00
1 parent 9992992ee4
commit 9a462f9d87
1 file changed
+6 -16
+6 -16
View File
@@ -308,24 +308,14 @@ func (nd *NonDecryptor) ReceiveNonce(msg []byte) {
}
func NewNaClDecryptor(conn *LocalConnection) *NaClDecryptor {
inst := NaClDecryptorInstance{
nonce: nil,
previousNonce: nil,
usedOffsets: bit.New(),
previousUsedOffsets: nil,
highestOffsetSeen: 0,
nonceChan: make(chan *[24]byte, ChannelSize)}
instDF := NaClDecryptorInstance{
nonce: nil,
previousNonce: nil,
usedOffsets: bit.New(),
previousUsedOffsets: nil,
highestOffsetSeen: 0,
nonceChan: make(chan *[24]byte, ChannelSize)}
return &NaClDecryptor{
NonDecryptor: *NewNonDecryptor(conn),
instance: &inst,
instanceDF: &instDF}
instance: &NaClDecryptorInstance{
usedOffsets: bit.New(),
nonceChan: make(chan *[24]byte, ChannelSize)},
instanceDF: &NaClDecryptorInstance{
usedOffsets: bit.New(),
nonceChan: make(chan *[24]byte, ChannelSize)}}
}
func (nd *NaClDecryptor) Shutdown() {