g_return_if_fail(session->destroy != NULL);
debug_print("session: session_destroy()\n");
+
session_close(session);
session->destroy(session);
g_free(session->server);
/* this should always succeed */
if (read_len < 0) {
- switch (errno) {
- case EAGAIN:
- return TRUE;
- default:
- g_warning("sock_read: %s\n", g_strerror(errno));
- session->state = SESSION_ERROR;
- return FALSE;
- }
+ g_warning("sock_read: %s\n", g_strerror(errno));
+ session->state = SESSION_ERROR;
+ return FALSE;
}
buf[read_len] = '\0';
SockInfo *sock = (SockInfo *)source_data;
struct timeval timeout = {0, 0};
fd_set fds;
+ GIOCondition condition = sock->condition;
#if USE_OPENSSL
if (sock->ssl) {
- if (sock->condition & G_IO_IN) {
- if (SSL_pending(sock->ssl) > 0) {
- g_print("SSL has pending data\n");
+ if (condition & G_IO_IN) {
+ if (SSL_pending(sock->ssl) > 0)
return TRUE;
- }
+ if (SSL_want_write(sock->ssl))
+ condition |= G_IO_OUT;
+ }
+
+ if (condition & G_IO_OUT) {
+ if (SSL_want_read(sock->ssl))
+ condition |= G_IO_IN;
}
}
#endif
FD_SET(sock->sock, &fds);
select(sock->sock + 1,
- (sock->condition & G_IO_IN) ? &fds : NULL,
- (sock->condition & G_IO_OUT) ? &fds : NULL,
+ (condition & G_IO_IN) ? &fds : NULL,
+ (condition & G_IO_OUT) ? &fds : NULL,
NULL, &timeout);
return FD_ISSET(sock->sock, &fds) != 0;
return g_io_add_watch(sock->sock_ch, condition, sock_watch_cb, sock);
}
-gboolean sock_has_pending_data(SockInfo *sock)
-{
- struct timeval timeout = {0, 0};
- fd_set fds;
-
-#if USE_OPENSSL
- if (sock->ssl) {
- if (SSL_pending(sock->ssl) > 0)
- g_print("socket has pending data\n");
-
- return SSL_pending(sock->ssl) > 0;
- }
-#endif
-
- FD_ZERO(&fds);
- FD_SET(sock->sock, &fds);
-
- select(sock->sock + 1, &fds, NULL, NULL, &timeout);
-
- if (FD_ISSET(sock->sock, &fds))
- g_print("socket has pending data\n");
-
- return FD_ISSET(sock->sock, &fds);
-}
-
static gint fd_check_io(gint fd, GIOCondition cond)
{
struct timeval timeout;
case SSL_ERROR_NONE:
return ret;
case SSL_ERROR_WANT_READ:
- g_print("ssl_read(): SSL_ERROR_WANT_READ\n");
- errno = EAGAIN;
- return -1;
case SSL_ERROR_WANT_WRITE:
- g_print("ssl_read(): SSL_ERROR_WANT_WRITE\n");
errno = EAGAIN;
return -1;
default:
case SSL_ERROR_NONE:
return ret;
case SSL_ERROR_WANT_READ:
- g_print("ssl_write(): SSL_ERROR_WANT_READ\n");
- errno = EAGAIN;
- return -1;
case SSL_ERROR_WANT_WRITE:
- g_print("ssl_write(): SSL_ERROR_WANT_WRITE\n");
errno = EAGAIN;
return -1;
default:
case SSL_ERROR_NONE:
return ret;
case SSL_ERROR_WANT_READ:
- g_print("ssl_peek(): SSL_ERROR_WANT_READ\n");
- errno = EAGAIN;
- return -1;
case SSL_ERROR_WANT_WRITE:
- g_print("ssl_peek(): SSL_ERROR_WANT_WRITE\n");
errno = EAGAIN;
return -1;
default:
#include "procheader.h"
#include "account.h"
#include "progressdialog.h"
+#include "statusbar.h"
#include "inputdialog.h"
#include "alertpanel.h"
#include "manage_window.h"
#include "utils.h"
#include "gtkutils.h"
-#include "statusbar.h"
#include "inc.h"
#include "log.h"
case SMTP_HELO:
g_snprintf(buf, sizeof(buf), _("Sending HELO..."));
state_str = _("Authenticating");
+ statusbar_print_all(_("Sending message..."));
break;
case SMTP_EHLO:
g_snprintf(buf, sizeof(buf), _("Sending EHLO..."));
state_str = _("Authenticating");
+ statusbar_print_all(_("Sending message..."));
break;
case SMTP_AUTH:
g_snprintf(buf, sizeof(buf), _("Authenticating..."));