Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtego, libtego_ui: implemented file transfer UI #61

Merged

Conversation

morganava
Copy link
Collaborator

Squashed down my file transfer UI dev branch to a single commit for review.

@morganava morganava requested a review from m-simonelli March 6, 2021 17:48
typedef uint32_t tego_file_transfer_id_t;
// struct for file hash
typedef struct tego_file_hash tego_file_hash_t;
// intger type for file size

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@morganava morganava force-pushed the file_transfer_ui_review branch 2 times, most recently from 934b364 to aeac594 Compare March 7, 2021 14:39
Copy link

@m-simonelli m-simonelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than typos/minor issues

{
tego_file_transfer_response_accept, // proceed with a file transfer
tego_file_transfer_response_reject, // reject the file transfer
} tego_file_transfer_response_t;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be swapped, since protobuf treats it as 0 or 1 (i.e. true or false), and it's a bit counter intuitive treating true as false and vice versa.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure I agree. The response is an enum rather than a tego_bool_t in case we ended up needing different responses in the future (tego_file_transfer_response_maybe_later, tego_file_transfer_response_never_stop_asking, etc). I don't think it really matters, especially since this enum never actually makes its way down to the protofbuf layer.

tego_file_transfer_id_t id,
char const* fileName,
size_t fileNameLength,
uint64_t fileSize,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be tego_file_size_t to match the definition in tego.h (typedef void (*tego_file_transfer_request_received_callback_t))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah I thought I'd managed to find the last of these, will fix.

tego_file_transfer_id_t id,
tego_file_transfer_direction_t direction,
uint64_t bytesComplete,
uint64_t bytesTotal)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should both be changed to tego_file_size_t to match the declaration in tego.h (typedef void (*tego_file_transfer_progress_callback_t)

required uint32 file_id = 1;
required uint64 file_size = 2;
required string name = 3;
required bytes file_hash = 4;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these not be optional? Consider at some point we decide to make file_id's 64 bit - all old clients will fail to send files to newer clients. Also, if at any point we need to move to protobuf3, all fields become optional, so once again old clients will not work properly with newer clients.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See reasoning for removal in protobuf3: protocolbuffers/protobuf#2497 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That actually makes a lot of sense. My reasoning had been, why bother making all of these verbose checks on the existence of params, when we can just mark them required and let protbuf handle the check for us. This will be a bit of effort to reimplement, but I'll try and get to it today.

@morganava morganava force-pushed the file_transfer_ui_review branch from aeac594 to c365198 Compare March 11, 2021 12:47
@morganava
Copy link
Collaborator Author

Ok made the suggested changes, and squashed to review branch

@morganava morganava merged commit 6147867 into blueprint-freespeech:v3-2021-beta Mar 11, 2021
@morganava morganava deleted the file_transfer_ui_review branch March 24, 2022 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants