Skip to content

Hw4 nonblocking_st I/O#4

Open
Green-Chan wants to merge 25 commits into
masterfrom
HW4-Nonblocking_st_IO
Open

Hw4 nonblocking_st I/O#4
Green-Chan wants to merge 25 commits into
masterfrom
HW4-Nonblocking_st_IO

Conversation

@Green-Chan

Copy link
Copy Markdown
Owner

No description provided.

@Green-Chan Green-Chan changed the title Hw4 nonblocking st io Hw4 nonblocking_st I/O Apr 10, 2020
@Green-Chan Green-Chan changed the base branch from master to HW1-Storage May 5, 2020 17:58
@Green-Chan Green-Chan changed the base branch from HW1-Storage to master May 5, 2020 17:59
@Green-Chan Green-Chan force-pushed the HW4-Nonblocking_st_IO branch from 8d59853 to 88ef622 Compare May 5, 2020 18:19
Comment on lines +26 to +27
std::cout << "OnClose" << std::endl;
_event.events = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isalive = false

Comment on lines +82 to +83
responses.push(result);
_event.events |= EPOLLOUT;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

epollсtl - дорогой вызов


// See Connection.h
void Connection::DoWrite() {
std::cout << "DoWrite" << std::endl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

-10 баллов Грифендору :((

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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

writev

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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

for (auto it = responses.begin(), end = responses.end(); it != end; it++) {
...
}

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