From e178642fea1f532e4c3794012333e25708d733be Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 24 Apr 2018 18:43:20 +0200 Subject: [PATCH] [client] Proper TMP renamed and commented 'SynchronisationKey()' --- src/git.xdrm.io/schastsp/client/client.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/git.xdrm.io/schastsp/client/client.go b/src/git.xdrm.io/schastsp/client/client.go index cb2061e..bdb8347 100644 --- a/src/git.xdrm.io/schastsp/client/client.go +++ b/src/git.xdrm.io/schastsp/client/client.go @@ -140,14 +140,21 @@ func (c *T) Receive(r io.Reader) error { -/* (5) TMP +/* (5) Returns a synchronisation key (first server connection) +* +* @return key<[]byte> Synchronisation key +* @return err * ---------------------------------------------------------*/ -func (c *T) TMP() []byte { - hash, err := c.key.CurrentHash() - if err != nil { panic(err) } +func (c *T) SynchronisationKey() ([]byte, error) { + /* (1) Get current hash */ + hash, err := c.key.CurrentHash() + if err != nil { return nil, err } + + /* (2) Decrement key so 'hash' is valid */ c.key.Decrement() - return hash; + /* (3) Return key */ + return hash, nil; }