| 119 | } |
| 120 | |
| 121 | void TcpConnection::start() { |
| 122 | if (socket_pipe_) { |
| 123 | socket_pipe_.subscribe(); |
| 124 | } else { |
| 125 | simple_pipe_.subscribe(); |
| 126 | } |
| 127 | update_timer(); |
| 128 | notify(); |
| 129 | |
| 130 | if (is_client_) { |
| 131 | LOG(DEBUG) << "tcp: sending handshake"; |
| 132 | auto id = td::Random::secure_uint64(); |
| 133 | auto data = create_serialize_tl_object<cocoon_api::tcp_connect>(id); |
| 134 | send_uninit(std::move(data)); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void TcpConnection::send_uninit(td::BufferSlice data) { |
| 139 | send(std::move(data)); |