@@ -289,18 +289,19 @@ namespace HttpServer
289289 {
290290 if (app->application_final )
291291 {
292- app->application_final ();
292+ const std::string root = app->root_dir ;
293+ app->application_final (root.data () );
293294 }
294295 }
295296 catch (std::exception &exc)
296297 {
297- std::cout << " Warning: error when the application finishes '" << app->server_module << " ': " << exc.what () << std::endl;
298+ std::cout << " Warning: an exception was thrown when the application '" << app->server_module << " ' was finishes: " << exc.what () << std::endl;
298299 }
299300
300301 app->application_call = std::function<int (Transfer::app_request *, Transfer::app_response *)>();
301302 app->application_clear = std::function<void (void *, size_t )>();
302- app->application_init = std::function<bool ()>();
303- app->application_final = std::function<void ()>();
303+ app->application_init = std::function<bool (const char * )>();
304+ app->application_final = std::function<void (const char * )>();
304305 }
305306 }
306307
@@ -423,18 +424,18 @@ namespace HttpServer
423424
424425 std::function<void (void *, size_t )> app_clear = reinterpret_cast <void (*)(void *, size_t )>(addr);
425426
426- std::function<bool ()> app_init = std::function<bool ()>();
427+ std::function<bool (const char * )> app_init = std::function<bool (const char * )>();
427428
428429 if (module .find (" application_init" , &addr) )
429430 {
430- app_init = reinterpret_cast <bool (*)()>(addr);
431+ app_init = reinterpret_cast <bool (*)(const char * )>(addr);
431432 }
432433
433- std::function<void ()> app_final = std::function<void ()>();
434+ std::function<void (const char * )> app_final = std::function<void (const char * )>();
434435
435436 if (module .find (" application_final" , &addr) )
436437 {
437- app_final = reinterpret_cast <void (*)()>(addr);
438+ app_final = reinterpret_cast <void (*)(const char * )>(addr);
438439 }
439440
440441 for (auto &app : same)
@@ -448,12 +449,13 @@ namespace HttpServer
448449 {
449450 if (app->application_init )
450451 {
451- app->application_init ();
452+ const std::string root = app->root_dir ;
453+ app->application_init (root.data () );
452454 }
453455 }
454456 catch (std::exception &exc)
455457 {
456- std::cout << " Warning: error when initializing the application '" << module_name << " ': " << exc.what () << std::endl;
458+ std::cout << " Warning: an exception was thrown when the application '" << module_name << " ' was initialized: " << exc.what () << std::endl;
457459 }
458460 }
459461
@@ -502,7 +504,7 @@ namespace HttpServer
502504 }
503505 }
504506
505- std::cout << " Notice: applications' modules have been updated;" << std::endl;
507+ std::cout << " Notice: application modules have been updated;" << std::endl;
506508
507509 this ->controls .setProcess ();
508510 this ->controls .eventUpdateModule ->reset ();
@@ -780,7 +782,7 @@ namespace HttpServer
780782 sockets_list.addSocket (sock);
781783 }
782784
783- std::cout << " Log: launch server's cycle ;" << std::endl << std::endl;
785+ std::cout << " Log: server started work ;" << std::endl << std::endl;
784786
785787 constexpr size_t queue_max_length = 1024 ;
786788 this ->controls .eventNotFullQueue = new Utils::Event (true , true );
@@ -855,7 +857,7 @@ namespace HttpServer
855857
856858 this ->clear ();
857859
858- std::cout << " Log: complete server's cycle ;" << std::endl;
860+ std::cout << " Log: server work completed ;" << std::endl;
859861
860862 return EXIT_SUCCESS;
861863 }
0 commit comments