From eee99cdd3fd4a888ca75e7ab41c49a2638de96d7 Mon Sep 17 00:00:00 2001 From: jbhusson <jonah@elixxir.io> Date: Tue, 13 Sep 2022 17:19:21 -0400 Subject: [PATCH] Send period should also be an int --- bindings/fileTransfer.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bindings/fileTransfer.go b/bindings/fileTransfer.go index 3d5d64580..88cda1ebc 100644 --- a/bindings/fileTransfer.go +++ b/bindings/fileTransfer.go @@ -181,20 +181,21 @@ func InitFileTransfer(e2eID int, receiveFileCallback ReceiveFileCallback, // - recipientID - marshalled recipient id.ID // - retry - number of retries allowed // - callback - callback that reports file sending progress -// - period - duration to wait between progress callbacks triggering +// - period - Duration (in ms) to wait between progress callbacks triggering. +// This value should depend on how frequently you want to receive +// updates, and should be tuned to your implementation. // // Returns: // - []byte - unique file transfer ID func (f *FileTransfer) Send(payload, recipientID []byte, retry float32, - callback FileTransferSentProgressCallback, period string) ([]byte, error) { + callback FileTransferSentProgressCallback, period int) ([]byte, error) { // Unmarshal recipient ID recipient, err := id.Unmarshal(recipientID) if err != nil { return nil, err } - // Parse duration to time.Duration - p, err := time.ParseDuration(period) + p := time.Millisecond * time.Duration(period) // Wrap transfer progress callback to be passed to fileTransfer layer cb := func(completed bool, arrived, total uint16, -- GitLab