SSL bugfixes.

This commit is contained in:
Gunnar Beutner 2012-04-24 16:27:23 +02:00
parent 55e8619b76
commit fa9449fc73
4 changed files with 17 additions and 7 deletions

View File

@ -116,14 +116,19 @@ int TLSClient::WritableEventHandler(const EventArgs& ea)
return 0;
}
bool TLSClient::WantsToRead(void) const
{
if (SSL_want_read(m_SSL.get()))
return true;
return TCPClient::WantsToWrite();
}
bool TLSClient::WantsToWrite(void) const
{
if (SSL_want_write(m_SSL.get()))
return true;
if (SSL_state(m_SSL.get()) != SSL_ST_OK)
return false;
return TCPClient::WantsToWrite();
}

View File

@ -40,6 +40,7 @@ public:
virtual void Start(void);
virtual bool WantsToRead(void) const;
virtual bool WantsToWrite(void) const;
Event<VerifyCertificateEventArgs> OnVerifyCertificate;

View File

@ -3,8 +3,8 @@
"configrpc": { "replicate": "0", "configSource": "1" },
"demo": { "replicate": "0" }
},
"rpclistener": {
"kekslistener": { "replicate": "0", "port": "7777" }
"rpcconnection": {
"kekslistener": { "replicate": "0", "hostname": "10.0.10.14", "port": "7777" }
},
"host": {
"localhost": { "ipaddr": "127.0.0.1" }

View File

@ -189,8 +189,12 @@ int JsonRpcEndpoint::ClientReconnectHandler(const TimerEventArgs& ea)
int JsonRpcEndpoint::VerifyCertificateHandler(const VerifyCertificateEventArgs& ea)
{
if (ea.Certificate && ea.ValidCertificate)
SetIdentity(Utility::GetCertificateCN(ea.Certificate));
if (ea.Certificate && ea.ValidCertificate) {
string identity = Utility::GetCertificateCN(ea.Certificate);
if (GetIdentity().empty() && !identity.empty())
SetIdentity(identity);
}
return 0;
}