Kaydet (Commit) c4380fd9 authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Moved all internal details for ClientInfo out of the header.

Change-Id: I64102536f12875b9834ce99763925f1544a87e8f
üst 00bc3078
......@@ -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
{
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment