Line data Source code
1 :
2 : /* Copyright (c) 2010-2013, Stefan Eilemann <eile@eyescale.ch>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #include "client.h"
19 :
20 : #include "server.h"
21 : #include <co/global.h>
22 :
23 : #include <eq/server/localServer.h>
24 :
25 : namespace eq
26 : {
27 : namespace admin
28 : {
29 : /** @cond IGNORE */
30 : typedef fabric::Client Super;
31 : /** @endcond */
32 :
33 0 : Client::Client()
34 : : Super()
35 : , _mainThreadQueue(co::Global::getCommandQueueLimit())
36 0 : , _private(0)
37 : {
38 0 : }
39 :
40 0 : Client::~Client()
41 : {
42 0 : close();
43 0 : }
44 :
45 0 : bool Client::connectServer(ServerPtr server)
46 : {
47 : // connect to local server, if any
48 0 : co::ConnectionPtr connection = server::connectLocalServer();
49 0 : if (connection && connect(server, connection))
50 : {
51 0 : server->setClient(this);
52 0 : server->map();
53 0 : return true;
54 : }
55 :
56 0 : if (!Super::connectServer(server))
57 0 : return false;
58 :
59 0 : server->setClient(this);
60 0 : server->map();
61 0 : return true;
62 : }
63 :
64 0 : bool Client::disconnectServer(ServerPtr server)
65 : {
66 0 : server->unmap();
67 0 : server->setClient(0);
68 0 : return Super::disconnectServer(server.get());
69 : }
70 :
71 0 : co::NodePtr Client::createNode(const uint32_t type)
72 : {
73 0 : switch (type)
74 : {
75 : case fabric::NODETYPE_SERVER:
76 : {
77 0 : Server* server = new Server;
78 0 : server->setClient(this);
79 0 : return server;
80 : }
81 :
82 : default:
83 0 : return Super::createNode(type);
84 : }
85 : }
86 : }
87 60 : }
|