| 70 | } |
| 71 | |
| 72 | bool Session::onConnect(tcp_pcb* tcp) |
| 73 | { |
| 74 | debug_d("SSL %p: Starting connection...", this); |
| 75 | |
| 76 | assert(!connection); |
| 77 | assert(!context); |
| 78 | |
| 79 | // Client Session |
| 80 | context.reset(); |
| 81 | assert(factory != nullptr); |
| 82 | context.reset(factory->createContext(*this)); |
| 83 | if(!context) { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | cacheSize = 1; |
| 88 | |
| 89 | if(!context->init()) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | if(sessionId && sessionId->isValid()) { |
| 94 | debug_d("-----BEGIN SSL SESSION PARAMETERS-----"); |
| 95 | debug_d("SessionId: %s", toString(*sessionId).c_str()); |
| 96 | debug_d("------END SSL SESSION PARAMETERS------"); |
| 97 | } |
| 98 | |
| 99 | beginHandshake(); |
| 100 | |
| 101 | connection.reset(context->createClient(tcp)); |
| 102 | if(!connection) { |
| 103 | endHandshake(); |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | return true; |
| 108 | } |
| 109 | |
| 110 | void Session::beginHandshake() |
| 111 | { |
no test coverage detected