diff --git a/include/error.h b/include/error.h index 114d61e..c3f439e 100644 --- a/include/error.h +++ b/include/error.h @@ -153,6 +153,7 @@ typedef enum lm_error { LM_ERR_PoolInfoBadName = 151, LM_ERR_PoolInfoUnknown = 152, LM_ERR_MPTPBadPath = 153, + LM_ERR_UnknownThread = 154, } lm_error_t; typedef struct lm_error_desc { diff --git a/locale/tr/LC_MESSAGES/libmp.po b/locale/tr/LC_MESSAGES/libmp.po index 5fca97a..6a7d619 100644 --- a/locale/tr/LC_MESSAGES/libmp.po +++ b/locale/tr/LC_MESSAGES/libmp.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-16 00:21+0300\n" +"POT-Creation-Date: 2024-08-16 01:04+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/ctx/serve.c b/src/ctx/serve.c index 9eb94fc..b2ddf4b 100644 --- a/src/ctx/serve.c +++ b/src/ctx/serve.c @@ -29,15 +29,14 @@ void __lm_ctx_serve_thread(void *_arg) { lm_mptp_t packet; lm_mptp_init(&packet); - lm_error_clear(); if(!lm_mptp_server_recv(arg->sock, &packet)){ - pdebug(__func__, "%x: failed to receive packet (%s)", arg->addr, lm_strerror()); + pdebug(__func__, "%x: failed to receive packet", arg->addr); return lm_mptp_close(arg->sock); } if (!lm_mptp_server_verify(&packet)) { - pdebug(__func__, "%x: closing connection, failed to verify (%s)", arg->addr, lm_strerror()); + pdebug(__func__, "%x: closing connection, failed to verify", arg->addr); return lm_mptp_close(arg->sock); } @@ -45,12 +44,12 @@ void __lm_ctx_serve_thread(void *_arg) { char path[packet.header.path_size + 1], *ppath = path; if (!lm_mptp_get_host(&packet, hostname)) { - pdebug(__func__, "%x: closing connection, failed to get hostname (%s)", arg->addr, lm_strerror()); + pdebug(__func__, "%x: closing connection, failed to get hostname", arg->addr); goto end; } if (!lm_mptp_get_path(&packet, path)) { - pdebug(__func__, "%x: closing connection, failed to get path (%s)", arg->addr, lm_strerror()); + pdebug(__func__, "%x: closing connection, failed to get path", arg->addr); goto end; } @@ -120,7 +119,7 @@ void __lm_ctx_serve_thread(void *_arg) { if(!lm_mptp_get_path(&packet, path)){ // we should never be able to get here, if we do theres definetly a bug - pdebug(__func__, "PULL %s: skipping, failed to get path (%s)", pool->name, lm_strerror()); + pdebug(__func__, "PULL %s: skipping, failed to get path", pool->name); break; } diff --git a/src/error.c b/src/error.c index 103659b..26f4f1b 100644 --- a/src/error.c +++ b/src/error.c @@ -215,9 +215,13 @@ void lm_error_set(lm_error_t code, ...) { } char *lm_strerror() { + if (!pthread_equal(pthread_self(), lm_error_thread)) + return NULL; return lm_error_str; } lm_error_t lm_error() { + if (!pthread_equal(pthread_self(), lm_error_thread)) + return LM_ERR_UnknownThread; return lm_error_code; }