mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 23:00:45 -04:00
Fix a Listener Bug (#45)
* try a fix * add debug prints * more prints * try again * more stderr * print again * am idiot * cleanup * cleanup
This commit is contained in:
@@ -16,10 +16,8 @@ std::string file_util::get_project_path() {
|
||||
#ifdef _WIN32
|
||||
char buffer[FILENAME_MAX];
|
||||
GetModuleFileNameA(NULL, buffer, FILENAME_MAX);
|
||||
printf("using path %s\n", buffer);
|
||||
std::string::size_type pos =
|
||||
std::string(buffer).rfind("jak-project"); // Strip file path down to \jak-project\ directory
|
||||
printf("rfind returned %lld\n", pos);
|
||||
return std::string(buffer).substr(
|
||||
0, pos + 11); // + 12 to include "\jak-project" in the returned filepath
|
||||
#else
|
||||
|
||||
@@ -242,7 +242,7 @@ void Deci2Server::run() {
|
||||
return;
|
||||
}
|
||||
got += x > 0 ? x : 0;
|
||||
hdr->rsvd += got;
|
||||
hdr->rsvd = got;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ void Listener::send_buffer(int sz) {
|
||||
int wrote = 0;
|
||||
|
||||
if (debug_listener) {
|
||||
printf("[L -> T] sending %d bytes...\n", sz);
|
||||
fprintf(stderr, "[L -> T] sending %d bytes...\n", sz);
|
||||
}
|
||||
|
||||
got_ack = false;
|
||||
@@ -349,7 +349,7 @@ void Listener::send_buffer(int sz) {
|
||||
while (wrote < sz) {
|
||||
auto to_send = std::min(512, sz - wrote);
|
||||
auto x = write_to_socket(listen_socket, m_buffer + wrote, to_send);
|
||||
wrote += x;
|
||||
wrote += x > 0 ? x : 0;
|
||||
}
|
||||
|
||||
if (debug_listener) {
|
||||
|
||||
Reference in New Issue
Block a user