Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
margo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
sds
margo
Commits
44385919
Commit
44385919
authored
Mar 07, 2017
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fill in example calling multiple mplex'd services
parent
a5ebf0d5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
1 deletion
+63
-1
examples/multiplex/Makefile.subdir
examples/multiplex/Makefile.subdir
+2
-1
examples/multiplex/margo-example-mp-client.c
examples/multiplex/margo-example-mp-client.c
+7
-0
examples/multiplex/svc1-client.c
examples/multiplex/svc1-client.c
+48
-0
examples/multiplex/svc1-client.h
examples/multiplex/svc1-client.h
+1
-0
examples/multiplex/svc2-client.h
examples/multiplex/svc2-client.h
+5
-0
No files found.
examples/multiplex/Makefile.subdir
View file @
44385919
...
...
@@ -7,4 +7,5 @@ examples_multiplex_margo_example_mp_server_SOURCES = \
examples_multiplex_margo_example_mp_client_SOURCES
=
\
examples/multiplex/margo-example-mp-client.c
\
examples/multiplex/svc1-client.c
examples/multiplex/svc1-client.c
\
examples/multiplex/svc2-client.c
examples/multiplex/margo-example-mp-client.c
View file @
44385919
...
...
@@ -12,6 +12,7 @@
#include <margo.h>
#include "svc1-client.h"
#include "svc2-client.h"
static
hg_id_t
my_rpc_shutdown_id
;
...
...
@@ -80,12 +81,18 @@ int main(int argc, char **argv)
NULL
);
/* register service APIs */
svc1_register_client
(
mid
);
svc2_register_client
(
mid
);
/* find addr for server */
ret
=
margo_addr_lookup
(
mid
,
argv
[
1
],
&
svr_addr
);
assert
(
ret
==
0
);
svc1_do_thing
(
mid
,
svr_addr
,
1
);
svc1_do_other_thing
(
mid
,
svr_addr
,
1
);
svc1_do_thing
(
mid
,
svr_addr
,
2
);
svc1_do_other_thing
(
mid
,
svr_addr
,
2
);
svc2_do_thing
(
mid
,
svr_addr
,
3
);
svc2_do_other_thing
(
mid
,
svr_addr
,
3
);
/* send one rpc to server to shut it down */
/* create handle */
...
...
examples/multiplex/svc1-client.c
View file @
44385919
...
...
@@ -78,3 +78,51 @@ void svc1_do_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mplex_id)
return
;
}
void
svc1_do_other_thing
(
margo_instance_id
mid
,
hg_addr_t
svr_addr
,
uint32_t
mplex_id
)
{
hg_handle_t
handle
;
svc1_do_other_thing_in_t
in
;
svc1_do_other_thing_out_t
out
;
int
ret
;
hg_size_t
size
;
void
*
buffer
;
struct
hg_info
*
hgi
;
/* allocate buffer for bulk transfer */
size
=
512
;
buffer
=
calloc
(
1
,
512
);
assert
(
buffer
);
sprintf
((
char
*
)
buffer
,
"Hello world!
\n
"
);
/* create handle */
ret
=
HG_Create
(
margo_get_context
(
mid
),
svr_addr
,
svc1_do_other_thing_id
,
&
handle
);
assert
(
ret
==
0
);
/* register buffer for rdma/bulk access by server */
hgi
=
HG_Get_info
(
handle
);
assert
(
hgi
);
ret
=
HG_Bulk_create
(
hgi
->
hg_class
,
1
,
&
buffer
,
&
size
,
HG_BULK_READ_ONLY
,
&
in
.
bulk_handle
);
assert
(
ret
==
0
);
hgi
->
mplex_id
=
mplex_id
;
/* Send rpc. Note that we are also transmitting the bulk handle in the
* input struct. It was set above.
*/
in
.
input_val
=
0
;
margo_forward
(
mid
,
handle
,
&
in
);
/* decode response */
ret
=
HG_Get_output
(
handle
,
&
out
);
assert
(
ret
==
0
);
/* clean up resources consumed by this rpc */
HG_Bulk_free
(
in
.
bulk_handle
);
HG_Free_output
(
handle
,
&
out
);
HG_Destroy
(
handle
);
free
(
buffer
);
return
;
}
examples/multiplex/svc1-client.h
View file @
44385919
...
...
@@ -12,5 +12,6 @@
int
svc1_register_client
(
margo_instance_id
mid
);
void
svc1_do_thing
(
margo_instance_id
mid
,
hg_addr_t
svr_addr
,
uint32_t
mplex_id
);
void
svc1_do_other_thing
(
margo_instance_id
mid
,
hg_addr_t
svr_addr
,
uint32_t
mplex_id
);
#endif
/* __SVC1_CLIENT */
examples/multiplex/svc2-client.h
View file @
44385919
...
...
@@ -9,4 +9,9 @@
#include <margo.h>
int
svc2_register_client
(
margo_instance_id
mid
);
void
svc2_do_thing
(
margo_instance_id
mid
,
hg_addr_t
svr_addr
,
uint32_t
mplex_id
);
void
svc2_do_other_thing
(
margo_instance_id
mid
,
hg_addr_t
svr_addr
,
uint32_t
mplex_id
);
#endif
/* __SVC2_CLIENT */
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