Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
05fd4aa7
Commit
05fd4aa7
authored
13 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Task #2669: Sync NFS before unlinking the nfsKey as well.
parent
914dbcca
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
LCS/Stream/include/Stream/SocketStream.h
+2
-0
2 additions, 0 deletions
LCS/Stream/include/Stream/SocketStream.h
LCS/Stream/src/SocketStream.cc
+18
-10
18 additions, 10 deletions
LCS/Stream/src/SocketStream.cc
with
20 additions
and
10 deletions
LCS/Stream/include/Stream/SocketStream.h
+
2
−
0
View file @
05fd4aa7
...
@@ -64,6 +64,8 @@ class SocketStream : public FileDescriptorBasedStream
...
@@ -64,6 +64,8 @@ class SocketStream : public FileDescriptorBasedStream
void
accept
(
time_t
timeout
);
void
accept
(
time_t
timeout
);
static
void
syncNFS
();
static
std
::
string
readkey
(
const
string
&
nfskey
,
time_t
&
timeout
);
static
std
::
string
readkey
(
const
string
&
nfskey
,
time_t
&
timeout
);
static
void
writekey
(
const
string
&
nfskey
,
uint16
port
);
static
void
writekey
(
const
string
&
nfskey
,
uint16
port
);
static
void
deletekey
(
const
string
&
nfskey
);
static
void
deletekey
(
const
string
&
nfskey
);
...
...
This diff is collapsed.
Click to expand it.
LCS/Stream/src/SocketStream.cc
+
18
−
10
View file @
05fd4aa7
...
@@ -261,24 +261,30 @@ void SocketStream::setReadBufferSize(size_t size)
...
@@ -261,24 +261,30 @@ void SocketStream::setReadBufferSize(size_t size)
}
}
std
::
string
SocketStream
::
readkey
(
const
std
::
string
&
nfskey
,
time_t
&
timeout
)
void
SocketStream
::
syncNFS
(
)
{
{
for
(;;)
{
// sync NFS
// sync NFS
DIR
*
dir
=
opendir
(
"."
);
DIR
*
dir
=
opendir
(
"."
);
if
(
!
dir
)
if
(
!
dir
)
throw
SystemCallException
(
"opendir"
,
errno
,
THROW_ARGS
);
throw
SystemCallException
(
"opendir"
,
errno
,
THROW_ARGS
);
if
(
!
readdir
(
dir
))
if
(
!
readdir
(
dir
))
throw
SystemCallException
(
"readdir"
,
errno
,
THROW_ARGS
);
throw
SystemCallException
(
"readdir"
,
errno
,
THROW_ARGS
);
if
(
closedir
(
dir
)
!=
0
)
if
(
closedir
(
dir
)
!=
0
)
throw
SystemCallException
(
"closedir"
,
errno
,
THROW_ARGS
);
throw
SystemCallException
(
"closedir"
,
errno
,
THROW_ARGS
);
}
std
::
string
SocketStream
::
readkey
(
const
std
::
string
&
nfskey
,
time_t
&
timeout
)
{
for
(;;)
{
char
portStr
[
16
];
char
portStr
[
16
];
ssize_t
len
;
ssize_t
len
;
syncNFS
();
len
=
readlink
(
nfskey
.
c_str
(),
portStr
,
sizeof
portStr
-
1
);
// reserve 1 character to insert \0 below
len
=
readlink
(
nfskey
.
c_str
(),
portStr
,
sizeof
portStr
-
1
);
// reserve 1 character to insert \0 below
if
(
len
>=
0
)
{
if
(
len
>=
0
)
{
...
@@ -313,6 +319,8 @@ void SocketStream::writekey(const std::string &nfskey, uint16 port)
...
@@ -313,6 +319,8 @@ void SocketStream::writekey(const std::string &nfskey, uint16 port)
void
SocketStream
::
deletekey
(
const
std
::
string
&
nfskey
)
void
SocketStream
::
deletekey
(
const
std
::
string
&
nfskey
)
{
{
syncNFS
();
if
(
unlink
(
nfskey
.
c_str
())
<
0
)
if
(
unlink
(
nfskey
.
c_str
())
<
0
)
throw
SystemCallException
(
"unlink"
,
errno
,
THROW_ARGS
);
throw
SystemCallException
(
"unlink"
,
errno
,
THROW_ARGS
);
}
}
...
...
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
register
or
sign in
to comment