mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 09:34:35 -05:00
And fix the same sort of issue for BearSSL too
This commit is contained in:
parent
2dc6834e0b
commit
53de5363c3
2 changed files with 9 additions and 3 deletions
|
@ -972,7 +972,7 @@ static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* urlStr) {
|
|||
res = HttpBackend_PerformRequest(&state);
|
||||
/* TODO: Can we handle this while preserving the TCP connection */
|
||||
if (res == SSL_ERR_CONTEXT_DEAD && !retried) {
|
||||
Platform_LogConst("KILLIN AND TRYIN AGAIN");
|
||||
Platform_LogConst("Resetting connection due to SSL context being dropped..");
|
||||
res = HttpBackend_PerformRequest(&state);
|
||||
retried = true;
|
||||
}
|
||||
|
@ -1303,4 +1303,4 @@ static void Http_Init(void) {
|
|||
|
||||
Thread_Start2(workerThread, WorkerLoop);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -540,10 +540,16 @@ cc_result SSL_Read(void* ctx_, cc_uint8* data, cc_uint32 count, cc_uint32* read)
|
|||
SSLContext* ctx = (SSLContext*)ctx_;
|
||||
// TODO: just br_sslio_write ??
|
||||
int res = br_sslio_read(&ctx->ioc, data, count);
|
||||
int err;
|
||||
|
||||
if (res < 0) {
|
||||
if (ctx->readError) return ctx->readError;
|
||||
return SSL_ERROR_SHIFT + br_ssl_engine_last_error(&ctx->sc.eng);
|
||||
|
||||
// TODO session resumption, proper connection closing ??
|
||||
err = br_ssl_engine_last_error(&ctx->sc.eng);
|
||||
if (err == 0 && br_ssl_engine_current_state(&ctx->sc.eng) == BR_SSL_CLOSED)
|
||||
return SSL_ERR_CONTEXT_DEAD;
|
||||
return SSL_ERROR_SHIFT + err;
|
||||
}
|
||||
|
||||
br_sslio_flush(&ctx->ioc);
|
||||
|
|
Loading…
Add table
Reference in a new issue