commit - 1d33746341bbe854140c2f1b05f4d29bba7b7887
commit + 6fbc6aaae2a2c56db9875e14f299839a748548a8
blob - 997dda3d48c9740aa3311e63c5a62d826c58e3f8
blob + d88bfdc174c210657f0306f3be242db6e4ade599
--- ChangeLog-gtk2.claws
+++ ChangeLog-gtk2.claws
+2004-08-09 [colin] 0.9.12cvs55.1
+
+ * src/main.c
+ * src/common/ssl.c
+ * src/common/sylpheed.c
+ * src/common/sylpheed.h
+ Sync from 0.9.12cvs55 HEAD (nonblocking SSL_connect)
+
2004-08-09 [paul] 0.9.12cvs54.1
* ChangeLog
blob - 2ab81cfefaaac5887cd6d146dc5f72497397c40c
blob + ca9cf4605350f6e46ba0001581522a12455b12d4
--- PATCHSETS
+++ PATCHSETS
( cvs diff -u -r 1.56.2.24 -r 1.56.2.25 src/pop.c; cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/common/partial_download.c; ) > 0.9.12cvs50.1.patchset
( cvs diff -u -r 1.654.2.137 -r 1.654.2.138 configure.ac; cvs diff -u -r 1.213.2.12 -r 1.213.2.13 src/folder.c; ) > 0.9.12cvs51.1.patchset
( cvs diff -u -r 1.396.2.7 -r 1.396.2.8 ChangeLog; cvs diff -u -r 1.2504.2.10 -r 1.2504.2.11 ChangeLog.claws; cvs diff -u -r 1.391.2.7 -r 1.391.2.8 ChangeLog.jp; cvs diff -u -r 1.654.2.138 -r 1.654.2.139 configure.ac; cvs diff -u -r 1.53.2.5 -r 1.53.2.6 po/POTFILES.in; cvs diff -u -r 1.155.2.7 -r 1.155.2.8 src/Makefile.am; cvs diff -u -r 1.3.2.2 -r 1.3.2.3 src/folderutils.c; cvs diff -u -r 1.115.2.12 -r 1.115.2.13 src/main.c; cvs diff -u -r -1.10.2.3 -r -1.10.2.4 src/pgpmime.c; cvs diff -u -r -1.1.4.1 -r -1.1.4.2 src/pgpmime.h; cvs diff -u -r -1.12.2.4 -r -1.12.2.5 src/sgpgme.c; cvs diff -u -r -1.4.2.2 -r -1.4.2.3 src/sgpgme.h; cvs diff -u -r 1.8 -r 1.9 src/plugins/Makefile.am; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/.cvsignore; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/Makefile.am; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/pgpmime.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/pgpmime.h; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/plugin.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/sgpgme.c; cvs diff -u -r 0 -r 1 src/plugins/pgpmime/sgpgme.h; ) > 0.9.12cvs54.1.patchset
+( cvs diff -u -r 1.115.2.13 -r 1.115.2.14 src/main.c; cvs diff -u -r 1.9.2.4 -r 1.9.2.5 src/common/ssl.c; cvs diff -u -r 1.7.2.1 -r 1.7.2.2 src/common/sylpheed.c; cvs diff -u -r 1.5 -r 1.6 src/common/sylpheed.h; ) > 0.9.12cvs55.1.patchset
blob - dcc4a28ed6b01c2d3e26afb292e1c070a2a12c3c
blob + 924c6870800b9cbd77f57b195744aa21f294203f
--- configure.ac
+++ configure.ac
MICRO_VERSION=12
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=54
+EXTRA_VERSION=55
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=.1
AC_SUBST(CLAMAV_LIBS)
AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes)
+AC_CHECK_LIB(pthread, pthread_create,
+ [ OPENSSL_LIBS="$OPENSSL_LIBS -lpthread" AC_DEFINE(USE_PTHREAD, 1, Define if you have lpthread) ])
+
dnl ****************************
dnl ** Final configure output **
dnl ****************************
blob - 07eeea94fea6cec058c92efb02e801c448de1374
blob + 3594e20944fe6137fd656d7cb05c948e28504936
--- src/common/ssl.c
+++ src/common/ssl.c
#include <glib.h>
+#include "sylpheed.h"
#include "intl.h"
#include "utils.h"
#include "ssl.h"
#include "ssl_certificate.h"
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#endif
+
+#ifdef USE_PTHREAD
+typedef struct _thread_data {
+ SSL *ssl;
+ gboolean done;
+} thread_data;
+#endif
+
+
static SSL_CTX *ssl_ctx;
void ssl_init(void)
SSL_CTX_free(ssl_ctx);
}
+#ifdef USE_PTHREAD
+void *SSL_connect_thread(void *data)
+{
+ thread_data *td = (thread_data *)data;
+ int result = SSL_connect(td->ssl);
+ td->done = TRUE; /* let the caller thread join() */
+ return GINT_TO_POINTER(result);
+}
+#endif
+
+gint SSL_connect_nb(SSL *ssl)
+{
+#ifdef USE_PTHREAD
+ thread_data *td = g_new0(thread_data, 1);
+ pthread_t pt;
+ void *res = NULL;
+
+ td->ssl = ssl;
+ td->done = FALSE;
+
+ /* try to create a thread to initialize the SSL connection,
+ * fallback to blocking method in case of problem
+ */
+ if (pthread_create(&pt, PTHREAD_CREATE_JOINABLE,
+ SSL_connect_thread, td) != 0)
+ return SSL_connect(ssl);
+
+ debug_print("waiting for SSL_connect thread...\n");
+ while(!td->done) {
+ /* don't let the interface freeze while waiting */
+ sylpheed_do_idle();
+ }
+
+ /* get the thread's return value and clean its resources */
+ pthread_join(pt, &res);
+ g_free(td);
+
+ debug_print("SSL_connect thread returned %d\n",
+ GPOINTER_TO_INT(res));
+
+ return GPOINTER_TO_INT(res);
+#else
+ return SSL_connect(ssl);
+#endif
+}
+
gboolean ssl_init_socket(SockInfo *sockinfo)
{
return ssl_init_socket_with_method(sockinfo, SSL_METHOD_SSLv23);
}
SSL_set_fd(ssl, sockinfo->sock);
- if (SSL_connect(ssl) == -1) {
+ if (SSL_connect_nb(ssl) == -1) {
g_warning(_("SSL connect failed (%s)\n"),
ERR_error_string(ERR_get_error(), NULL));
SSL_free(ssl);
blob - 99b82aa80c511fdcd79f392732ef4fb4d3d7ae92
blob + 304e041f72fd5865ab65318dee7fcfce8a943efe
--- src/common/sylpheed.c
+++ src/common/sylpheed.c
static gboolean sylpheed_initialized = FALSE;
static gchar *startup_dir;
+static void (*sylpheed_idle_function)(void) = NULL;
/**
* Parse program parameters and remove all parameters
{
return VERSION_NUMERIC;
}
+
+void sylpheed_register_idle_function (void (*idle_func)(void))
+{
+ sylpheed_idle_function = idle_func;
+}
+
+void sylpheed_do_idle(void)
+{
+ if (sylpheed_idle_function != NULL)
+ sylpheed_idle_function();
+}
blob - f7a9b1bfd039b265bd231f721751059e758ebe34
blob + 8233def87ed7a30d6883f26fd57c2db88218e50d
--- src/common/sylpheed.h
+++ src/common/sylpheed.h
void sylpheed_done (void);
const gchar *sylpheed_get_startup_dir (void);
guint sylpheed_get_version (void);
+void sylpheed_register_idle_function (void (*idle_func)(void));
+void sylpheed_do_idle (void);
#endif /* SYLPHEED_H */
blob - 8d04300c5277409e68bc652768f5afee14bc4cb5
blob + bfa12ed34e6dd45173bc1cee9d3316258d5cdddd
--- src/main.c
+++ src/main.c
static MainWindow *static_mainwindow;
+void sylpheed_gtk_idle(void)
+{
+ while(gtk_events_pending())
+ gtk_main_iteration();
+}
+
int main(int argc, char *argv[])
{
gchar *userrc;
cmd.status_full_folders = NULL;
}
+ sylpheed_register_idle_function(sylpheed_gtk_idle);
+
prefs_toolbar_init();
plugin_load_all("GTK2");