diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-06 09:55:38 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-09-06 10:43:33 +0200 |
commit | c4380fd9f2e7ebe0687cf979fba3044a5b3df554 (patch) | |
tree | 735594af4bdbb3c10c0dca8746992cacf6039ac5 | |
parent | 00bc30789be6888903645cbbbf47974cd7109cad (diff) |
Moved all internal details for ClientInfo out of the header.
Change-Id: I64102536f12875b9834ce99763925f1544a87e8f
-rw-r--r-- | sd/source/ui/inc/RemoteServer.hxx | 14 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Server.cxx | 39 |
2 files changed, 25 insertions, 28 deletions
diff --git a/sd/source/ui/inc/RemoteServer.hxx b/sd/source/ui/inc/RemoteServer.hxx index c64bf94de3e7..75b350e00751 100644 --- a/sd/source/ui/inc/RemoteServer.hxx +++ b/sd/source/ui/inc/RemoteServer.hxx @@ -51,19 +51,7 @@ namespace sd mAddress( rAddress ) {} }; - struct ClientInfoInternal: - ClientInfo - { - BufferedStreamSocket *mpStreamSocket; - rtl::OUString mPin; - - ClientInfoInternal( const rtl::OUString rName, - const rtl::OUString rAddress, - BufferedStreamSocket *pSocket, rtl::OUString rPin ): - ClientInfo( rName, rAddress ), - mpStreamSocket( pSocket ), - mPin( rPin ) {} - }; + struct ClientInfoInternal; class RemoteServer : public salhelper::Thread { diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index 487a54341a88..27dc20c77a79 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -40,18 +40,25 @@ using rtl::OString; using namespace ::osl; using namespace ::comphelper; -// struct ClientInfoInternal: -// ClientInfo -// { -// osl::StreamSocket mStreamSocket; -// rtl::OUString mPin; -// ClientInfoInternal( const rtl::OUString rName, -// const rtl::OUString rAddress, -// osl::StreamSocket &rSocket, rtl::OUString rPin ): -// ClientInfo( rName, rAddress ), -// mStreamSocket( rSocket ), -// mPin( rPin ) {} -// }; +namespace sd { + /** + * Used to keep track of clients that have attempted to connect, but haven't + * yet been approved. + */ + struct ClientInfoInternal: + ClientInfo + { + BufferedStreamSocket *mpStreamSocket; + rtl::OUString mPin; + + ClientInfoInternal( const rtl::OUString rName, + const rtl::OUString rAddress, + BufferedStreamSocket *pSocket, rtl::OUString rPin ): + ClientInfo( rName, rAddress ), + mpStreamSocket( pSocket ), + mPin( rPin ) {} + }; +} RemoteServer::RemoteServer() : Thread( "RemoteServerThread" ), @@ -72,11 +79,13 @@ void RemoteServer::execute() if ( !mSocket.bind( aAddr ) ) { // Error binding + return; } if ( !mSocket.listen(3) ) { // Error listening + return; } while ( true ) { @@ -108,6 +117,7 @@ void RemoteServer::execute() mAvailableClients.push_back( pClient ); // Read off any additional non-empty lines + // We know that we at least have the empty termination line to read. do { pSocket->readLine( aLine ); @@ -126,10 +136,9 @@ void RemoteServer::execute() OUString sPin; axPin >>= sPin; - if ( ! sPin.equals( pClient->mPin ) ) { - break; + if ( sPin.equals( pClient->mPin ) ) { + connectClient( pClient, sPin ); } - connectClient( pClient, sPin ); break; } |