Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
remi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
remi
Commits
eaf5e6be
Commit
eaf5e6be
authored
Oct 22, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the correct protection mechanism
parent
b6aa3898
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
src/remi-server.cpp
src/remi-server.cpp
+26
-18
No files found.
src/remi-server.cpp
View file @
eaf5e6be
...
...
@@ -56,6 +56,7 @@ struct operation {
std
::
vector
<
mode_t
>
m_modes
;
std
::
vector
<
int
>
m_fds
;
std
::
vector
<
device
*>
m_devices
;
tl
::
mutex
m_mutex
;
int
m_error
=
REMI_SUCCESS
;
};
...
...
@@ -165,27 +166,32 @@ struct remi_provider : public tl::provider<remi_provider> {
}
auto
&
op
=
it
->
second
;
// close all the file descriptors
for
(
int
fd
:
op
.
m_fds
)
{
close
(
fd
);
}
{
std
::
lock_guard
<
tl
::
mutex
>
guard
(
op
.
m_mutex
);
if
(
op
.
m_error
!=
REMI_SUCCESS
)
{
result
.
first
=
op
.
m_error
;
req
.
respond
(
result
);
m_op_in_progress
.
erase
(
it
);
return
;
}
// close all the file descriptors
for
(
int
fd
:
op
.
m_fds
)
{
close
(
fd
);
}
if
(
op
.
m_error
!=
REMI_SUCCESS
)
{
result
.
first
=
op
.
m_error
;
req
.
respond
(
result
);
m_op_in_progress
.
erase
(
it
);
return
;
}
// find the class of migration
auto
&
klass
=
m_migration_classes
[
op
.
m_fileset
.
m_class
];
// find the class of migration
auto
&
klass
=
m_migration_classes
[
op
.
m_fileset
.
m_class
];
// call the "after" migration callback associated with the class of fileset
if
(
klass
.
m_after_callback
!=
nullptr
)
{
result
.
second
=
klass
.
m_after_callback
(
&
(
op
.
m_fileset
),
klass
.
m_uargs
);
}
result
.
first
=
result
.
second
==
0
?
REMI_SUCCESS
:
REMI_ERR_USER
;
req
.
respond
(
result
);
// call the "after" migration callback associated with the class of fileset
if
(
klass
.
m_after_callback
!=
nullptr
)
{
result
.
second
=
klass
.
m_after_callback
(
&
(
op
.
m_fileset
),
klass
.
m_uargs
);
}
result
.
first
=
result
.
second
==
0
?
REMI_SUCCESS
:
REMI_ERR_USER
;
req
.
respond
(
result
);
m_op_in_progress
.
erase
(
it
);
...
...
@@ -295,6 +301,9 @@ struct remi_provider : public tl::provider<remi_provider> {
return
;
}
auto
&
op
=
it
->
second
;
std
::
lock_guard
<
tl
::
mutex
>
guard
(
op
.
m_mutex
);
// we found the operation, let's open some files!
std
::
vector
<
int
>
openedFileDescriptors
;
...
...
@@ -346,7 +355,6 @@ struct remi_provider : public tl::provider<remi_provider> {
}
}
return
;
}
...
...
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