aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-01-16 07:31:40 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-16 07:31:40 +0800
commitffe3a796eda21cb75c6e0c6678b5bb20fb49c79f (patch)
tree8a709193f9d99faf0ce6e1c30825c43dc98fd8dd /camel
parentfeccdbccfbf9fa1c4d2f8b4d50da3a764d475089 (diff)
downloadgsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar.gz
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar.bz2
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar.lz
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar.xz
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.tar.zst
gsoc2013-evolution-ffe3a796eda21cb75c6e0c6678b5bb20fb49c79f.zip
Updated to be able to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.
2001-01-15 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-raw.c (stream_getsockopt): Updated to be able to get the CAMEL_SOCKOPT_NONBLOCKING socket opt. (stream_setsockopt): Updated to be able to set the CAMEL_SOCKOPT_NONBLOCKING socket opt. svn path=/trunk/; revision=7519
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog11
-rw-r--r--camel/camel-tcp-stream-raw.c26
2 files changed, 35 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 43e7245117..b0766558b1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,7 +1,14 @@
+2001-01-15 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-raw.c (stream_getsockopt): Updated to be able
+ to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.
+ (stream_setsockopt): Updated to be able to set the
+ CAMEL_SOCKOPT_NONBLOCKING socket opt.
+
2001-01-15 Peter Williams <peterw@ximian.com>
- * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Lock around the
- imap_rescan, which needs it.
+ * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Lock
+ around the imap_rescan, which needs it.
2001-01-15 Not Zed <NotZed@Ximian.com>
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 5c884fd136..53722034de 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -247,6 +247,17 @@ stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data)
if ((optname = get_sockopt_optname (data)) == -1)
return -1;
+ if (data->option == CAMEL_SOCKOPT_NONBLOCKING) {
+ long flags;
+
+ if (fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_GETFL, &flags) == -1)
+ return -1;
+
+ data->value.non_blocking = flags & O_NONBLOCK;
+
+ return 0;
+ }
+
return getsockopt (((CamelTcpStreamRaw *)stream)->sockfd,
get_sockopt_level (data),
optname,
@@ -262,6 +273,21 @@ stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
if ((optname = get_sockopt_optname (data)) == -1)
return -1;
+ if (data->option == CAMEL_SOCKOPT_NONBLOCKING) {
+ guint32 flags, set;
+
+ if (fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_GETFL, &flags) == -1)
+ return -1;
+
+ set = data->value.non_blocking ? 1 : 0;
+ flags = (flags & ~O_NONBLOCK) | (set & O_NONBLOCK);
+
+ if (fcntl (((CamelTcpStreamRaw *)stream)->sockfd, F_SETFL, flags) == -1)
+ return -1;
+
+ return 0;
+ }
+
return setsockopt (((CamelTcpStreamRaw *)stream)->sockfd,
get_sockopt_level (data),
optname,