Skip to content

Commit 2c259a9

Browse files
capicxx-core-runtime 3.1.12.3
1 parent 45a3dea commit 2c259a9

File tree

3 files changed

+58
-52
lines changed

3 files changed

+58
-52
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Changes
22
=======
3+
v3.1.12.3
4+
- Added copy constructor for CommonAPI CallInfo
5+
36
v3.1.12.2
47
- Defer Runtime destruction till shared object is unloaded
58

include/CommonAPI/CallInfo.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ struct COMMONAPI_EXPORT CallInfo {
2121
CallInfo(Timeout_t _timeout, Sender_t _sender)
2222
: timeout_(_timeout), sender_(_sender) {
2323
}
24+
CallInfo(const CallInfo &_other)
25+
: timeout_(_other.timeout_), sender_(_other.sender_) {
26+
}
2427

2528
Timeout_t timeout_;
2629
Sender_t sender_;

src/CommonAPI/Runtime.cpp

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ std::shared_ptr<Runtime> Runtime::get() {
7272
Runtime::Runtime()
7373
: defaultBinding_(COMMONAPI_DEFAULT_BINDING),
7474
defaultFolder_(COMMONAPI_DEFAULT_FOLDER),
75-
isConfigured_(false),
76-
isInitialized_(false) {
75+
isConfigured_(false),
76+
isInitialized_(false) {
7777
}
7878

7979
Runtime::~Runtime() {
@@ -98,7 +98,7 @@ Runtime::registerFactory(const std::string &_binding, std::shared_ptr<Factory> _
9898
}
9999

100100
if (isRegistered && isInitialized_)
101-
_factory->init();
101+
_factory->init();
102102

103103
return isRegistered;
104104
}
@@ -152,20 +152,20 @@ void Runtime::init() {
152152

153153
void
154154
Runtime::initFactories() {
155-
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
156-
if (!isInitialized_) {
157-
COMMONAPI_INFO("Loading configuration file \'", usedConfig_, "\'");
158-
COMMONAPI_INFO("Using default binding \'", defaultBinding_, "\'");
159-
COMMONAPI_INFO("Using default shared library folder \'", defaultFolder_, "\'");
155+
std::lock_guard<std::mutex> itsLock(factoriesMutex_);
156+
if (!isInitialized_) {
157+
COMMONAPI_INFO("Loading configuration file \'", usedConfig_, "\'");
158+
COMMONAPI_INFO("Using default binding \'", defaultBinding_, "\'");
159+
COMMONAPI_INFO("Using default shared library folder \'", defaultFolder_, "\'");
160160

161-
if (defaultFactory_)
162-
defaultFactory_->init();
161+
if (defaultFactory_)
162+
defaultFactory_->init();
163163

164-
for (auto f : factories_)
165-
f.second->init();
164+
for (auto f : factories_)
165+
f.second->init();
166166

167-
isInitialized_ = true;
168-
}
167+
isInitialized_ = true;
168+
}
169169
}
170170

171171
bool
@@ -179,13 +179,13 @@ Runtime::readConfiguration() {
179179
#else
180180
if (getcwd(currentDirectory, MAX_PATH_LEN)) {
181181
#endif
182-
usedConfig_ = currentDirectory;
183-
usedConfig_ += "/";
184-
usedConfig_ += COMMONAPI_DEFAULT_CONFIG_FILE;
182+
usedConfig_ = currentDirectory;
183+
usedConfig_ += "/";
184+
usedConfig_ += COMMONAPI_DEFAULT_CONFIG_FILE;
185185

186186
struct stat s;
187187
if (stat(usedConfig_.c_str(), &s) != 0) {
188-
usedConfig_ = defaultConfig_;
188+
usedConfig_ = defaultConfig_;
189189
if (stat(usedConfig_.c_str(), &s) != 0) {
190190
tryLoadConfig = false;
191191
}
@@ -249,9 +249,9 @@ std::shared_ptr<Proxy>
249249
Runtime::createProxy(
250250
const std::string &_domain, const std::string &_interface, const std::string &_instance,
251251
const ConnectionId_t &_connectionId) {
252-
if (!isInitialized_) {
253-
initFactories();
254-
}
252+
if (!isInitialized_) {
253+
initFactories();
254+
}
255255

256256
// Check whether we already know how to create such proxies...
257257
std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _connectionId, false);
@@ -270,9 +270,9 @@ std::shared_ptr<Proxy>
270270
Runtime::createProxy(
271271
const std::string &_domain, const std::string &_interface, const std::string &_instance,
272272
std::shared_ptr<MainLoopContext> _context) {
273-
if (!isInitialized_) {
274-
initFactories();
275-
}
273+
if (!isInitialized_) {
274+
initFactories();
275+
}
276276

277277
// Check whether we already know how to create such proxies...
278278
std::shared_ptr<Proxy> proxy = createProxyHelper(_domain, _interface, _instance, _context, false);
@@ -291,9 +291,9 @@ Runtime::createProxy(
291291
bool
292292
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
293293
std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
294-
if (!isInitialized_) {
295-
initFactories();
296-
}
294+
if (!isInitialized_) {
295+
initFactories();
296+
}
297297

298298
bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _connectionId, false);
299299
if (!isRegistered) {
@@ -309,9 +309,9 @@ Runtime::registerStub(const std::string &_domain, const std::string &_interface,
309309
bool
310310
Runtime::registerStub(const std::string &_domain, const std::string &_interface, const std::string &_instance,
311311
std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
312-
if (!isInitialized_) {
313-
initFactories();
314-
}
312+
if (!isInitialized_) {
313+
initFactories();
314+
}
315315

316316
bool isRegistered = registerStubHelper(_domain, _interface, _instance, _stub, _context, false);
317317
if (!isRegistered) {
@@ -382,28 +382,28 @@ Runtime::loadLibrary(const std::string &_library) {
382382
}
383383
#else
384384
std::size_t soStart = itsLibrary.rfind(".so");
385-
if (soStart == std::string::npos) {
386-
// Library name does not contain ".so" --> add it
387-
itsLibrary += ".so";
388-
} else if (soStart < itsLibrary.length() - 3) {
389-
// We found ".so" but even the last one is not the end
390-
// of the filename
391-
soStart += 3;
392-
393-
// Check the version information
394-
while (soStart < itsLibrary.length()) {
395-
if (itsLibrary[soStart] != '.'
396-
&& !std::isdigit(static_cast<unsigned char>(itsLibrary[soStart]))) {
397-
break;
398-
}
399-
soStart++;
400-
}
401-
402-
// What should be a version is something else
403-
// --> add another ".so"
404-
if (soStart < itsLibrary.length())
405-
itsLibrary += ".so";
406-
}
385+
if (soStart == std::string::npos) {
386+
// Library name does not contain ".so" --> add it
387+
itsLibrary += ".so";
388+
} else if (soStart < itsLibrary.length() - 3) {
389+
// We found ".so" but even the last one is not the end
390+
// of the filename
391+
soStart += 3;
392+
393+
// Check the version information
394+
while (soStart < itsLibrary.length()) {
395+
if (itsLibrary[soStart] != '.'
396+
&& !std::isdigit(static_cast<unsigned char>(itsLibrary[soStart]))) {
397+
break;
398+
}
399+
soStart++;
400+
}
401+
402+
// What should be a version is something else
403+
// --> add another ".so"
404+
if (soStart < itsLibrary.length())
405+
itsLibrary += ".so";
406+
}
407407
#endif
408408

409409
bool isLoaded(true);

0 commit comments

Comments
 (0)