Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fredix
ncs
Commits
c1157524
Commit
c1157524
authored
Apr 12, 2013
by
fred
Browse files
zerogw payload api refactoring
parent
093d17a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
service.cpp
View file @
c1157524
...
...
@@ -21,7 +21,7 @@
#include "service.h"
ZerogwProxy
::
ZerogwProxy
(
params
a_ncs_params
,
QStr
in
g
port
,
QObject
*
parent
)
:
m_ncs_params
(
a_ncs_params
),
m_port
(
port
),
QObject
(
parent
)
ZerogwProxy
::
ZerogwProxy
(
params
a_ncs_params
,
in
t
port
,
QObject
*
parent
)
:
m_ncs_params
(
a_ncs_params
),
m_port
(
port
),
QObject
(
parent
)
{
thread
=
new
QThread
;
...
...
@@ -38,8 +38,7 @@ ZerogwProxy::~ZerogwProxy()
{
qDebug
()
<<
"!!!!!!! ZerogwProxy::CLOSE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
;
delete
(
api_payload
);
delete
(
api_payload2
);
//delete(api_payload);
zerogw
->
close
();
worker_payload
->
close
();
}
...
...
@@ -49,17 +48,20 @@ void ZerogwProxy::init()
qDebug
()
<<
"ZerogwProxy::init"
;
zerogw
=
new
zmq
::
socket_t
(
*
zeromq_
->
m_context
,
ZMQ_ROUTER
);
QString
zgw_uri
=
"tcp://*:"
+
m_port
;
//zerogw->bind ("tcp://*:2503");
QString
zgw_uri
=
"tcp://*:"
+
QString
::
number
(
m_port
);
zerogw
->
bind
(
zgw_uri
.
toLatin1
());
worker_payload
=
new
zmq
::
socket_t
(
*
zeromq_
->
m_context
,
ZMQ_DEALER
);
//QString uri = "ipc://" + m_ncs_params.base_directory + "/payloads";
QString
uri
=
"ipc://"
+
m_ncs_params
.
base_directory
+
"/payloads"
;
worker_payload
->
bind
(
uri
.
toLatin1
());
api_payload
=
new
Api_payload
(
m_ncs_params
.
base_directory
,
0
);
api_payload2
=
new
Api_payload
(
m_ncs_params
.
base_directory
,
1
);
//api_payload = new Api_payload(Api_payload, 0);
//api_payload2 = new Api_payload(m_ncs_params.base_directory, 1);
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
api_payload_thread
[
i
]
=
QSharedPointer
<
Api_payload
>
(
new
Api_payload
(
m_ncs_params
.
base_directory
,
0
));
}
qDebug
()
<<
"ZerogwProxy::init BEFORE PROXY"
;
zmq
::
proxy
(
*
zerogw
,
*
worker_payload
,
NULL
);
...
...
@@ -76,8 +78,6 @@ Service::Service(params a_ncs_params, QObject *parent) : m_ncs_params(a_ncs_para
m_xmpp_server
=
NULL
;
m_xmpp_client
=
NULL
;
zerogwToPayload
=
NULL
;
zerogwToPayload2
=
NULL
;
}
Service
::~
Service
()
...
...
@@ -106,7 +106,6 @@ Service::~Service()
delete
(
worker_api
);
//delete(api_payload);
if
(
zerogwToPayload
)
delete
(
zerogwToPayload
);
if
(
zerogwToPayload2
)
delete
(
zerogwToPayload2
);
delete
(
api_node
);
delete
(
api_workflow
);
...
...
@@ -138,8 +137,7 @@ void Service::Http_api_init()
m_ncs_params
.
api_port
==
0
?
port
=
2502
:
port
=
m_ncs_params
.
api_port
;
zerogwToPayload
=
new
ZerogwProxy
(
m_ncs_params
,
"2403"
);
zerogwToPayload2
=
new
ZerogwProxy
(
m_ncs_params
,
"2404"
);
zerogwToPayload
=
new
ZerogwProxy
(
m_ncs_params
,
port
);
/*
...
...
service.h
View file @
c1157524
...
...
@@ -37,24 +37,29 @@
#include "ncs_global.h"
#include "zerogw.h"
typedef
QSharedPointer
<
Api_payload
>
Api_payload_pushPtr
;
class
ZerogwProxy
:
public
QObject
{
Q_OBJECT
public:
ZerogwProxy
(
params
a_ncs_params
,
QStr
in
g
port
,
QObject
*
parent
=
0
);
ZerogwProxy
(
params
a_ncs_params
,
in
t
port
,
QObject
*
parent
=
0
);
~
ZerogwProxy
();
private
slots
:
void
init
();
private:
QStr
in
g
m_port
;
in
t
m_port
;
QThread
*
thread
;
Zeromq
*
zeromq_
;
zmq
::
socket_t
*
zerogw
;
zmq
::
socket_t
*
worker_payload
;
Api_payload
*
api_payload
;
Api_payload
*
api_payload2
;
QHash
<
int
,
Api_payload_pushPtr
>
api_payload_thread
;
// Api_payload *api_payload;
// Api_payload *api_payload2;
params
m_ncs_params
;
};
...
...
@@ -75,7 +80,6 @@ public:
void
link
();
Worker_api
*
worker_api
;
ZerogwProxy
*
zerogwToPayload
;
ZerogwProxy
*
zerogwToPayload2
;
Api_node
*
api_node
;
Api_workflow
*
api_workflow
;
...
...
zerogw.cpp
View file @
c1157524
...
...
@@ -59,7 +59,7 @@ void Zerogw::init()
// socket from ZEROGW
m_message
=
new
zmq
::
message_t
(
2
);
m_socket_zerogw
=
new
zmq
::
socket_t
(
*
m_context
,
ZMQ_REP
);
int
hwm
=
5000
0
;
int
hwm
=
0
;
m_socket_zerogw
->
setsockopt
(
ZMQ_SNDHWM
,
&
hwm
,
sizeof
(
hwm
));
m_socket_zerogw
->
setsockopt
(
ZMQ_RCVHWM
,
&
hwm
,
sizeof
(
hwm
));
...
...
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