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
98dcb681
Commit
98dcb681
authored
11 years ago
by
Elvin Alin Sindrilaru
Browse files
Options
Downloads
Patches
Plain Diff
XROOTD: Catch the right exception type and simplify a bit the clean-up logic in
case an exception is thrown
parent
f1952502
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xrootd/XrdxCastorClient.cpp
+5
-16
5 additions, 16 deletions
xrootd/XrdxCastorClient.cpp
with
5 additions
and
16 deletions
xrootd/XrdxCastorClient.cpp
+
5
−
16
View file @
98dcb681
...
@@ -194,29 +194,24 @@ XrdxCastorClient::SendAsyncRequest(const std::string& userId,
...
@@ -194,29 +194,24 @@ XrdxCastorClient::SendAsyncRequest(const std::string& userId,
// Lock the map as we could receive the answer for our request before registering
// Lock the map as we could receive the answer for our request before registering
// it to the map. This is fine as the request is processed only after we get the ack.
// it to the map. This is fine as the request is processed only after we get the ack.
mMutexMaps
.
Lock
();
// -->
mMutexMaps
.
Lock
();
// -->
castor
::
MessageAck
*
ack
;
try
try
{
{
// Wait for acknowledgment
// Wait for acknowledgment
castor
::
IObject
*
obj
=
sock
.
readObject
();
castor
::
IObject
*
obj
=
sock
.
readObject
();
castor
::
MessageAck
*
ack
=
dynamic_cast
<
castor
::
MessageAck
*>
(
obj
);
ack
=
dynamic_cast
<
castor
::
MessageAck
*>
(
obj
);
if
(
0
==
ack
)
if
(
0
==
ack
)
{
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
InvalidArgument
e
;
castor
::
exception
::
InvalidArgument
e
;
e
.
getMessage
()
<<
"No Acknowledgement from the server"
;
e
.
getMessage
()
<<
"No Acknowledgement from the server"
;
delete
ack
;
delete
elem
;
throw
e
;
throw
e
;
}
}
if
(
!
ack
->
status
())
if
(
!
ack
->
status
())
{
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Exception
e
(
ack
->
errorCode
());
castor
::
exception
::
Exception
e
(
ack
->
errorCode
());
e
.
getMessage
()
<<
ack
->
errorMessage
();
e
.
getMessage
()
<<
ack
->
errorMessage
();
delete
ack
;
delete
elem
;
throw
e
;
throw
e
;
}
}
...
@@ -241,34 +236,28 @@ XrdxCastorClient::SendAsyncRequest(const std::string& userId,
...
@@ -241,34 +236,28 @@ XrdxCastorClient::SendAsyncRequest(const std::string& userId,
{
{
// If user exists already, remove the request from the map
// If user exists already, remove the request from the map
mMapRequests
.
erase
(
req_insert
.
first
);
mMapRequests
.
erase
(
req_insert
.
first
);
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Internal
e
;
castor
::
exception
::
Internal
e
;
e
.
getMessage
()
<<
"Fatal error: the user we are trying to register "
e
.
getMessage
()
<<
"Fatal error: the user we are trying to register "
<<
"exists already in the map "
;
<<
"exists already in the map "
;
delete
elem
;
delete
ack
;
throw
e
;
throw
e
;
}
}
}
}
else
else
{
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Internal
e
;
castor
::
exception
::
Internal
e
;
e
.
getMessage
()
<<
"Fatal error: the request we are trying to submit "
e
.
getMessage
()
<<
"Fatal error: the request we are trying to submit "
<<
"exists already in the map "
;
<<
"exists already in the map "
;
delete
elem
;
delete
ack
;
throw
e
;
throw
e
;
}
}
mMutexMaps
.
UnLock
();
// <--
mMutexMaps
.
UnLock
();
// <--
delete
ack
;
delete
ack
;
}
}
catch
(
castor
::
exception
::
Communica
tion
e
)
catch
(
castor
::
exception
::
Excep
tion
&
e
)
{
{
// Unlock the map and forward any exception
mMutexMaps
.
UnLock
();
// <--
mMutexMaps
.
UnLock
();
// <--
e
.
getMessage
()
<<
"Reading object from the socket failed"
;
delete
ack
;
delete
elem
;
delete
elem
;
throw
e
;
throw
e
;
}
}
...
...
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