-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Attempting to fix issue #29 #31
Conversation
I don't think that this is correct. When the text becomes fragmented, the start of the command gets lost (i.e. You get around 96 "Invalid command" responses, and 3 for "Text has been indexed". I think it's because currently, the leftover gets thrown away. It should be kept instead of |
Yeah, you’re right. I rushed this fix a bit. I will update this PR hopefully today at some point with the correct solution. |
Okay, just pushed the fix for #29 and did some more thorough testing. It seems to be working now properly. Printing the commands as they enter |
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.
Seems to have fixed the issue now :)
if(should_close) { | ||
close(i); | ||
FD_CLR(i, &master_fds); | ||
dfree(connection_infos[i].last_command); |
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.
I think this should break from the loop, otherwise we'll try to write to a socket that has been closed, and try to access a string that has been freed.
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.
True, I added the break in this if statement. Should be good to go now.
@00-matt This PR is attempting to fix the issue discussed #23 (comment)
What I am doing is reading the
this->last_command
variable before it is sent toprocess_command
and splitting it at\r\n
and sending everything before the new line characters.What I am worried about is that after the loop is done I am sending what is left of the
command
variable which could be only a fragment of the original block of text for examplepig in a cage
when fragmented could becomeig in a cage
leading to false indices. I haven't been able to produce this issue when testing but I wanted to get a second set of eyes on the code before I merged it.