diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-02 10:11:11 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-02 10:11:11 -0400 |
commit | ca7e0fb827f216d0d554e7477a5c61b5d827407c (patch) | |
tree | 8a869f3b1df7c80aa270033498e575aa52c82fff /src | |
parent | 0d82cc507e0c49e2871f18a7f574b3071b51f4a1 (diff) |
TTcpSocket: Match `test_connection()`
`TTcpSocket` is now fully matched. Up next is `TProtocol`.
Diffstat (limited to 'src')
-rw-r--r-- | src/pso/TTcpSocket.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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() {} |