Skip to content

Commit 9aac188

Browse files
Merge pull request #17972 from warmenhoven/warmenhoven/pr/android-ssl
2 parents a44c65f + 98852bd commit 9aac188

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed

libretro-common/net/net_http.c

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -973,40 +973,45 @@ static bool net_http_connect(struct http_t *state)
973973
#else
974974
if (state->ssl)
975975
{
976-
if (!conn || conn->fd < 0)
976+
if (!conn)
977977
return false;
978978

979-
if (!(conn->ssl_ctx = ssl_socket_init(conn->fd, state->request.domain)))
979+
for (next_addr = addr; conn->fd >= 0; conn->fd = socket_next((void**)&next_addr))
980980
{
981-
net_http_conn_pool_remove(conn);
982-
state->conn = NULL;
983-
state->error = true;
984-
return false;
985-
}
981+
if (!(conn->ssl_ctx = ssl_socket_init(conn->fd, state->request.domain)))
982+
{
983+
socket_close(conn->fd);
984+
break;
985+
}
986986

987-
/* TODO: Properly figure out what's going wrong when the newer
988-
timeout/poll code interacts with mbed and winsock
989-
https://github.com/libretro/RetroArch/issues/14742 */
987+
/* TODO: Properly figure out what's going wrong when the newer
988+
timeout/poll code interacts with mbed and winsock
989+
https://github.com/libretro/RetroArch/issues/14742 */
990990

991-
/* Temp fix, don't use new timeout/poll code for cheevos http requests */
991+
/* Temp fix, don't use new timeout/poll code for cheevos http requests */
992992
bool timeout = true;
993993
#ifdef __WIN32
994-
if (!strcmp(state->request.domain, "retroachievements.org"))
995-
timeout = false;
994+
if (!strcmp(state->request.domain, "retroachievements.org"))
995+
timeout = false;
996996
#endif
997997

998-
if (ssl_socket_connect(conn->ssl_ctx, addr, timeout, true) < 0)
999-
{
1000-
net_http_conn_pool_remove(conn);
1001-
state->conn = NULL;
1002-
state->error = true;
1003-
return false;
1004-
}
1005-
else
1006-
{
1007-
conn->connected = true;
1008-
return true;
998+
if (ssl_socket_connect(conn->ssl_ctx, next_addr, timeout, true) < 0)
999+
{
1000+
ssl_socket_close(conn->ssl_ctx);
1001+
ssl_socket_free(conn->ssl_ctx);
1002+
conn->ssl_ctx = NULL;
1003+
}
1004+
else
1005+
{
1006+
conn->connected = true;
1007+
return true;
1008+
}
10091009
}
1010+
conn->fd = -1; /* already closed */
1011+
net_http_conn_pool_remove(conn);
1012+
state->conn = NULL;
1013+
state->error = true;
1014+
return false;
10101015
}
10111016
else
10121017
#endif

pkg/android/phoenix-common/jni/Android.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ DEFINES += -DRARCH_MOBILE \
137137
-DHAVE_TRANSLATE \
138138
-DWANT_IFADDRS \
139139
-DHAVE_XDELTA \
140-
-DHAVE_CORE_INFO_CACHE
140+
-DHAVE_CORE_INFO_CACHE \
141+
-DHAVE_BUILTINMBEDTLS -DHAVE_SSL
141142

142143
ifeq ($(HAVE_GFX_WIDGETS),1)
143144
DEFINES += -DHAVE_GFX_WIDGETS

tasks/task_cloudsync.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,9 @@ static void task_cloud_sync_task_handler(retro_task_t *task)
12441244
}
12451245
slock_unlock(tcs_running_lock);
12461246

1247+
if (task->flags & RETRO_TASK_FLG_FINISHED)
1248+
goto task_finished;
1249+
12471250
switch (sync_state->phase)
12481251
{
12491252
case CLOUD_SYNC_PHASE_BEGIN:

0 commit comments

Comments
 (0)