From ffe9ff5bf8dde6815f4eb6e3be390b62ac6b63d1 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Sat, 9 Nov 2024 11:00:29 -0500 Subject: [PATCH] squash w/ startup/shutdown. Remove setRsCommFromRodsEnv. --- server/core/include/irods/initServer.hpp | 1 - server/core/src/initServer.cpp | 19 ------------------- server/main_server/src/agent_main.cpp | 16 +++++++++++++--- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/server/core/include/irods/initServer.hpp b/server/core/include/irods/initServer.hpp index 90650a01e0..3ef49e28bc 100644 --- a/server/core/include/irods/initServer.hpp +++ b/server/core/include/irods/initServer.hpp @@ -16,7 +16,6 @@ int initHostConfigByFile(); int initRsComm(rsComm_t* rsComm); int initRsCommWithStartupPack(rsComm_t* rsComm, startupPack_t* startupPack, bool& require_cs_neg); int chkAllowedUser(const char* userName, const char* rodsZone); -int setRsCommFromRodsEnv(rsComm_t* rsComm); void close_all_l1_descriptors(RsComm& _comm); #endif // IRODS_INIT_SERVER_HPP diff --git a/server/core/src/initServer.cpp b/server/core/src/initServer.cpp index 32af929532..0badd54422 100644 --- a/server/core/src/initServer.cpp +++ b/server/core/src/initServer.cpp @@ -933,25 +933,6 @@ chkAllowedUser( const char *userName, const char *rodsZone ) { return 0; } -int -setRsCommFromRodsEnv( rsComm_t *rsComm ) { - try { - const auto& zone_name = irods::get_server_property(irods::KW_CFG_ZONE_NAME); - const auto& zone_user = irods::get_server_property(irods::KW_CFG_ZONE_USER); - - rstrcpy( rsComm->proxyUser.userName, zone_user.c_str(), NAME_LEN ); - rstrcpy( rsComm->clientUser.userName, zone_user.c_str(), NAME_LEN ); - - rstrcpy( rsComm->proxyUser.rodsZone, zone_name.c_str(), NAME_LEN ); - rstrcpy( rsComm->clientUser.rodsZone, zone_name.c_str(), NAME_LEN ); - } catch ( const irods::exception& e ) { - irods::log( irods::error(e) ); - return e.code(); - } - - return 0; -} - void close_all_l1_descriptors(RsComm& _comm) { log_agent::debug("[{}:{}] Closing all L1 descriptors ...", __func__, __LINE__); diff --git a/server/main_server/src/agent_main.cpp b/server/main_server/src/agent_main.cpp index 37dc3581e3..ac645fb0ea 100644 --- a/server/main_server/src/agent_main.cpp +++ b/server/main_server/src/agent_main.cpp @@ -262,7 +262,6 @@ auto main(int _argc, char* _argv[]) -> int // Initialize zone information for request processing. // initServerMain starts the listening socket and stores it in svrComm. - // TODO initServerMain can likely be simplified. RsComm svrComm{}; // RsComm contains a std::string, so never use memset() on this type! if (const auto ec = initServerMain(svrComm); ec < 0) { log_af::error("{}: initServerMain error. [error code={}]", __func__, ec); @@ -636,8 +635,19 @@ namespace return status; } - // TODO This function's name does not match its behavior. - setRsCommFromRodsEnv(&_comm); + try { + const auto zone_name = irods::get_server_property(irods::KW_CFG_ZONE_NAME); + const auto zone_user = irods::get_server_property(irods::KW_CFG_ZONE_USER); + + rstrcpy( _comm.proxyUser.userName, zone_user.c_str(), NAME_LEN ); + rstrcpy( _comm.clientUser.userName, zone_user.c_str(), NAME_LEN ); + rstrcpy( _comm.proxyUser.rodsZone, zone_name.c_str(), NAME_LEN ); + rstrcpy( _comm.clientUser.rodsZone, zone_name.c_str(), NAME_LEN ); + } + catch (const irods::exception& e) { + log_af::error("{}: Error initializing client and proxy user in RsComm from server configuration: {}", __func__, e.client_display_what()); + return e.code(); + } int zone_port; try {