| 83 | } |
| 84 | |
| 85 | void CSocketImpl::SyncConnection(const std::string& ip, uint16_t port, const char* buf, uint32_t buf_len) { |
| 86 | if (ip.length() > 16 || ip.empty()) { |
| 87 | base::LOG_ERROR("a wrong ip! ip : %s", ip.c_str()); |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | if (!_read_event->_client_socket) { |
| 92 | _read_event->_client_socket = memshared_from_this(); |
| 93 | } |
| 94 | |
| 95 | // set address info |
| 96 | strcpy(_ip, ip.c_str()); |
| 97 | _port = port; |
| 98 | |
| 99 | if (_event_actions) { |
| 100 | _read_event->_event_flag_set = 0; |
| 101 | _read_event->_event_flag_set |= EVENT_CONNECT; |
| 102 | if (_event_actions->AddConnection(_read_event, ip, port, buf, buf_len)) { |
| 103 | _post_event_num++; |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | void CSocketImpl::SyncConnection(const std::string& ip, uint16_t port) { |
| 109 | SyncConnection(ip, port, nullptr, 0); |
no test coverage detected