Skip to content
Snippets Groups Projects
Commit d6f371bd authored by Jake Taylor's avatar Jake Taylor :lips:
Browse files

Merge branch 'jonah/send-period' into 'release'

Send period should also be an int

See merge request !380
parents a70dac7e eee99cdd
No related branches found
No related tags found
2 merge requests!510Release,!380Send period should also be an int
...@@ -181,20 +181,21 @@ func InitFileTransfer(e2eID int, receiveFileCallback ReceiveFileCallback, ...@@ -181,20 +181,21 @@ func InitFileTransfer(e2eID int, receiveFileCallback ReceiveFileCallback,
// - recipientID - marshalled recipient id.ID // - recipientID - marshalled recipient id.ID
// - retry - number of retries allowed // - retry - number of retries allowed
// - callback - callback that reports file sending progress // - 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: // Returns:
// - []byte - unique file transfer ID // - []byte - unique file transfer ID
func (f *FileTransfer) Send(payload, recipientID []byte, retry float32, func (f *FileTransfer) Send(payload, recipientID []byte, retry float32,
callback FileTransferSentProgressCallback, period string) ([]byte, error) { callback FileTransferSentProgressCallback, period int) ([]byte, error) {
// Unmarshal recipient ID // Unmarshal recipient ID
recipient, err := id.Unmarshal(recipientID) recipient, err := id.Unmarshal(recipientID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Parse duration to time.Duration p := time.Millisecond * time.Duration(period)
p, err := time.ParseDuration(period)
// Wrap transfer progress callback to be passed to fileTransfer layer // Wrap transfer progress callback to be passed to fileTransfer layer
cb := func(completed bool, arrived, total uint16, cb := func(completed bool, arrived, total uint16,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment