[Libreoffice-commits] .: sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 6 01:43:56 PDT 2012


 sd/source/ui/inc/RemoteServer.hxx     |   14 ------------
 sd/source/ui/remotecontrol/Server.cxx |   39 ++++++++++++++++++++--------------
 2 files changed, 25 insertions(+), 28 deletions(-)

New commits:
commit c4380fd9f2e7ebe0687cf979fba3044a5b3df554
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Thu Sep 6 09:55:38 2012 +0200

    Moved all internal details for ClientInfo out of the header.
    
    Change-Id: I64102536f12875b9834ce99763925f1544a87e8f

diff --git a/sd/source/ui/inc/RemoteServer.hxx b/sd/source/ui/inc/RemoteServer.hxx
index c64bf94..75b350e 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 487a543..27dc20c 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;
                 }
 


More information about the Libreoffice-commits mailing list