MCPcopy Create free account
hub / github.com/SmingHub/Sming / onAccept

Method onAccept

Sming/Components/ssl/src/Session.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42bool Session::onAccept(TcpConnection* client, tcp_pcb* tcp)
43{
44 debug_i("SSL %p onAccept(%p, %p)", this, client, tcp);
45
46 if(!keyCert.isValid()) {
47 debug_e("SSL: server certificate and key are not provided!");
48 return false;
49 }
50
51 if(!context) {
52 assert(factory != nullptr);
53 context.reset(factory->createContext(*this));
54 if(!context) {
55 return false;
56 }
57
58 if(!context->init()) {
59 return false;
60 }
61
62 // TODO: test: free the certificate data on server destroy...
63 options.freeKeyCertAfterHandshake = true;
64 }
65
66 beginHandshake();
67
68 auto server = context->createServer(tcp);
69 return client->setSslConnection(server);
70}
71
72bool Session::onConnect(tcp_pcb* tcp)
73{

Callers

nothing calls this directly

Calls 6

setSslConnectionMethod · 0.80
isValidMethod · 0.45
resetMethod · 0.45
createContextMethod · 0.45
initMethod · 0.45
createServerMethod · 0.45

Tested by

no test coverage detected