Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maestro-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maestro
maestro-core
Commits
f11c1ec8
Commit
f11c1ec8
authored
Apr 29, 2020
by
Utz-Uwe Haus
Browse files
Options
Downloads
Patches
Plain Diff
fix MIO transport recipient CDO raw-ptr allocation
parent
bf5c699a
No related branches found
No related tags found
No related merge requests found
Pipeline
#35618
failed
Apr 29, 2020
Stage: build-and-test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/check_transport_mio.c
+11
-6
11 additions, 6 deletions
tests/check_transport_mio.c
transport/mio.c
+16
-20
16 additions, 20 deletions
transport/mio.c
transport/transport.c
+20
-20
20 additions, 20 deletions
transport/transport.c
with
47 additions
and
46 deletions
tests/check_transport_mio.c
+
11
−
6
View file @
f11c1ec8
...
...
@@ -49,7 +49,7 @@
#include
<errno.h>
CHEAT_DECLARE
(
void
unsigned
char
transport_checksum
(
const
char
*
name
,
void
*
rawptr
,
uint64_t
size
)
{
unsigned
char
x
;
...
...
@@ -59,6 +59,7 @@ CHEAT_DECLARE (
x
^=
((
unsigned
char
*
)
rawptr
)[
i
];
fprintf
(
stderr
,
"Checksum for cdo
\"
%s
\"
:
\t
%d
\n
"
,
name
,
x
);
return
x
;
}
)
...
...
@@ -70,7 +71,7 @@ CHEAT_DECLARE (
for
(
size_t
i
=
0
;
i
<
data_count
;
i
++
)
{
src_data
[
i
]
=
random
();
}
transport_checksum
(
"pioneer departure"
,
src_data
,
data_count
);
unsigned
char
sender_checksum
=
transport_checksum
(
"pioneer departure"
,
src_data
,
data_count
);
cheat_assert
(
MSTRO_OK
==
mstro_init
(
"Tests"
,
"TRANSPORT"
,
0
));
char
name
[]
=
"transport_pioneer"
;
...
...
@@ -176,15 +177,17 @@ CHEAT_DECLARE (
cheat_assert
(
MSTRO_OK
==
mstro_transport_mio_src_execute
(
cdo_src
,
&
ticket
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_offer
(
cdo_src
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_require
(
cdo_dst
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_demand
(
cdo_dst
));
/* ticket is supposed to be sent to dst (4-step protocol), so here let
* us just pretend it was, and use ticket directly for dst transport
* execute, while it is being implemented */
cheat_assert
(
MSTRO_OK
==
mstro_cdo_declaration_seal
(
cdo_dst
));
cheat_assert
(
MSTRO_OK
==
mstro_transport_mio_dst_execute
(
cdo_dst
,
&
ticket
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_require
(
cdo_dst
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_demand
(
cdo_dst
));
double
*
data
;
size_t
len
;
enum
mstro_cdo_attr_value_type
type
;
...
...
@@ -195,7 +198,9 @@ CHEAT_DECLARE (
len
=
*
(
size_t
*
)
val
;
len
/=
sizeof
(
double
);
cheat_assert
(
len
>
0
&&
data
!=
NULL
);
transport_checksum
(
"pioneer arrival"
,
data
,
len
);
unsigned
char
receiver_checksum
=
transport_checksum
(
"pioneer arrival"
,
data
,
len
);
cheat_assert
(
sender_checksum
==
receiver_checksum
);
cheat_assert
(
MSTRO_OK
==
mstro_cdo_dispose
(
cdo_dst
));
cheat_assert
(
MSTRO_OK
==
mstro_cdo_withdraw
(
cdo_src
));
...
...
This diff is collapsed.
Click to expand it.
transport/mio.c
+
16
−
20
View file @
f11c1ec8
...
...
@@ -541,33 +541,29 @@ mstro_transport_mio_dst_execute(mstro_cdo dst,
int64_t
len
=
ticket
->
data_size
;
void
*
data
=
NULL
;
DEBUG
(
"receiving %zu bytes
\n
"
,
len
);
size_t
mio_len
=
mstro_mio_roundup_size
(
len
);
DEBUG
(
"rounded up len to %"
PRIi64
" bytes to accomodate MIO
\n
"
,
mio_len
);
mstro_status
s
;
if
(
!
(
MSTRO_OK
==
mstro_transport_get_dst_buffer
(
dst
,
len
,
&
data
)))
{
if
(
!
(
MSTRO_OK
==
mstro_transport_get_dst_buffer
(
dst
,
mio_
len
,
&
data
)))
{
/* Already printed an error */
return
MSTRO_FAIL
;
}
if
(
!
(
MSTRO_OK
==
mstro_attribute_dict_set
(
dst
->
attributes
,
MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE
,
MSTRO_CDO_ATTR_VALUE_INVALID
,
&
len
,
true
)))
{
ERR
(
"Failed to set %s attribute of CDO %s for transport
\n
"
,
/* fake local-size to the expected len */
s
=
mstro_attribute_dict_set
(
dst
->
attributes
,
MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE
,
dst
->
name
);
return
MSTRO_FAIL
;
}
if
(
!
(
MSTRO_OK
==
mstro_cdo_attribute_set
(
dst
,
MSTRO_ATTR_CORE_CDO_RAW_PTR
,
data
)))
{
ERR
(
"Failed to set raw-ptr attribute of CDO %s for transport
\n
"
,
dst
->
name
);
MSTRO_CDO_ATTR_VALUE_INVALID
,
&
len
,
true
);
if
(
s
!=
MSTRO_OK
)
{
ERR
(
"Failed to set local size to to non-padded size
\n
"
);
return
MSTRO_FAIL
;
}
// FIXME chh asserts in the right place the size does not make trouble
len
=
mstro_mio_roundup_size
(
len
);
DEBUG
(
"rounding up len to %"
PRIi64
" bytes to accomodate MIO
\n
"
,
len
);
// FIXME chh checks why this line is necessary not to make MIO panic
bzero
(
data
,
len
);
DEBUG
(
"buffer of %zu bytes ready
\n
"
,
len
);
//
bzero(data, len);
//
DEBUG("buffer of %zu bytes ready\n", len);
// struct mio_thread thread;
...
...
@@ -585,7 +581,7 @@ mstro_transport_mio_dst_execute(mstro_cdo dst,
INFO
(
"Sanity check object ID from ticket: %s
\n
"
,
idstr
););
if
(
!
(
MSTRO_OK
==
mstro_mio_obj_read_sync
((
struct
mio_obj_id
*
)
&
oid
,
data
,
len
,
(
struct
mio_obj_id
*
)
&
semid
)))
{
if
(
!
(
MSTRO_OK
==
mstro_mio_obj_read_sync
((
struct
mio_obj_id
*
)
&
oid
,
data
,
mio_
len
,
(
struct
mio_obj_id
*
)
&
semid
)))
{
/* Already printed an error */
return
MSTRO_FAIL
;
}
...
...
This diff is collapsed.
Click to expand it.
transport/transport.c
+
20
−
20
View file @
f11c1ec8
...
...
@@ -68,16 +68,17 @@ mstro_transport_get_dst_buffer(mstro_cdo dst, size_t len, void** data)
}
INFO
(
"CDO size: %zu
\n
"
,
len
);
*
data
=
malloc
(
sizeof
(
char
)
*
len
);
if
(
*
data
==
NULL
)
{
ERR
(
"
No memory left to allocate a dst buffer for
transport
\n
"
);
status
=
mstro_cdo_allocate_data
(
dst
,
len
);
if
(
status
!=
MSTRO_OK
)
{
ERR
(
"
Failed to allocate space in CDO at
transport
time
\n
"
);
return
MSTRO_FAIL
;
}
}
else
{
}
assert
(
dst
->
raw_ptr
!=
NULL
);
const
int64_t
*
available_size
;
enum
mstro_cdo_attr_value_type
type
;
status
=
mstro_cdo_attribute_get
(
dst
,
MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE
,
&
type
,
(
const
void
**
)
&
available_size
);
status
=
mstro_cdo_attribute_get
(
dst
,
MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE
,
&
type
,
(
const
void
**
)
&
available_size
);
if
(
status
!=
MSTRO_OK
)
{
ERR
(
"Failed to fetch size attribute
\n
"
);
return
MSTRO_FAIL
;
...
...
@@ -91,7 +92,6 @@ mstro_transport_get_dst_buffer(mstro_cdo dst, size_t len, void** data)
*
available_size
,
len
);
*
data
=
dst
->
raw_ptr
;
}
}
return
MSTRO_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment