Create develop mode that halts inbox processing on failed messagt but normally discards

master
teknomunk 11 months ago
parent d6819d07cd
commit cdf9d17697

@ -16,6 +16,8 @@ static struct json_object_field app_args_layout[] = {
JSON_FIELD_BOOL( debug, false ),
JSON_FIELD_BOOL( disable_tor, false ),
JSON_FIELD_INTEGER( tor_socks_port, false ),
JSON_FIELD_BOOL( develop, false ),
JSON_FIELD_END,
};
#undef OBJ_TYPE

@ -13,6 +13,8 @@ struct app_args
int section;
bool disable_tor;
int tor_socks_port;
bool develop;
};
struct app_args* app_args_new( int argc, char** argv );

@ -207,6 +207,7 @@ cleanup:
status_free(s);
return result;
failed:
if( !g_server->develop ) { goto discard; }
result = false;
goto cleanup;
}
@ -231,6 +232,7 @@ cleanup:
account_free(reactor);
return result;
failed:
if( !g_server->develop ) { goto discard; }
result = false;
goto cleanup;
}
@ -325,6 +327,7 @@ cleanup:
account_free(a);
return result;
failed:
if( !g_server->develop ) { goto discard; }
result = false;
goto cleanup;
}
@ -455,6 +458,7 @@ cleanup:
status_free(s);
return result;
failed:
if( !g_server->develop ) { goto discard; }
result = false;
goto cleanup;
}
@ -557,18 +561,21 @@ static bool process_one()
// Malformed body
printf( "Body: ->|%s|<-\n", env->body );
if( !env->body || !*env->body || ( 0 == strncmp("null",env->body,4) ) ) {
printf( "Malformed body, discarding\n" );
printf( "!!! Malformed body, discarding\n" );
goto discard;
}
// Load activity
printf( "Load activity...\n" );
FILE* f = fmemopen( env->body, strlen(env->body), "r" );
act = ap_object_from_FILE(f);
if( !act ) {
printf( "Failed to parse body: %s\n", env->body );
printf( "!!! Failed to parse body: %s\n", env->body );
goto failed;
}
fflush(stdout);
printf( "Handling forwarding\n" );
if( handle_forward( env, act ) ) { goto discard; }
// Sanitize actor
@ -591,7 +598,11 @@ static bool process_one()
if( !env->validated ) { goto discard; }
printf( "Processing %d\n", id );
step_tail = route_activity( act );
if( !route_activity( act ) ) {
goto failed;
} else {
goto discard;
}
cleanup:
printf( "\nstep_tail=%c\n", step_tail ? 'T' : 'F' );
@ -606,6 +617,7 @@ cleanup:
fflush(stdout);
return result;
failed:
if( !g_server->develop ) { goto discard; }
result = false;
goto cleanup;
discard:

Loading…
Cancel
Save