diff --git a/pkg/blockrsync/client.go b/pkg/blockrsync/client.go index 90999b2..dc2218a 100644 --- a/pkg/blockrsync/client.go +++ b/pkg/blockrsync/client.go @@ -57,7 +57,7 @@ func (b *BlockrsyncClient) ConnectToTarget() error { b.sourceSize = size b.log.V(5).Info("Hashed file", "filename", b.sourceFile, "size", size) reader := snappy.NewReader(conn) - if match, err := b.hasher.CompareHashHash(conn); err != nil { + if match, err := b.hasher.CompareHashOfHash(conn); err != nil { return err } else if match { b.log.Info("No differences found, exiting") diff --git a/pkg/blockrsync/hasher.go b/pkg/blockrsync/hasher.go index a97e519..b9f8945 100644 --- a/pkg/blockrsync/hasher.go +++ b/pkg/blockrsync/hasher.go @@ -36,7 +36,7 @@ type Hasher interface { SerializeHashes(io.Writer) error DeserializeHashes(io.Reader) (int64, map[int64][]byte, error) BlockSize() int64 - CompareHashHash(io.ReadWriter) (bool, error) + CompareHashOfHash(io.ReadWriter) (bool, error) } type OffsetHash struct { @@ -306,7 +306,7 @@ func (f *FileHasher) DeserializeHashes(r io.Reader) (int64, map[int64][]byte, er return blockSize, hashes, nil } -func (f *FileHasher) CompareHashHash(rw io.ReadWriter) (bool, error) { +func (f *FileHasher) CompareHashOfHash(rw io.ReadWriter) (bool, error) { f.log.V(5).Info("Comparing hash of hashes", "hash", base64.StdEncoding.EncodeToString(f.hashHash)) if n, err := rw.Write(f.hashHash); err != nil { return false, err diff --git a/pkg/blockrsync/server.go b/pkg/blockrsync/server.go index 7edfc92..83e2bf8 100644 --- a/pkg/blockrsync/server.go +++ b/pkg/blockrsync/server.go @@ -67,7 +67,7 @@ func (b *BlockrsyncServer) StartServer() error { defer conn.Close() writer := snappy.NewBufferedWriter(conn) <-readyChan - if match, err := b.hasher.CompareHashHash(conn); err != nil { + if match, err := b.hasher.CompareHashOfHash(conn); err != nil { return err } else if match { b.log.Info("No differences found, exiting")