[kopete-devel] kopete Yahoo connect failure

View: New views
1 Messages — Rating Filter:   Alert me  

[kopete-devel] kopete Yahoo connect failure

by Sverre Froyen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The following patch allows kopete to connect to Yahoo Messenger when used on
NetBSD and possibly other BSD type systems.

Here's some background (from my earlier message to the list):

Ever since KDE4 I have been unable to connect to my Yahoo IM account with
kopete.  I always get a "There was an error while connecting <user name> to
the Yahoo server. Error message: 17 remote host closed connection" error
message.  A packet trace shows that kopete does not even attempt to
authenticate (and that it is the client that closes the connection).  The
total set of packets is

client -> yahoo: SYN
yahoo -> client: SYN, ACK
client -> yahoo: ACK
client -> yahoo: FIN, ACK
yahoo -> client: ACK
yahoo -> client: FIN, ACK
client -> yahoo: ACK

After some investigation, I discovered that the root cause of the failure is
that the Yahoo connection socket has its mode set to read-only.  

When the socket is set up by KBufferedSocket, the default mode is read-only.  
Later the method connect is called with the hostname and port.  At this point.
the KBufferedSocket instance is changed to to read-write but the internal
socket device (returned by the socketDevice() call) is still read-only.  The
reason for that is that the call to KSocketDevice::connect follows the path

if (kde_connect(m_sockfd, address.address(), address.length()) == -1)
     {
       if (errno == EISCONN)
         return true;  <--- we end up here!!!

bypassing the open call (at the bottom of the function) that sets the mode to
read-write.

The following patch corrects this

--- kdecore/network/k3socketdevice.cpp.orig 2009-09-24 09:21:38.000000000
-0600
+++ kdecore/network/k3socketdevice.cpp 2009-09-24 09:23:15.000000000 -0600
@@ -352,9 +352,13 @@ bool KSocketDevice::connect(const KResol
   if (kde_connect(m_sockfd, address.address(), address.length()) == -1)
     {
       if (errno == EISCONN)
- return true; // we're already connected
+ {
+  KActiveSocketBase::open(Unbuffered | mode);
+  return true; // we're already connected
+ }
       else if (errno == EALREADY || errno == EINPROGRESS)
  {
+  KActiveSocketBase::open(Unbuffered | mode);
   setError(InProgress);
   return true;
  }

Adding the open call in the "else if" clause is not necessary to get kopete
working but seemed reasonable.

Regards,
Sverre

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