Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
646859a5
Commit
646859a5
authored
Aug 11, 2020
by
legoc
Browse files
Added cerr to understand null sockets
parent
d5f50f31
Changes
2
Hide whitespace changes
Inline
Side-by-side
cameo-api-cpp/src/cameo/impl/RequestSocketImpl.cpp
View file @
646859a5
...
@@ -29,12 +29,16 @@ namespace cameo {
...
@@ -29,12 +29,16 @@ namespace cameo {
RequestSocketImpl
::
RequestSocketImpl
(
ServicesImpl
*
services
,
const
std
::
string
&
endpoint
,
int
timeout
)
:
RequestSocketImpl
::
RequestSocketImpl
(
ServicesImpl
*
services
,
const
std
::
string
&
endpoint
,
int
timeout
)
:
m_services
(
services
),
m_endpoint
(
endpoint
)
{
m_services
(
services
),
m_endpoint
(
endpoint
)
{
cerr
<<
this
<<
" new RequestSocketImpl"
<<
endl
;
init
();
init
();
setTimeout
(
timeout
);
setTimeout
(
timeout
);
}
}
RequestSocketImpl
::~
RequestSocketImpl
()
{
RequestSocketImpl
::~
RequestSocketImpl
()
{
cerr
<<
this
<<
" ~RequestSocketImpl"
<<
endl
;
}
}
void
RequestSocketImpl
::
setTimeout
(
int
timeout
)
{
void
RequestSocketImpl
::
setTimeout
(
int
timeout
)
{
...
@@ -62,6 +66,10 @@ void RequestSocketImpl::init() {
...
@@ -62,6 +66,10 @@ void RequestSocketImpl::init() {
if
(
m_socket
.
get
()
==
nullptr
)
{
if
(
m_socket
.
get
()
==
nullptr
)
{
m_socket
.
reset
(
m_services
->
createRequestSocket
(
m_endpoint
));
m_socket
.
reset
(
m_services
->
createRequestSocket
(
m_endpoint
));
if
(
m_socket
.
get
()
==
nullptr
)
{
cerr
<<
this
<<
" RequestSocketImpl::init null"
<<
endl
;
}
// Apply the linger to the socket.
// Apply the linger to the socket.
setSocketLinger
();
setSocketLinger
();
}
}
...
@@ -69,6 +77,8 @@ void RequestSocketImpl::init() {
...
@@ -69,6 +77,8 @@ void RequestSocketImpl::init() {
void
RequestSocketImpl
::
reset
()
{
void
RequestSocketImpl
::
reset
()
{
m_socket
.
reset
();
m_socket
.
reset
();
cerr
<<
this
<<
" RequestSocketImpl::reset"
<<
endl
;
}
}
std
::
unique_ptr
<
zmq
::
message_t
>
RequestSocketImpl
::
request
(
const
std
::
string
&
requestTypePart
,
const
std
::
string
&
requestDataPart
,
int
overrideTimeout
)
{
std
::
unique_ptr
<
zmq
::
message_t
>
RequestSocketImpl
::
request
(
const
std
::
string
&
requestTypePart
,
const
std
::
string
&
requestDataPart
,
int
overrideTimeout
)
{
...
...
cameo-api-cpp/src/cameo/impl/ServicesImpl.cpp
View file @
646859a5
...
@@ -255,13 +255,22 @@ zmq::socket_t * ServicesImpl::createRequestSocket(const std::string& endpoint) {
...
@@ -255,13 +255,22 @@ zmq::socket_t * ServicesImpl::createRequestSocket(const std::string& endpoint) {
zmq
::
socket_t
*
socket
=
new
zmq
::
socket_t
(
m_context
,
ZMQ_REQ
);
zmq
::
socket_t
*
socket
=
new
zmq
::
socket_t
(
m_context
,
ZMQ_REQ
);
if
(
socket
==
nullptr
)
{
cerr
<<
"createRequestSocket null"
<<
endl
;
}
try
{
try
{
// Connect to the endpoint.
// Connect to the endpoint.
socket
->
connect
(
endpoint
.
c_str
());
socket
->
connect
(
endpoint
.
c_str
());
}
}
catch
(
exception
const
&
e
)
{
catch
(
exception
const
&
e
)
{
cerr
<<
"createRequestSocket exception : "
<<
e
.
what
()
<<
endl
;
throw
SocketException
(
e
.
what
());
throw
SocketException
(
e
.
what
());
}
}
catch
(...)
{
cerr
<<
"createRequestSocket unexpected exception"
<<
endl
;
throw
;
}
return
socket
;
return
socket
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment