[PATCH] conn.c

"Rene Kluwen" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel,gmane.spam.detected
Message-ID <[email protected]>
Hereby I want to propose a patch in gwlib to add a function that would make
life a lot easier in smppbox.

 

== Rene
conn_shutdown2.patch (application/octet-stream, 1017 B)
Index: gwlib/conn.h
===================================================================
RCS file: /home/cvs/gateway/gwlib/conn.h,v
retrieving revision 1.36
diff -u -r1.36 conn.h
--- gwlib/conn.h	12 Jan 2009 16:46:53 -0000	1.36
+++ gwlib/conn.h	2 Aug 2010 14:26:08 -0000
@@ -346,3 +346,6 @@
 #endif /* HAVE_LIBSSL */
 
 int conn_get_id(Connection *conn);
+
+#define HAVE_SHUTDOWN_CONNECTION
+void shutdown_connection(Connection *conn);
Index: gwlib/conn.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/conn.c,v
retrieving revision 1.88
diff -u -r1.88 conn.c
--- gwlib/conn.c	12 Jan 2009 16:46:54 -0000	1.88
+++ gwlib/conn.c	2 Aug 2010 14:26:08 -0000
@@ -1474,3 +1474,12 @@
     else
 	return conn->fd;
 }
+
+/* Shut down connection conn */
+/* This is useful when you want to terminate a thread that is reading on the particular fd */
+void shutdown_connection(Connection *conn) {
+    if (conn == NULL) {
+	return;
+    }
+    shutdown(conn->fd, SHUT_RDWR);
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.