aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,