Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Truncate long system names, rather than failing to connect #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class SAS
const char *fmt,
...);

static int init(const std::string& system_name,
static int init(std::string system_name,
const std::string& system_type,
const std::string& resource_identifier,
const std::string& sas_address,
Expand Down
18 changes: 9 additions & 9 deletions source/sas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ class SAS::Connection
static const int MAX_MSG_QUEUE = 1000;
};

int SAS::init(const std::string& system_name,
const std::string& system_type,
const std::string& resource_identifier,
const std::string& sas_address,
sas_log_callback_t* log_callback,
create_socket_callback_t* socket_callback)
int SAS::init(std::string system_name,
const std::string& system_type,
const std::string& resource_identifier,
const std::string& sas_address,
sas_log_callback_t* log_callback,
create_socket_callback_t* socket_callback)
{
_log_callback = log_callback;
_socket_callback = socket_callback;
Expand All @@ -122,9 +122,9 @@ int SAS::init(const std::string& system_name,

if (system_name.length() > MAX_SYSTEM_LEN)
{
SAS_LOG_ERROR("Error connecting to SAS - System name is longer than %d characters.",
MAX_SYSTEM_LEN);
return SAS_INIT_RC_ERR;
SAS_LOG_WARNING("System name is longer than %d characters, truncating.",
MAX_SYSTEM_LEN);
system_name.resize(MAX_SYSTEM_LEN);
}

if (system_type.length() <= 0)
Expand Down