Skip to content
Snippets Groups Projects
Commit 522c365c authored by Jono Wenger's avatar Jono Wenger
Browse files

Fix file transfer bindings

parent 36ee52f3
Branches
Tags
3 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!340Project/channels
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package bindings package bindings
import ( import (
"encoding/json"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/fileTransfer" "gitlab.com/elixxir/client/fileTransfer"
e2eFileTransfer "gitlab.com/elixxir/client/fileTransfer/e2e" e2eFileTransfer "gitlab.com/elixxir/client/fileTransfer/e2e"
...@@ -46,7 +47,7 @@ func GetDefaultE2EParams() []byte { ...@@ -46,7 +47,7 @@ func GetDefaultE2EParams() []byte {
// modify the JSON to change file transfer settings. // modify the JSON to change file transfer settings.
func GetDefaultFileTransferParams() []byte { func GetDefaultFileTransferParams() []byte {
defaultParams := fileTransfer.DefaultParams() defaultParams := fileTransfer.DefaultParams()
data, err := defaultParams.MarshalJSON() data, err := json.Marshal(defaultParams)
if err != nil { if err != nil {
jww.FATAL.Panicf("Failed to JSON marshal file transfer params: %+v", err) jww.FATAL.Panicf("Failed to JSON marshal file transfer params: %+v", err)
} }
...@@ -70,7 +71,7 @@ func GetDefaultSingleUseParams() []byte { ...@@ -70,7 +71,7 @@ func GetDefaultSingleUseParams() []byte {
// modify the JSON to change single use settings. // modify the JSON to change single use settings.
func GetDefaultE2eFileTransferParams() []byte { func GetDefaultE2eFileTransferParams() []byte {
defaultParams := e2eFileTransfer.DefaultParams() defaultParams := e2eFileTransfer.DefaultParams()
data, err := defaultParams.MarshalJSON() data, err := json.Marshal(defaultParams)
if err != nil { if err != nil {
jww.FATAL.Panicf("Failed to JSON marshal e2e file transfer params: %+v", err) jww.FATAL.Panicf("Failed to JSON marshal e2e file transfer params: %+v", err)
} }
...@@ -81,7 +82,7 @@ func GetDefaultE2eFileTransferParams() []byte { ...@@ -81,7 +82,7 @@ func GetDefaultE2eFileTransferParams() []byte {
// marshalled [e2eFileTransfer.Params]. // marshalled [e2eFileTransfer.Params].
func parseE2eFileTransferParams(data []byte) (e2eFileTransfer.Params, error) { func parseE2eFileTransferParams(data []byte) (e2eFileTransfer.Params, error) {
p := &e2eFileTransfer.Params{} p := &e2eFileTransfer.Params{}
return *p, p.UnmarshalJSON(data) return *p, json.Unmarshal(data, p)
} }
// parseSingleUseParams is a helper function which parses a JSON marshalled // parseSingleUseParams is a helper function which parses a JSON marshalled
...@@ -95,7 +96,7 @@ func parseSingleUseParams(data []byte) (single.RequestParams, error) { ...@@ -95,7 +96,7 @@ func parseSingleUseParams(data []byte) (single.RequestParams, error) {
// [fileTransfer.Params]. // [fileTransfer.Params].
func parseFileTransferParams(data []byte) (fileTransfer.Params, error) { func parseFileTransferParams(data []byte) (fileTransfer.Params, error) {
p := &fileTransfer.Params{} p := &fileTransfer.Params{}
return *p, p.UnmarshalJSON(data) return *p, json.Unmarshal(data, p)
} }
// parseCMixParams is a helper function which parses a JSON marshalled // parseCMixParams is a helper function which parses a JSON marshalled
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment