• Home
  • Raw
  • Download

Lines Matching refs:t

548 void send_packet(apacket* p, atransport* t) {  in send_packet()  argument
551 if (t->get_protocol_version() >= A_VERSION_SKIP_CHECKSUM) { in send_packet()
557 VLOG(TRANSPORT) << dump_packet(t->serial.c_str(), "to remote", p); in send_packet()
559 if (t == nullptr) { in send_packet()
563 if (t->Write(p) != 0) { in send_packet()
564 D("%s: failed to enqueue packet, closing transport", t->serial.c_str()); in send_packet()
565 t->Kick(); in send_packet()
569 void kick_transport(atransport* t, bool reset) { in kick_transport() argument
575 if (std::find(transport_list.begin(), transport_list.end(), t) != transport_list.end()) { in kick_transport()
577 t->Reset(); in kick_transport()
579 t->Kick(); in kick_transport()
687 for (const auto& t : transport_list) { in iterate_transports() local
688 if (!fn(t)) { in iterate_transports()
692 for (const auto& t : pending_list) { in iterate_transports() local
693 if (!fn(t)) { in iterate_transports()
765 atransport* t; in transport_registration_func() local
775 t = m.transport; in transport_registration_func()
778 D("transport: %s deleting", t->serial.c_str()); in transport_registration_func()
782 transport_list.remove(t); in transport_registration_func()
785 delete t; in transport_registration_func()
792 if (t->GetConnectionState() != kCsNoPerm) { in transport_registration_func()
795 t->connection()->SetTransportName(t->serial_name()); in transport_registration_func()
796 t->connection()->SetReadCallback([t](Connection*, std::unique_ptr<apacket> p) { in transport_registration_func()
797 if (!check_header(p.get(), t)) { in transport_registration_func()
798 D("%s: remote read: bad header", t->serial.c_str()); in transport_registration_func()
802 VLOG(TRANSPORT) << dump_packet(t->serial.c_str(), "from remote", p.get()); in transport_registration_func()
806 fdevent_run_on_main_thread([packet, t]() { handle_packet(packet, t); }); in transport_registration_func()
809 t->connection()->SetErrorCallback([t](Connection*, const std::string& error) { in transport_registration_func()
810 LOG(INFO) << t->serial_name() << ": connection terminated: " << error; in transport_registration_func()
811 fdevent_run_on_main_thread([t]() { in transport_registration_func()
812 handle_offline(t); in transport_registration_func()
813 transport_destroy(t); in transport_registration_func()
817 t->connection()->Start(); in transport_registration_func()
819 send_connect(t); in transport_registration_func()
825 auto it = std::find(pending_list.begin(), pending_list.end(), t); in transport_registration_func()
827 pending_list.remove(t); in transport_registration_func()
828 transport_list.push_front(t); in transport_registration_func()
863 for (auto t : transport_list) { in kick_all_transports() local
864 t->Kick(); in kick_all_transports()
870 for (auto t : transport_list) { in kick_all_tcp_tls_transports() local
871 if (t->IsTcpDevice() && t->use_tls) { in kick_all_tcp_tls_transports()
872 t->Kick(); in kick_all_tcp_tls_transports()
880 for (auto t : transport_list) { in kick_all_transports_by_auth_key() local
881 if (auth_key == t->auth_key) { in kick_all_transports_by_auth_key()
882 t->Kick(); in kick_all_transports_by_auth_key()
909 static void transport_destroy(atransport* t) { in transport_destroy() argument
911 CHECK(t != nullptr); in transport_destroy()
914 LOG(INFO) << "destroying transport " << t->serial_name(); in transport_destroy()
915 t->connection()->Stop(); in transport_destroy()
917 if (t->IsTcpDevice() && !t->kicked()) { in transport_destroy()
918 D("transport: %s destroy (attempting reconnection)", t->serial.c_str()); in transport_destroy()
922 t->ResetKeys(); in transport_destroy()
923 reconnect_handler.TrackTransport(t); in transport_destroy()
928 D("transport: %s destroy (kicking and closing)", t->serial.c_str()); in transport_destroy()
929 remove_transport(t); in transport_destroy()
974 for (const auto& t : transport_list) { in acquire_one_transport() local
975 if (t->GetConnectionState() == kCsNoPerm) { in acquire_one_transport()
981 if (t->id == transport_id) { in acquire_one_transport()
982 result = t; in acquire_one_transport()
986 if (t->MatchesTarget(serial)) { in acquire_one_transport()
993 result = t; in acquire_one_transport()
996 if (type == kTransportUsb && t->type == kTransportUsb) { in acquire_one_transport()
1003 result = t; in acquire_one_transport()
1004 } else if (type == kTransportLocal && t->type == kTransportLocal) { in acquire_one_transport()
1011 result = t; in acquire_one_transport()
1019 result = t; in acquire_one_transport()
1300 static void append_transport(const atransport* t, std::string* result, bool long_listing) { in append_transport() argument
1301 std::string serial = t->serial; in append_transport()
1309 *result += t->connection_state_name(); in append_transport()
1312 t->connection_state_name().c_str()); in append_transport()
1314 append_transport_info(result, "", t->devpath, false); in append_transport()
1315 append_transport_info(result, "product:", t->product, false); in append_transport()
1316 append_transport_info(result, "model:", t->model, true); in append_transport()
1317 append_transport_info(result, "device:", t->device, false); in append_transport()
1322 *result += std::to_string(t->id); in append_transport()
1339 for (const auto& t : sorted_transport_list) { in list_transports() local
1340 append_transport(t, &result, long_listing); in list_transports()
1347 for (auto& t : transport_list) { in close_usb_devices() local
1348 if (predicate(t)) { in close_usb_devices()
1350 t->Reset(); in close_usb_devices()
1352 t->Kick(); in close_usb_devices()
1366 atransport* t = new atransport(std::move(reconnect), kCsOffline); in register_socket_transport() local
1367 t->use_tls = use_tls; in register_socket_transport()
1370 if (init_socket_transport(t, std::move(s), port, local) < 0) { in register_socket_transport()
1371 delete t; in register_socket_transport()
1381 delete t; in register_socket_transport()
1391 delete t; in register_socket_transport()
1397 t->serial = std::move(serial); in register_socket_transport()
1398 pending_list.push_front(t); in register_socket_transport()
1402 auto waitable = t->connection_waitable(); in register_socket_transport()
1403 register_transport(t); in register_socket_transport()
1415 if (t->GetConnectionState() == kCsUnauthorized) { in register_socket_transport()
1428 for (auto& t : transport_list) { in find_transport() local
1429 if (strcmp(serial, t->serial.c_str()) == 0) { in find_transport()
1430 result = t; in find_transport()
1440 for (auto& t : transport_list) { in kick_all_tcp_devices() local
1441 if (t->IsTcpDevice()) { in kick_all_tcp_devices()
1446 t->Kick(); in kick_all_tcp_devices()
1459 atransport* t = new atransport(writeable ? kCsOffline : kCsNoPerm); in register_usb_transport() local
1461 D("transport: %p init'ing for usb_handle %p (sn='%s')", t, usb, serial ? serial : ""); in register_usb_transport()
1462 init_usb_transport(t, usb); in register_usb_transport()
1464 t->serial = serial; in register_usb_transport()
1468 t->devpath = devpath; in register_usb_transport()
1473 pending_list.push_front(t); in register_usb_transport()
1476 register_transport(t); in register_usb_transport()
1484 transport_list.remove_if([usb](atransport* t) { in unregister_usb_transport() argument
1485 return t->GetUsbHandle() == usb && t->GetConnectionState() == kCsNoPerm; in unregister_usb_transport()
1490 bool check_header(apacket* p, atransport* t) { in check_header() argument
1497 if (p->msg.data_length > t->get_max_payload()) { in check_header()
1499 << " atransport::max_payload = " << t->get_max_payload(); in check_header()