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 :
30 : /** @cond IGNORE */
31 : typedef fabric::Client Super;
32 : /** @endcond */
33 :
34 0 : Client::Client()
35 : : Super()
36 : , _mainThreadQueue( co::Global::getCommandQueueLimit( ))
37 0 : , _private( 0 )
38 : {
39 0 : }
40 :
41 0 : Client::~Client()
42 : {
43 0 : close();
44 0 : }
45 :
46 0 : bool Client::connectServer( ServerPtr server )
47 : {
48 : // connect to local server, if any
49 0 : co::ConnectionPtr connection = server::connectLocalServer();
50 0 : if( connection && connect( server, connection ))
51 : {
52 0 : server->setClient( this );
53 0 : server->map();
54 0 : return true;
55 : }
56 :
57 0 : if( !Super::connectServer( server ))
58 0 : return false;
59 :
60 0 : server->setClient( this );
61 0 : server->map();
62 0 : return true;
63 : }
64 :
65 0 : bool Client::disconnectServer( ServerPtr server )
66 : {
67 0 : server->unmap();
68 0 : server->setClient( 0 );
69 0 : return Super::disconnectServer( server.get( ));
70 : }
71 :
72 0 : co::NodePtr Client::createNode( const uint32_t type )
73 : {
74 0 : switch( type )
75 : {
76 : case fabric::NODETYPE_SERVER:
77 : {
78 0 : Server* server = new Server;
79 0 : server->setClient( this );
80 0 : return server;
81 : }
82 :
83 : default:
84 0 : return Super::createNode( type );
85 : }
86 : }
87 :
88 : }
89 84 : }
|