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
f1952502
Commit
f1952502
authored
11 years ago
by
Elvin Alin Sindrilaru
Browse files
Options
Downloads
Patches
Plain Diff
XROOTD: Expand properly the scope of the try-catch
Conflicts: xrootd/XrdxCastorClient.cpp
parent
fa8870a1
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
+59
-60
59 additions, 60 deletions
xrootd/XrdxCastorClient.cpp
with
59 additions
and
60 deletions
xrootd/XrdxCastorClient.cpp
+
59
−
60
View file @
f1952502
...
...
@@ -199,81 +199,80 @@ XrdxCastorClient::SendAsyncRequest(const std::string& userId,
{
// Wait for acknowledgment
castor
::
IObject
*
obj
=
sock
.
readObject
();
}
catch
(
castor
::
exceptio
::
Communication
e
)
{
mMutexMaps
.
UnLock
();
// <--
e
.
getMessage
()
<<
"Reading object from the socket failed"
;
delete
elem
;
throw
e
;
}
castor
::
MessageAck
*
ack
=
dynamic_cast
<
castor
::
MessageAck
*>
(
obj
);
if
(
0
==
ack
)
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
InvalidArgument
e
;
e
.
getMessage
()
<<
"No Acknowledgement from the server"
;
delete
ack
;
delete
elem
;
throw
e
;
}
if
(
!
ack
->
status
())
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Exception
e
(
ack
->
errorCode
());
e
.
getMessage
()
<<
ack
->
errorMessage
();
delete
ack
;
delete
elem
;
throw
e
;
}
xcastor_debug
(
"ack for reqid=%s"
,
ack
->
requestId
().
c_str
());
// Save the request id returned by the stager and add it to the map
std
::
string
req_id
=
ack
->
requestId
();
req
->
setReqId
(
req_id
);
// Save in map the identity of the user along with the request id and response
std
::
pair
<
AsyncReqMap
::
iterator
,
bool
>
req_insert
;
std
::
pair
<
AsyncUserMap
::
iterator
,
bool
>
user_insert
;
req_insert
=
mMapRequests
.
insert
(
std
::
make_pair
(
req_id
,
elem
));
if
(
req_insert
.
second
==
true
)
{
// The request was inserted in the map, insert also the user in the other map
user_insert
=
mMapUsers
.
insert
(
std
::
make_pair
(
userId
,
req_insert
.
first
));
if
(
!
user_insert
.
second
)
castor
::
MessageAck
*
ack
=
dynamic_cast
<
castor
::
MessageAck
*>
(
obj
);
if
(
0
==
ack
)
{
// If user exists already, remove the request from the map
mMapRequests
.
erase
(
req_insert
.
first
);
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
InvalidArgument
e
;
e
.
getMessage
()
<<
"No Acknowledgement from the server"
;
delete
ack
;
delete
elem
;
throw
e
;
}
if
(
!
ack
->
status
())
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Exception
e
(
ack
->
errorCode
());
e
.
getMessage
()
<<
ack
->
errorMessage
();
delete
ack
;
delete
elem
;
throw
e
;
}
xcastor_debug
(
"ack for reqid=%s"
,
ack
->
requestId
().
c_str
());
// Save the request id returned by the stager and add it to the map
std
::
string
req_id
=
ack
->
requestId
();
req
->
setReqId
(
req_id
);
// Save in map the identity of the user along with the request id and response
std
::
pair
<
AsyncReqMap
::
iterator
,
bool
>
req_insert
;
std
::
pair
<
AsyncUserMap
::
iterator
,
bool
>
user_insert
;
req_insert
=
mMapRequests
.
insert
(
std
::
make_pair
(
req_id
,
elem
));
if
(
req_insert
.
second
==
true
)
{
// The request was inserted in the map, insert also the user in the other map
user_insert
=
mMapUsers
.
insert
(
std
::
make_pair
(
userId
,
req_insert
.
first
));
if
(
!
user_insert
.
second
)
{
// If user exists already, remove the request from the map
mMapRequests
.
erase
(
req_insert
.
first
);
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Internal
e
;
e
.
getMessage
()
<<
"Fatal error: the user we are trying to register "
<<
"exists already in the map "
;
delete
elem
;
delete
ack
;
throw
e
;
}
}
else
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Internal
e
;
e
.
getMessage
()
<<
"Fatal error: the
user
we are trying to
register
"
e
.
getMessage
()
<<
"Fatal error: the
request
we are trying to
submit
"
<<
"exists already in the map "
;
delete
elem
;
delete
ack
;
throw
e
;
}
mMutexMaps
.
UnLock
();
// <--
delete
ack
;
}
else
catch
(
castor
::
exception
::
Communication
e
)
{
mMutexMaps
.
UnLock
();
// <--
castor
::
exception
::
Internal
e
;
e
.
getMessage
()
<<
"Fatal error: the request we are trying to submit "
<<
"exists already in the map "
;
e
.
getMessage
()
<<
"Reading object from the socket failed"
;
delete
elem
;
delete
ack
;
throw
e
;
throw
e
;
}
mMutexMaps
.
UnLock
();
// <--
delete
ack
;
return
ret
;
}
...
...
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