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
c4a2e5c9
Commit
c4a2e5c9
authored
8 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
AcsProxyZmq now connects on demand
parent
754faeb5
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
mediachanger/AcsProxyZmq.cpp
+21
-11
21 additions, 11 deletions
mediachanger/AcsProxyZmq.cpp
mediachanger/AcsProxyZmq.hpp
+20
-2
20 additions, 2 deletions
mediachanger/AcsProxyZmq.hpp
with
41 additions
and
13 deletions
mediachanger/AcsProxyZmq.cpp
+
21
−
11
View file @
c4a2e5c9
...
...
@@ -169,9 +169,8 @@ Frame createAcsForceDismountTapeFrame(const std::string &vid, const AcsLibrarySl
// constructor
//------------------------------------------------------------------------------
AcsProxyZmq
::
AcsProxyZmq
(
void
*
const
zmqContext
,
const
unsigned
short
serverPort
)
throw
()
:
m_serverPort
(
serverPort
),
m_serverSocket
(
zmqContext
,
ZMQ_REQ
)
{
connectZmqSocketToLocalhost
(
m_serverSocket
,
serverPort
);
m_zmqContext
(
zmqContext
),
m_serverPort
(
serverPort
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -182,10 +181,10 @@ void AcsProxyZmq::mountTapeReadOnly(const std::string &vid, const LibrarySlot &l
try
{
const
Frame
rqst
=
createAcsMountTapeReadOnlyFrame
(
vid
,
dynamic_cast
<
const
AcsLibrarySlot
&>
(
librarySlot
));
sendFrame
(
m_
serverSocket
,
rqst
);
sendFrame
(
serverSocket
Instance
()
,
rqst
);
MediaChangerReturnValue
reply
;
recvTapeReplyOrEx
(
m_
serverSocket
,
reply
);
recvTapeReplyOrEx
(
serverSocket
Instance
()
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
cta
::
exception
::
Exception
ex
;
...
...
@@ -210,10 +209,10 @@ void AcsProxyZmq::mountTapeReadWrite(const std::string &vid, const LibrarySlot &
try
{
const
Frame
rqst
=
createAcsMountTapeReadWriteFrame
(
vid
,
dynamic_cast
<
const
AcsLibrarySlot
&>
(
librarySlot
));
sendFrame
(
m_
serverSocket
,
rqst
);
sendFrame
(
serverSocket
Instance
()
,
rqst
);
MediaChangerReturnValue
reply
;
recvTapeReplyOrEx
(
m_
serverSocket
,
reply
);
recvTapeReplyOrEx
(
serverSocket
Instance
()
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
cta
::
exception
::
Exception
ex
;
...
...
@@ -238,10 +237,10 @@ void AcsProxyZmq::dismountTape(const std::string &vid, const LibrarySlot &librar
try
{
const
Frame
rqst
=
createAcsDismountTapeFrame
(
vid
,
dynamic_cast
<
const
AcsLibrarySlot
&>
(
librarySlot
));
sendFrame
(
m_
serverSocket
,
rqst
);
sendFrame
(
serverSocket
Instance
()
,
rqst
);
MediaChangerReturnValue
reply
;
recvTapeReplyOrEx
(
m_
serverSocket
,
reply
);
recvTapeReplyOrEx
(
serverSocket
Instance
()
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
cta
::
exception
::
Exception
ex
;
...
...
@@ -266,10 +265,10 @@ void AcsProxyZmq::forceDismountTape(const std::string &vid, const LibrarySlot &l
try
{
const
Frame
rqst
=
createAcsForceDismountTapeFrame
(
vid
,
dynamic_cast
<
const
AcsLibrarySlot
&>
(
librarySlot
));
sendFrame
(
m_
serverSocket
,
rqst
);
sendFrame
(
serverSocket
Instance
()
,
rqst
);
MediaChangerReturnValue
reply
;
recvTapeReplyOrEx
(
m_
serverSocket
,
reply
);
recvTapeReplyOrEx
(
serverSocket
Instance
()
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
cta
::
exception
::
Exception
ex
;
...
...
@@ -286,5 +285,16 @@ void AcsProxyZmq::forceDismountTape(const std::string &vid, const LibrarySlot &l
}
}
//------------------------------------------------------------------------------
// serverSocketInstance
//------------------------------------------------------------------------------
ZmqSocketMT
&
AcsProxyZmq
::
serverSocketInstance
()
{
if
(
nullptr
==
m_serverSocket
)
{
m_serverSocket
.
reset
(
new
ZmqSocketMT
(
m_zmqContext
,
ZMQ_REQ
));
connectZmqSocketToLocalhost
(
*
m_serverSocket
,
m_serverPort
);
}
return
*
m_serverSocket
;
}
}
// namespace mediachanger
}
// namespace cta
This diff is collapsed.
Click to expand it.
mediachanger/AcsProxyZmq.hpp
+
20
−
2
View file @
c4a2e5c9
...
...
@@ -22,6 +22,7 @@
#include
"mediachanger/MediaChangerProxy.hpp"
#include
"mediachanger/ZmqSocketMT.hpp"
#include
<memory>
#include
<mutex>
namespace
cta
{
...
...
@@ -80,6 +81,11 @@ public:
void
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
override
;
private:
/**
* The ZMQ context.
*/
void
*
m_zmqContext
;
/**
* Mutex used to implement a critical section around the enclosed
...
...
@@ -94,9 +100,21 @@ private:
const
unsigned
short
m_serverPort
;
/**
* Socket connecting this proxy the daemon it represents.
* Socket connecting this proxy to the daemon it represents.
*/
std
::
unique_ptr
<
ZmqSocketMT
>
m_serverSocket
;
/**
* Returns the socket instance connecting this proxy to the daemon it
* represents. This method instantiates a socket and connects it if
* a socket does not already exist.
*
* Please note that a lock MUST be taken on m_mutex before calling this
* method.
*
* @return The socket connecting this proxy the daemon it represents.
*/
ZmqSocketMT
m_
serverSocket
;
ZmqSocketMT
&
serverSocket
Instance
()
;
};
// class AcsProxyZmq
...
...
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