diff --git a/nmux.cpp b/nmux.cpp index 654d068..7d75012 100644 --- a/nmux.cpp +++ b/nmux.cpp @@ -192,7 +192,7 @@ int main(int argc, char* argv[]) if(NMUX_DEBUG) { fprintf(stderr, "\x1b[1m\x1b[33mmainfor: clients before closing: "); - for(int i=0;istatus = CS_THREAD_RUNNING; int retval; tsmpool* lpool = this_client->lpool; - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: socket = %d!\n", (unsigned)param, this_client->socket); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: socket = %d!\n", (intptr_t)param, this_client->socket); - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: poll init...", (unsigned)param); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: poll init...", (intptr_t)param); struct pollfd pollfds[1]; pollfds[0].fd = this_client->socket; pollfds[0].events = POLLOUT; @@ -307,10 +307,10 @@ void* client_thread (void* param) // (Wait for the server process to wake me up.) while(!pool_read_buffer || client_buffer_index >= lpool->size) { - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: trying to grb\n", (unsigned)param); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: trying to grb\n", (intptr_t)param); pool_read_buffer = (char*)lpool->get_read_buffer(this_client->tsmthread); if(pool_read_buffer) { client_buffer_index = 0; break; } - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: cond_waiting for more data\n", (unsigned)param); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: cond_waiting for more data\n", (intptr_t)param); pthread_mutex_lock(&wait_mutex); this_client->sleeping = 1; pthread_cond_wait(&wait_condition, &wait_mutex); @@ -318,14 +318,14 @@ void* client_thread (void* param) } //Wait for the socket to be available for write. - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: polling for socket write...", (unsigned)param); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: polling for socket write...", (intptr_t)param); int ret = poll(pollfds, 1, -1); if(NMUX_DEBUG) fprintf(stderr, "client polled for socket write.\n"); if(ret == 0) continue; else if (ret == -1) { client_goto_source = 1; goto client_thread_exit; } //Read data from global tsmpool and write it to client socket - if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: sending...", (unsigned)param); + if(NMUX_DEBUG) fprintf(stderr, "client 0x%x: sending...", (intptr_t)param); ret = send(this_client->socket, pool_read_buffer + client_buffer_index, lpool->size - client_buffer_index, MSG_NOSIGNAL); if(NMUX_DEBUG) fprintf(stderr, "client sent.\n"); if(ret == -1) @@ -340,7 +340,7 @@ void* client_thread (void* param) } client_thread_exit: - fprintf(stderr, "client 0x%x: CS_THREAD_FINISHED, client_goto_source = %d, errno = %d", (unsigned)param, client_goto_source, errno); + fprintf(stderr, "client 0x%x: CS_THREAD_FINISHED, client_goto_source = %d, errno = %d", (intptr_t)param, client_goto_source, errno); this_client->status = CS_THREAD_FINISHED; pthread_exit(NULL); return NULL;