-
Notifications
You must be signed in to change notification settings - Fork 29
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
Peers now transmit their role before sending file #13
base: master
Are you sure you want to change the base?
Conversation
Program.cs
Outdated
@@ -9,6 +9,9 @@ namespace p2pcopy | |||
{ | |||
class Program | |||
{ | |||
public static string ReceiverRole = "receiver"; | |||
public static string SenderRole = "sender"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rather use an enum? and then use .ToString()
Program.cs
Outdated
static int SleepTime(DateTime now) | ||
{ | ||
List<int> seconds = new List<int>() {10, 20, 30, 40, 50, 60}; | ||
List<int> seconds = new List<int>() { 10, 20, 30, 40, 50, 60 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's try to remove hunks that are unrelated
if (role == myRole.ToString()) | ||
{ | ||
Console.Error.WriteLine("Peers can't have the same role."); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you exit the function like this, this won't translate into a non-zero exitcode for the program
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you suggest instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call directly Environment.Exit? I know it doesn't seem very clean, but it would be more correct.
@psantosl can you review/merge? |
Fix #12 by transmitting roles before file transfer.