Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
eee99cdd
Commit
eee99cdd
authored
2 years ago
by
Jonah Husson
Browse files
Options
Downloads
Patches
Plain Diff
Send period should also be an int
parent
a70dac7e
No related branches found
No related tags found
2 merge requests
!510
Release
,
!380
Send period should also be an int
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/fileTransfer.go
+5
-4
5 additions, 4 deletions
bindings/fileTransfer.go
with
5 additions
and
4 deletions
bindings/fileTransfer.go
+
5
−
4
View file @
eee99cdd
...
@@ -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
str
in
g
)
([]
byte
,
error
)
{
callback
FileTransferSentProgressCallback
,
period
in
t
)
([]
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment