Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
dCache
cta
Commits
2128faec
Commit
2128faec
authored
11 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Improved comments
parent
0ab2d662
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
castor/tape/tapeserver/daemon/VdqmImpl.cpp
+33
-13
33 additions, 13 deletions
castor/tape/tapeserver/daemon/VdqmImpl.cpp
castor/tape/tapeserver/daemon/VdqmImpl.hpp
+36
-0
36 additions, 0 deletions
castor/tape/tapeserver/daemon/VdqmImpl.hpp
with
69 additions
and
13 deletions
castor/tape/tapeserver/daemon/VdqmImpl.cpp
+
33
−
13
View file @
2128faec
...
...
@@ -151,37 +151,57 @@ void castor::tape::tapeserver::daemon::VdqmImpl::writeDriveStatusMsg(
//-----------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
VdqmImpl
::
readCommitAck
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
)
{
char
buf
[
12
];
// Magic + type + status
legacymsg
::
MessageHeader
ackMsg
;
legacymsg
::
MessageHeader
ack
;
try
{
io
::
readBytes
(
connection
,
m_netTimeout
,
sizeof
(
buf
),
buf
);
ack
=
readAck
(
connection
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"Failed to read VDQM_COMMIT ack: "
<<
ne
.
getMessage
().
str
();
ex
.
getMessage
()
<<
"Failed to read VDQM_COMMIT ack: "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
const
char
*
bufPtr
=
buf
;
size_t
bufLen
=
sizeof
(
buf
);
legacymsg
::
unmarshal
(
bufPtr
,
bufLen
,
ackMsg
);
if
(
VDQM_MAGIC
!=
ackMsg
.
magic
)
{
if
(
VDQM_MAGIC
!=
ack
.
magic
)
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"Failed to read VDQM_COMMIT ack: Invalid magic"
": expected=0x"
<<
std
::
hex
<<
VDQM_MAGIC
<<
" actual="
<<
ack
Msg
.
magic
;
": expected=0x"
<<
std
::
hex
<<
VDQM_MAGIC
<<
" actual="
<<
ack
.
magic
;
throw
ex
;
}
if
(
VDQM_COMMIT
!=
ack
Msg
.
reqType
)
{
if
(
VDQM_COMMIT
!=
ack
.
reqType
)
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"Failed to read VDQM_COMMIT ack: Invalid request type"
": expected=0x"
<<
std
::
hex
<<
VDQM_COMMIT
<<
" actual=0x"
<<
ack
Msg
.
reqType
;
ack
.
reqType
;
throw
ex
;
}
}
//-----------------------------------------------------------------------------
// readAck
//-----------------------------------------------------------------------------
castor
::
tape
::
legacymsg
::
MessageHeader
castor
::
tape
::
tapeserver
::
daemon
::
VdqmImpl
::
readAck
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
)
{
char
buf
[
12
];
// Magic + type + len
legacymsg
::
MessageHeader
ack
;
try
{
io
::
readBytes
(
connection
,
m_netTimeout
,
sizeof
(
buf
),
buf
);
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"Failed to read VDQM_COMMIT ack: "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
const
char
*
bufPtr
=
buf
;
size_t
bufLen
=
sizeof
(
buf
);
legacymsg
::
unmarshal
(
bufPtr
,
bufLen
,
ack
);
return
ack
;
}
//-----------------------------------------------------------------------------
// readDriveStatusMsgHeader
//-----------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
castor/tape/tapeserver/daemon/VdqmImpl.hpp
+
36
−
0
View file @
2128faec
...
...
@@ -110,18 +110,54 @@ private:
const
std
::
string
&
unitName
,
const
std
::
string
&
dgn
,
const
int
status
)
throw
(
castor
::
exception
::
Exception
);
/**
* Reads a VDQM_COMMIT ack message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message.
*/
void
readCommitAck
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
);
/**
* Reads an ack message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message.
*/
legacymsg
::
MessageHeader
readAck
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
);
/**
* Reads drive status message from the specified connection and discards it.
*
* @param connection The file-descriptor of the connection.
*/
void
readDriveStatusMsg
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
);
/**
* Reads the header of a drive status message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message header.
*/
legacymsg
::
MessageHeader
readDriveStatusMsgHeader
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
);
/**
* Reads the body of a drive status message from the specified connection.
* @param connection The file-descriptor of the connection.
* @return The message body.
*/
legacymsg
::
VdqmDrvRqstMsgBody
readDriveStatusMsgBody
(
const
int
connection
,
const
uint32_t
bodyLen
)
throw
(
castor
::
exception
::
Exception
);
/**
* Writes a VDQM_COMMIT ack message to the specified connection.
*
* @param connection The file-descriptor of the connection.
*/
void
writeCommitAck
(
const
int
connection
)
throw
(
castor
::
exception
::
Exception
);
...
...
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