Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > e548512dcc847653815f1b7adc710b15 > files > 30

libvmime07-0.7.1-4.fc13.src.rpm

Patch by Zarafa <http://www.zarafa.com/> - adds the TCP_NODELAY flag to vmime sockets. This should mak
the SMTP connection faster

--- libvmime-0.7.1/src/platforms/posix/posixSocket.cpp			2005-03-18 22:26:49.000000000 +0100
+++ libvmime-0.7.1/src/platforms/posix/posixSocket.cpp.socket-tcp	2009-03-27 10:51:06.405594549 +0100
@@ -25,6 +25,7 @@
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <netinet/in.h>
+#include <netinet/tcp.h>
 #include <netdb.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -59,6 +60,8 @@
 
 void posixSocket::connect(const vmime::string& address, const vmime::port_t port)
 {
+	int flag = 1;
+
 	// Close current connection, if any
 	if (m_desc != -1)
 	{
@@ -94,6 +97,8 @@
 	if (m_desc == -1)
 		throw vmime::exceptions::connection_error("Error while creating socket.");
 
+	::setsockopt(m_desc, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
+
 	// Start connection
 	if (::connect(m_desc, reinterpret_cast <sockaddr*>(&addr), sizeof(addr)) == -1)
 	{