Skip to content
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

AsyncMessenger: Fix send closed local_connection message problem #7255

Merged
merged 2 commits into from Jan 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/msg/async/AsyncConnection.cc
Expand Up @@ -106,6 +106,7 @@ class C_handle_dispatch : public EventCallback {
C_handle_dispatch(AsyncMessenger *msgr, Message *m): msgr(msgr), m(m) {}
void do_request(int id) {
msgr->ms_deliver_dispatch(m);
delete this;
}
};

Expand All @@ -128,6 +129,7 @@ class C_deliver_accept : public EventCallback {
C_deliver_accept(AsyncMessenger *msgr, AsyncConnectionRef c): msgr(msgr), conn(c) {}
void do_request(int id) {
msgr->ms_deliver_handle_accept(conn.get());
delete this;
}
};

Expand Down Expand Up @@ -2025,11 +2027,17 @@ int AsyncConnection::send_message(Message *m)
m->set_connection(this);

if (async_msgr->get_myaddr() == get_peer_addr()) { //loopback connection
ldout(async_msgr->cct, 20) << __func__ << " " << *m << " local" << dendl;
Mutex::Locker l(write_lock);
local_messages.push_back(m);
center->dispatch_event_external(local_deliver_handler);
return 0;
ldout(async_msgr->cct, 20) << __func__ << " " << *m << " local" << dendl;
Mutex::Locker l(write_lock);
if (can_write != CLOSED) {
local_messages.push_back(m);
center->dispatch_event_external(local_deliver_handler);
} else {
ldout(async_msgr->cct, 10) << __func__ << " loopback connection closed."
<< " Drop message " << m << dendl;
m->put();
}
return 0;
}

// we don't want to consider local message here, it's too lightweight which
Expand Down