Skip to content
Snippets Groups Projects
Commit 93355d56 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Fixed some bugs on transmit

parent c08579f7
No related branches found
No related tags found
1 merge request!1Lento
...@@ -154,7 +154,13 @@ void Protocol::transmit(int sockt, int window){ ...@@ -154,7 +154,13 @@ void Protocol::transmit(int sockt, int window){
printf("astoi %i\n", response.getMessages().back().getDataAsString()[0]); printf("astoi %i\n", response.getMessages().back().getDataAsString()[0]);
int ackIndex = response.getMessages().back().getDataAsString()[0]; int ackIndex = response.getMessages().back().getDataAsString()[0];
for(int j=0; j < frame.size();) { for(int j=0; j < frame.size();) {
if(frame[j].index <= ackIndex) { cout << "ackIndex: " << ackIndex << "frame[j].index: " << frame[j].index << endl;
if(ackIndex == 0) {
if((frame[j].index % (MAXSIZE+1)) == 62 || (frame[j].index % (MAXSIZE+1)) == 63 || (frame[j].index % (MAXSIZE+1)) == 0) {
frame.erase(frame.begin() + j);
--messagesLeft;
} else ++j;
} else if((frame[j].index % (MAXSIZE+1)) <= ackIndex) {
frame.erase(frame.begin() + j); frame.erase(frame.begin() + j);
--messagesLeft; --messagesLeft;
} else ++j; } else ++j;
......
#!/bin/bash #!/bin/bash
rm 10.txt 100.txt 1000.txt
for i in {1..10} for i in {1..10}
do do
echo -e "$i\n">>10.txt echo -e "$i\n">>10.txt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment