| 1394 | } |
| 1395 | |
| 1396 | int CSockLink::OutputNotify() |
| 1397 | { |
| 1398 | int32_t ret = 0; |
| 1399 | |
| 1400 | this->_last_access = mt_time_ms(); |
| 1401 | |
| 1402 | if (_state & LINK_CONNECTING) |
| 1403 | { |
| 1404 | _state &= ~LINK_CONNECTING; |
| 1405 | _state |= LINK_CONNECTED; |
| 1406 | |
| 1407 | CNetHandler* item = NULL; |
| 1408 | CNetHandler* tmp = NULL; |
| 1409 | TAILQ_FOREACH_SAFE(item, &_wait_connect, _link_entry, tmp) |
| 1410 | { |
| 1411 | NotifyThread(item, 0); |
| 1412 | item->SwitchToIdle(); |
| 1413 | } |
| 1414 | } |
| 1415 | |
| 1416 | if (_proto_type == NET_PROTO_UDP) |
| 1417 | { |
| 1418 | ret = SendCacheUdp(NULL, 0); |
| 1419 | } |
| 1420 | else |
| 1421 | { |
| 1422 | ret = SendCacheTcp(NULL, 0); |
| 1423 | } |
| 1424 | |
| 1425 | if (ret < 0) |
| 1426 | { |
| 1427 | MTLOG_ERROR("Send on link failed, close it, ret %d[%m]", ret); |
| 1428 | _errno = RC_SEND_FAIL; |
| 1429 | this->Destroy(); |
| 1430 | return ret; |
| 1431 | } |
| 1432 | |
| 1433 | if (TAILQ_EMPTY(&_wait_send)) |
| 1434 | { |
| 1435 | this->DisableOutput(); |
| 1436 | if (!MtFrame::Instance()->KqueueCtrlDel(_fd, KQ_EVENT_WRITE)) |
| 1437 | { |
| 1438 | MTLOG_ERROR("socket epoll mng failed[%m], wait timeout"); |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | return 0; |
| 1443 | } |
| 1444 | |
| 1445 | int CSockLink::HangupNotify() |
| 1446 | { |
nothing calls this directly
no test coverage detected