aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-28 05:46:11 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-28 05:46:11 +0000
commit6e9d44b63f4144c0f4793224f980af45a8a0d8c5 (patch)
tree6454c0d43bde5f47b28fd63b707004260615886d
parentc044d6e3c39e28d98ea4d815df84835e366aa442 (diff)
fixed ssl_init_socket_with_method().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1200 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja6
-rw-r--r--libsylph/ssl.c14
3 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b2bf0b2..7bc1bc74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@
2006-09-28
+ * libsylph/ssl.c: ssl_init_socket_with_method(): retry SSL_connect()
+ if it fails with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.
+
+2006-09-28
+
* src/trayicon.[ch]: trayicon_hide(): added.
* src/mainwindow.c: call trayicon_hide() instead of trayicon_destroy().
* src/main.c: app_will_exit(): call trayicon_destroy().
diff --git a/ChangeLog.ja b/ChangeLog.ja
index b6cadb2a..557545fb 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -4,6 +4,12 @@
2006-09-28
+ * libsylph/ssl.c: ssl_init_socket_with_method(): SSL_connect() が
+ SSL_ERROR_WANT_READ または SSL_ERROR_WANT_WRITE で失敗したら
+ 再試行するようにした。
+
+2006-09-28
+
* src/trayicon.[ch]: trayicon_hide(): 追加。
src/mainwindow.c: trayicon_destroy() の代わりに trayicon_hide() を
呼ぶようにした。
diff --git a/libsylph/ssl.c b/libsylph/ssl.c
index 4507862f..d2721276 100644
--- a/libsylph/ssl.c
+++ b/libsylph/ssl.c
@@ -93,7 +93,7 @@ gboolean ssl_init_socket(SockInfo *sockinfo)
gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
{
X509 *server_cert;
- gint ret;
+ gint err, ret;
switch (method) {
case SSL_METHOD_SSLv23:
@@ -122,9 +122,15 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
}
SSL_set_fd(sockinfo->ssl, sockinfo->sock);
- if ((ret = SSL_connect(sockinfo->ssl)) == -1) {
- g_warning(_("SSL connect failed (%s)\n"),
- ERR_error_string(ERR_get_error(), NULL));
+ while ((ret = SSL_connect(sockinfo->ssl)) != 1) {
+ err = SSL_get_error(sockinfo->ssl, ret);
+ if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) {
+ g_usleep(100000);
+ g_warning("SSL_connect(): try again\n");
+ continue;
+ }
+ g_warning("SSL_connect() failed with error %d, ret = %d (%s)\n",
+ err, ret, ERR_error_string(ERR_get_error(), NULL));
return FALSE;
}