Skip to content

Commit

Permalink
use client->Close() to avoid fd multi close
Browse files Browse the repository at this point in the history
  • Loading branch information
CatKang committed Oct 27, 2016
1 parent d942b77 commit 83ce360
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pika_binlog_sender_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void* PikaBinlogSenderThread::ThreadMain() {
}

// error
close(cli_->fd());
cli_->Close();
sleep(1);
}
return NULL;
Expand Down
8 changes: 4 additions & 4 deletions src/pika_slaveping_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void* PikaSlavepingThread::ThreadMain() {
while (true) {
if (should_exit_) {
LOG(INFO) << "Close Slaveping Thread now";
close(cli_->fd());
cli_->Close();
g_pika_server->pika_binlog_receiver_thread()->KillBinlogSender();
break;
}
Expand All @@ -69,13 +69,13 @@ void* PikaSlavepingThread::ThreadMain() {
if (now.tv_sec - last_interaction.tv_sec > 30) {
//timeout;
LOG(WARNING) << "Ping master timeout";
close(cli_->fd());
cli_->Close();
g_pika_server->pika_binlog_receiver_thread()->KillBinlogSender();
break;
}
} else {
LOG(WARNING) << "Ping master error";
close(cli_->fd());
cli_->Close();
g_pika_server->pika_binlog_receiver_thread()->KillBinlogSender();
break;
}
Expand All @@ -87,7 +87,7 @@ void* PikaSlavepingThread::ThreadMain() {
LOG(WARNING) << "Slaveping, Connect timeout";
if ((++connect_retry_times) >= 30) {
LOG(WARNING) << "Slaveping, Connect timeout 10 times, disconnect with master";
close(cli_->fd());
cli_->Close();
g_pika_server->pika_binlog_receiver_thread()->KillBinlogSender();
connect_retry_times = 0;
}
Expand Down

0 comments on commit 83ce360

Please sign in to comment.