Re: [kopete-devel] tcp_info and FreeBSD

2009-05-21 Thread Roman Jarosz
On Thu, 21 May 2009 16:46:17 +0200, Raphael Kubo da Costa  
kub...@gmail.com wrote:

 2009/5/20 Raphael Kubo da Costa kub...@gmail.com:
 2009/5/20 Roman Jarosz kedge...@gmail.com:
 Will it compile if you change the two Q_WS_X11 to Q_OS_LINUX (without  
 the
 patch)?
 Yes, it did compile now.
 Can I commit that?

I've already did that yesterday.

Roman
___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


Re: [kopete-devel] tcp_info and FreeBSD

2009-05-21 Thread Raphael Kubo da Costa
2009/5/21 Roman Jarosz kedge...@gmail.com:
 On Thu, 21 May 2009 16:46:17 +0200, Raphael Kubo da Costa
 kub...@gmail.com wrote:

 2009/5/20 Raphael Kubo da Costa kub...@gmail.com:
 2009/5/20 Roman Jarosz kedge...@gmail.com:
 Will it compile if you change the two Q_WS_X11 to Q_OS_LINUX (without
 the
 patch)?
 Yes, it did compile now.
 Can I commit that?

 I've already did that yesterday.
Oh, it must have been before I started watching the commits. Sorry ;)
___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


Re: [kopete-devel] tcp_info and FreeBSD

2009-05-20 Thread Roman Jarosz
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
___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


Re: [kopete-devel] tcp_info and FreeBSD

2009-05-20 Thread Roman Jarosz

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();
 			}
___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


Re: [kopete-devel] tcp_info and FreeBSD

2009-05-20 Thread Roman Jarosz
Will it compile if you change the two Q_WS_X11 to Q_OS_LINUX (without the  
patch)?

On Wed, 20 May 2009 14:58:01 +0200, Raphael Kubo da Costa  
kub...@gmail.com wrote:

 2009/5/20 Roman Jarosz kedge...@gmail.com:
 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
 Hi,

 According to  
 http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp.h?rev=1.43,
 that API/ABI for FreeBSD is unstable and also the fields padded with
 '__' are used to make room for omitted fields in case they are added
 later, so currently they aren't implemented.

 In this case, I think FreeBSD (and other BSDs I think, when I was
 googling I read NetBSD doesn't have tcp_info at all, but that may have
 changed) should not use this structure at all.

 Cheers,
 Raphael
 ___
 kopete-devel mailing list
 kopete-devel@kde.org
 https://mail.kde.org/mailman/listinfo/kopete-devel


___
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel