]> infiniteadaptability.org Git - seeder/commitdiff
...
authoralex <[email protected]>
Sat, 30 Apr 2022 19:50:28 +0000 (12:50 -0700)
committeralex <[email protected]>
Sat, 30 Apr 2022 19:50:28 +0000 (12:50 -0700)
src/log.c
src/session.c
src/watch.c

index 7ce190a045eb87c8f92f413655806b410bcb2da7..5261d8e9f194b3457baf6484dcbdd06528c4e277 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -43,6 +43,7 @@ static void log_enqueue(struct log_entry *p) {
 }
 
 static void log_entries_clean(void *p) {
+       printf("log_entries_clean\n");
        free(helper.p);
 }
 
@@ -61,21 +62,26 @@ static int log_entries_init() {
 }
 
 static void log_flush(void *p) {
+       printf("log_flush\n");
        pthread_mutex_lock(&logging_mutex);
 
+       printf("log_flush2\n");
        if(helper.start!=NULL) {        
                fputs(LOG_MESSAGE_FLUSH,stderr);
        }
 
+       printf("log_flush3\n");
        while(helper.start!=NULL) {
                log_print(helper.start);
        }
        
+       printf("log_flush4\n");
        helper.start = NULL;
        helper.end = NULL;
        helper.next = 0;
 
        pthread_mutex_unlock(&logging_mutex);
+       printf("log_flush5\n");
 }
 
 void log_print() {
@@ -153,8 +159,10 @@ void *log_poll(void *p) {
                pthread_testcancel();
                
                pthread_mutex_lock(&logging_mutex);
+               printf("logging mutex lock\n");
                log_print();
                pthread_mutex_unlock(&logging_mutex);
+               printf("logging mutex unlock\n");
        }
 
        pthread_cleanup_pop(1);
@@ -167,14 +175,14 @@ static void log_shutdown() {
        int ret_cancel, ret_join;
        void *res;
 
-       log_info("shutting down logging thread\n");
+       printf("shutting down logging thread\n");
                
        ret_cancel = pthread_cancel(logging_thread);
        ret_join = pthread_join(logging_thread,&res);
        
-       log_info("shutting down logging thread 2\n");
-
        logging_thread = pthread_self();
+       printf("shutting down logging thread 2\n");
+
        if((ret_cancel!=0)||(ret_join!=0)||(res!=PTHREAD_CANCELED)) {
                log_err(LOG_MESSAGE_SHUTDOWN_FAILED);
        } else {
index 9565c54d5ffb844d7e0ba40369381d2e28388748..0aeabe8d57a1077854daf33347ff61d108f927d9 100644 (file)
@@ -10,7 +10,7 @@ static int session_torrent_resize(struct hash_map**,size_t);
 static void session_clean() {
        struct torrent *p;
 
-       log_info("clearing session\n");
+       printf("clearing session\n");
 
        for(size_t i=0;i<session.torrents.paths->size;i++) {
                p = session.torrents.paths->map[i];
@@ -23,7 +23,7 @@ static void session_clean() {
        hashmap_clear(session.torrents.paths);
        hashmap_free(session.torrents.paths);
        
-       log_info("session cleared\n");
+       printf("session cleared\n");
 }
 
 struct torrent *session_find_torrent(uint8_t *infohash, size_t size) {
@@ -47,7 +47,7 @@ int session_setup() {
                return -1;
        }
 
-       log_info("session setup\n");
+       printf("session setup\n");
 
        return 1;
 }
index 71e0027bc190655ad4c5fd93d22a66b854fec32c..34e37c791ae8d3814dd83b1271871188ebb94f3b 100644 (file)
@@ -101,10 +101,10 @@ static void watch_poll() {
 }
 
 static void watch_shutdown() {
-       log_info("watch thread stopping\n");
+       printf("watch thread stopping\n");
        if(0!=pthread_cancel(watching_thread)) {
                log_err(WATCH_MESSAGE_SHUTDOWN_FAILED);
        }
        close(watch_fd);
-       log_info("watch thread stopped\n");
+       printf("watch thread stopped\n");
 }