fix: remove error calls from threads
This commit is contained in:
parent
6dc139ca8c
commit
7564835b7d
@ -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 {
|
||||
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user