Hw4 nonblocking_st I/O#4
Open
Green-Chan wants to merge 25 commits into
Open
Conversation
8d59853 to
88ef622
Compare
Command arguments contains \r\n bytes
xphoenix
suggested changes
May 22, 2020
Comment on lines
+26
to
+27
| std::cout << "OnClose" << std::endl; | ||
| _event.events = 0; |
Comment on lines
+82
to
+83
| responses.push(result); | ||
| _event.events |= EPOLLOUT; |
|
|
||
| // See Connection.h | ||
| void Connection::DoWrite() { | ||
| std::cout << "DoWrite" << std::endl; |
Comment on lines
+108
to
+118
| while (!responses.empty() && buf_size - write_end >= responses.front().size() + 2) { | ||
| std::memmove(write_buf + write_end, responses.front().data(), responses.front().size()); | ||
| write_end += responses.front().size() + 2; | ||
| write_buf[write_end - 2] = '\r'; | ||
| write_buf[write_end - 1] = '\n'; | ||
| responses.pop(); | ||
| } | ||
| int writed; | ||
| if ((writed = write(_socket, write_buf + write_begin, write_end - write_begin)) > 0) { | ||
| write_begin += writed; | ||
| if (write_begin == write_end) { |
xphoenix
reviewed
Jun 9, 2020
Comment on lines
+110
to
+113
| written_responeses.push(std::move(responses.front())); | ||
| responses.pop(); | ||
| write_vec[write_vec_v].iov_base = &(written_responeses.back()[0]); | ||
| write_vec[write_vec_v].iov_len = written_responeses.back().size(); |
There was a problem hiding this comment.
for (auto it = responses.begin(), end = responses.end(); it != end; it++) {
...
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.