Skip to content

Commit

Permalink
if onnetworkchange is already on mq, no need to change to mq again
Browse files Browse the repository at this point in the history
  • Loading branch information
astrozhou committed Jul 7, 2017
1 parent 9b95afa commit 92ef750
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions mars/comm/messagequeue/message_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ static void __ReleaseMessageQueueInfo() {
const static int kMQCallANRId = 110;
const static long kWaitANRTimeout = 5 * 1000;
static void __ANRAssert(bool _iOS_style, const mars::comm::check_content& _content, MessageQueue_t _mq_id) {
if(MessageQueue2TID(_mq_id) == 0) {
xwarn2(TSF"messagequeue already destroy:%_", _mq_id);
return;
}

__ASSERT2(_content.file.c_str(), _content.line, _content.func.c_str(), "anr dead lock", "timeout:%d, tid:%" PRIu64 ", runing time:%" PRIu64 ", real time:%" PRIu64 ", used_cpu_time:%" PRIu64 ", iOS_style:%d",
_content.timeout, _content.tid, clock_app_monotonic() - _content.start_time, gettickcount() - _content.start_tickcount, _content.used_cpu_time, _iOS_style);
Expand Down
2 changes: 1 addition & 1 deletion mars/stn/src/longlink_connect_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool LongLinkConnectMonitor::MakeSureConnected() {
}

bool LongLinkConnectMonitor::NetworkChange() {
xdebug_function();
xinfo_function();
#if 0//def __APPLE__
__StopTimer();

Expand Down
2 changes: 1 addition & 1 deletion mars/stn/src/longlink_task_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ unsigned int LongLinkTaskManager::GetTasksContinuousFailCount() {
}

void LongLinkTaskManager::RedoTasks() {
xdebug_function();
xinfo_function();

std::list<TaskProfile>::iterator first = lst_cmd_.begin();
std::list<TaskProfile>::iterator last = lst_cmd_.end();
Expand Down
3 changes: 1 addition & 2 deletions mars/stn/src/net_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void NetCore::ClearTasks() {

void NetCore::OnNetworkChange() {

ASYNC_BLOCK_START
SYNC2ASYNC_FUNC(boost::bind(&NetCore::OnNetworkChange, this)); //if already messagequeue, no need to async

xinfo_function();

Expand Down Expand Up @@ -441,7 +441,6 @@ void NetCore::OnNetworkChange() {
shortlink_try_flag_ = false;
shortlink_error_count_ = 0;

ASYNC_BLOCK_END
}

void NetCore::KeepSignal() {
Expand Down
2 changes: 1 addition & 1 deletion mars/stn/src/net_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ void NetSource::ReportShortIP(bool _is_success, const std::string& _ip, const st
}

void NetSource::ClearCache() {
xverbose_function();
xinfo_function();
ipportstrategy_.InitHistory2BannedList(true);
}

Expand Down
2 changes: 1 addition & 1 deletion mars/stn/src/netsource_timercheck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ NetSourceTimerCheck::~NetSourceTimerCheck() {

void NetSourceTimerCheck::CancelConnect() {
RETURN_NETCORE_SYNC2ASYNC_FUNC(boost::bind(&NetSourceTimerCheck::CancelConnect, this));
xdebug_function();
xinfo_function();

if (!thread_.isruning()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion mars/stn/src/shortlink_task_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ void ShortLinkTaskManager::__OnRecv(ShortLinkInterface* _worker, unsigned int _c
}

void ShortLinkTaskManager::RedoTasks() {
xdebug_function();
xinfo_function();

std::list<TaskProfile>::iterator first = lst_cmd_.begin();
std::list<TaskProfile>::iterator last = lst_cmd_.end();
Expand Down
1 change: 1 addition & 0 deletions mars/stn/src/zombie_task_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void ZombieTaskManager::ClearTasks()

void ZombieTaskManager::RedoTasks()
{
xinfo_function();
__StartTask();
}

Expand Down

0 comments on commit 92ef750

Please sign in to comment.