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:
water111
2020-09-14 22:14:07 -04:00
committed by GitHub
parent 8972d37167
commit bb854dd81e
3 changed files with 3 additions and 5 deletions
-2
View File
@@ -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
+1 -1
View File
@@ -242,7 +242,7 @@ void Deci2Server::run() {
return;
}
got += x > 0 ? x : 0;
hdr->rsvd += got;
hdr->rsvd = got;
}
}
+2 -2
View File
@@ -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) {