Skip to content

Commit

Permalink
fix flora service crash
Browse files Browse the repository at this point in the history
call reply should check caller if disconnected
  • Loading branch information
张晨 authored and 张晨 committed Jul 12, 2019
1 parent 9ccd8f5 commit aae9244
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/disp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ bool Dispatcher::handle_reply_req(shared_ptr<Caps> &msg_caps,
sender->info->name.c_str(), svrid);
return true;
}
if (it->sender->closed()) {
KLOGI(TAG, "<<< %s: reply %d failed. caller disconnected",
sender->info->name.c_str(), svrid);
return true;
}
Response resp;
resp.ret_code = ret_code;
resp.data = data;
Expand Down
2 changes: 1 addition & 1 deletion src/sock-poll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ shared_ptr<Adapter> SocketPoll::new_adapter(int fd) {
}

void SocketPoll::delete_adapter(shared_ptr<Adapter> &adap) {
dispatcher->erase_adapter(adap);
int fd = static_pointer_cast<SocketAdapter>(adap)->socket();
adap->close();
FD_CLR(fd, &all_fds);
::close(fd);
dispatcher->erase_adapter(adap);
}

bool SocketPoll::do_read(shared_ptr<Adapter> &adap) {
Expand Down

0 comments on commit aae9244

Please sign in to comment.