svn commit: samba r22960 - in branches/SAMBA_4_0/source/lib/socket: .

tridge at samba.org tridge at samba.org
Thu May 17 02:19:29 GMT 2007


Author: tridge
Date: 2007-05-17 02:19:28 +0000 (Thu, 17 May 2007)
New Revision: 22960

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22960

Log:

added a SOCKET_FLAG_NOCLOSE to allow us to tell the socket layer that
we will handle the close of the socket

Modified:
   branches/SAMBA_4_0/source/lib/socket/socket.c
   branches/SAMBA_4_0/source/lib/socket/socket.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/socket/socket.c
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket.c	2007-05-17 02:18:29 UTC (rev 22959)
+++ branches/SAMBA_4_0/source/lib/socket/socket.c	2007-05-17 02:19:28 UTC (rev 22960)
@@ -30,7 +30,8 @@
 */
 static int socket_destructor(struct socket_context *sock)
 {
-	if (sock->ops->fn_close) {
+	if (sock->ops->fn_close && 
+	    !(sock->flags & SOCKET_FLAG_NOCLOSE)) {
 		sock->ops->fn_close(sock);
 	}
 	return 0;
@@ -547,3 +548,10 @@
 	talloc_free(options_list);
 }
 
+/*
+  set some flags on a socket 
+ */
+void socket_set_flags(struct socket_context *sock, unsigned flags)
+{
+	sock->flags |= flags;
+}

Modified: branches/SAMBA_4_0/source/lib/socket/socket.h
===================================================================
--- branches/SAMBA_4_0/source/lib/socket/socket.h	2007-05-17 02:18:29 UTC (rev 22959)
+++ branches/SAMBA_4_0/source/lib/socket/socket.h	2007-05-17 02:19:28 UTC (rev 22960)
@@ -109,7 +109,9 @@
 					     * is encrypting data.
 					     * This modifies the
 					     * TESTNONBLOCK case */
+#define SOCKET_FLAG_NOCLOSE      0x00000010 /* don't auto-close on free */
 
+
 struct socket_context {
 	enum socket_type type;
 	enum socket_state state;
@@ -196,5 +198,6 @@
 			      struct socket_context **result,
 			      uint16_t *port);
 void set_socket_options(int fd, const char *options);
+void socket_set_flags(struct socket_context *socket, unsigned flags);
 
 #endif /* _SAMBA_SOCKET_H */



More information about the samba-cvs mailing list