sync with 0.9.2cvs10

This commit is contained in:
Paul Mangan 2003-07-01 10:33:14 +00:00
parent c5a06a1223
commit 3929eea5c7
7 changed files with 92 additions and 5 deletions

View file

@ -1,3 +1,11 @@
2003-07-01
* src/socket.[ch]: added sock_has_pending_data() which returns TRUE
if socket has pending data.
* src/session.c: session_recv_msg(), session_recv_data(): check if
socket has pending data and call the callbacks immediately in that
case (fixes the hang at ESMTP EHLO on SSL).
2003-06-30
* src/socket.c: check return value in SSL functions.

View file

@ -1,3 +1,8 @@
2003-07-01 [paul] 0.9.0claws70
* sync with 0.9.2cvs10
see ChangeLog 2003-07-01
2003-06-30 [paul] 0.9.0claws69
* sync with 0.9.2cvs9

View file

@ -1,3 +1,11 @@
2003-07-01
* src/socket.[ch]: ソケットに未処理のデータが存在する場合 TRUE を
返す sock_has_pending_data() を追加。
* src/session.c: session_recv_msg(), session_recv_data(): ソケットに
未処理のデータがあるかどうかを調べ、ある場合はコールバックをすぐに
呼ぶようにした(SSL での ESMTP EHLO 時に固まるのを修正)。
2003-06-30
* src/socket.c: SSL 関数で戻り値をチェック。

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=claws69
EXTRA_VERSION=claws70
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target

View file

@ -42,6 +42,9 @@ static gint session_connect_cb (SockInfo *sock,
gpointer data);
static gint session_close (Session *session);
static gboolean session_read_msg_idle_cb (gpointer data);
static gboolean session_read_data_idle_cb (gpointer data);
static gboolean session_read_msg_cb (GIOChannel *source,
GIOCondition condition,
gpointer data);
@ -313,12 +316,29 @@ gint session_recv_msg(Session *session)
session->state = SESSION_RECV;
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_msg_cb, session);
if (sock_has_pending_data(session->sock))
g_idle_add(session_read_msg_idle_cb, session);
else
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_msg_cb, session);
return 0;
}
static gboolean session_read_msg_idle_cb(gpointer data)
{
Session *session = SESSION(data);
gboolean ret;
ret = session_read_msg_cb(session->sock_ch, G_IO_IN, data);
if (ret == TRUE)
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_msg_cb, session);
return FALSE;
}
/*!
*\brief parent (child?): send data to other process
*
@ -367,12 +387,29 @@ gint session_recv_data(Session *session, guint size, const gchar *terminator)
session->read_data_terminator = g_strdup(terminator);
gettimeofday(&session->tv_prev, NULL);
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_data_cb, session);
if (sock_has_pending_data(session->sock))
g_idle_add(session_read_data_idle_cb, session);
else
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_data_cb, session);
return 0;
}
static gboolean session_read_data_idle_cb(gpointer data)
{
Session *session = SESSION(data);
gboolean ret;
ret = session_read_data_cb(session->sock_ch, G_IO_IN, data);
if (ret == TRUE)
session->io_tag = g_io_add_watch(session->sock_ch, G_IO_IN,
session_read_data_cb, session);
return FALSE;
}
static gboolean session_read_msg_cb(GIOChannel *source, GIOCondition condition,
gpointer data)
{
@ -478,6 +515,8 @@ static gboolean session_read_data_cb(GIOChannel *source, GIOCondition condition,
}
}
g_print("session_read_data_cb(): read %d bytes\n", read_len);
data_buf = session->read_data_buf;
g_byte_array_append(data_buf, buf, read_len);

View file

@ -251,6 +251,31 @@ gboolean sock_is_nonblocking_mode(SockInfo *sock)
return is_nonblocking_mode(sock->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;

View file

@ -69,6 +69,8 @@ gint sock_set_io_timeout (guint sec);
gint sock_set_nonblocking_mode (SockInfo *sock, gboolean nonblock);
gboolean sock_is_nonblocking_mode (SockInfo *sock);
gboolean sock_has_pending_data (SockInfo *sock);
struct hostent *my_gethostbyname (const gchar *hostname);
SockInfo *sock_connect (const gchar *hostname, gushort port);