I've created patch which may fix this (but I can't test it).

I don't know if Q_OS_BSD4 is the correct macro you may have to adjust that
the available macros are here http://doc.trolltech.com/4.5/qtglobal.html

Regards,
Roman

On Wed, 20 May 2009 09:16:54 +0200, Roman Jarosz <kedge...@gmail.com> wrote:

Other platforms are fine because there's ifdef for linux.
As you said FreeBSD should also have this the only difference is that
the tcpi_last_ack_recv and tcpi_last_data_sent in FreeBSD have
__tcpi_last_ack_recv and __tcpi_last_data_sent I don't know how to detect
FreeBSD but it should be possible with some ifdefs

Btw. I was googling for 3 hours and this is the only way which works on
linux.

Regards,
Roman

On Wed, 20 May 2009 07:17:37 +0200, Raphael Kubo da Costa <kub...@gmail.com> wrote:

Hello,

Commit 970289 seems to break compilation on non-Linux platforms -- I'm
not sure about Windows, but at least FreeBSD (most certainly OpenBSD
and NetBSD too) doesn't compile anymore because tcp_info seems to be
Linux-only and is being experimentally and partially added to FreeBSD.

I'm no networking code expert, but isn't there a way to make this more
cross-platform?

I am CC'ing kde-freebsd as well, but I don't know if all replies will
be sent to both lists.

Cheers,
Raphael

Index: libkopete/kopetesockettimeoutwatcher.cpp
===================================================================
--- libkopete/kopetesockettimeoutwatcher.cpp	(revision 970289)
+++ libkopete/kopetesockettimeoutwatcher.cpp	(working copy)
@@ -76,14 +76,21 @@
 		int info_length = sizeof(info);
 		if ( getsockopt( sDesc, SOL_TCP, TCP_INFO, (void*)&info, (socklen_t*)&info_length ) == 0 )
 		{
-			if ( info.tcpi_last_ack_recv >= info.tcpi_last_data_sent && (info.tcpi_last_ack_recv - info.tcpi_last_data_sent) > mTimeoutThreshold )
+#ifdef Q_OS_BSD4
+			quint32 lastAckReceived = info.__tcpi_last_ack_recv;
+			quint32 lastDataSent = info.__tcpi_last_data_sent;
+#else
+			quint32 lastAckReceived = info.tcpi_last_ack_recv;
+			quint32 lastDataSent = info.tcpi_last_data_sent;
+#endif
+			if ( lastAckReceived >= lastDataSent && (lastAckReceived - lastDataSent) > mTimeoutThreshold )
 			{
 				kWarning() << "Connection timeout for " << mSocket->peerAddress();
 				mAckCheckTimer->stop();
 				emit error( QAbstractSocket::RemoteHostClosedError );
 				mSocket->abort();
 			}
-			else if ( info.tcpi_last_ack_recv < info.tcpi_last_data_sent )
+			else if ( lastAckReceived < lastDataSent )
 			{
 				mAckCheckTimer->stop();
 			}
_______________________________________________
kde-freebsd mailing list
kde-freebsd@kde.org
https://mail.kde.org/mailman/listinfo/kde-freebsd
See also http://freebsd.kde.org/ for latest information

Reply via email to