Skip to content

Commit

Permalink
fix bug for flora service
Browse files Browse the repository at this point in the history
if socket write timeout, should shutdown the socket
  • Loading branch information
ming committed Jul 13, 2019
1 parent 1691599 commit b546016
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sock-adap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ int32_t SocketAdapter::write(const void *data, uint32_t size) {
if (r < 0) {
KLOGE(TAG, "write to socket failed: %s", strerror(errno));
close_nolock();
if (errno == EAGAIN)
if (errno == EAGAIN) {
::shutdown(socketfd, SHUT_RDWR);
return -2;
}
return -1;
}
return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/sock-poll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ void SocketPoll::run() {
if (it != adapters.end()) {
KLOGD(TAG, "read from fd %d", ifd);
if (!do_read(it->second)) {
KLOGD(TAG, "delete adapter %s",
it->second->info ? it->second->info->name.c_str() : "");
delete_adapter(it->second);
adapters.erase(it);
}
Expand Down

0 comments on commit b546016

Please sign in to comment.