From ca7e0fb827f216d0d554e7477a5c61b5d827407c Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 2 Mar 2023 10:11:11 -0400 Subject: TTcpSocket: Match `test_connection()` `TTcpSocket` is now fully matched. Up next is `TProtocol`. --- src/pso/TTcpSocket.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/pso/TTcpSocket.cpp b/src/pso/TTcpSocket.cpp index e319b0e..7244ad6 100644 --- a/src/pso/TTcpSocket.cpp +++ b/src/pso/TTcpSocket.cpp @@ -179,7 +179,34 @@ short TTcpSocket::send(u8 *data) { } int TTcpSocket::test_connection() { + for (int i = 0; i < 1800; ++i) { + if (int status = stat()) { + log(get_sock_status_name(status)); + set_flags(1); + return 1; + } else if (send_window() <= 128) { + set_flags(1); + return 1; + } else if (stat_val() < 0) { + set_flags(1); + return 1; + } else if (!get_link_status()) { + set_flags(1); + return 1; + } else if (send_window() > 4095) { + return 0; + } else { + main_task.some_empty_func(); + main_task.run_tl_camera_tasks(); + main_task.render(); + main_task.render_screen_overlay(); + func_80019aa0(); + render_tick(); + } + } + set_flags(1); + return 1; } void TTcpSocket::some_stub() {} -- cgit v1.2.3-13-gbd6f