jigar-joshi / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

XmppClient::SignalStateChanged not called when socket connection fails. #151

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call XmppClient::DoLogin using an XmppSocket on a non-existing server.

What is the expected output? What do you see instead?

I would expect XmppClient::SignalStateChanged to be called to inform you that 
the connection was closed.

What version of the product are you using? On what operating system?

SSL Connection. Linux. Release 0.5.2.

Please provide any additional information below.

When the socket connection fails, XmppSocket::OnCloseEvent gets called. It 
calls XmppSocket::SignalCloseEvent.  Unfortunately, XmppClient is listening to 
AsyncSocket::SignalClosed, which never gets called.

As far as I can tell, it is an aberration to have XmppSocket::SignalCloseEvent, 
since the AsyncSocket base clase already provides AsyncSocket::SignalClosed.

If you change XmppSocket::OnCloseEvent to call the base class's SignalClosed, 
XmppClient correctly detects that the connection was lost, and reports a state 
change.

The following patch gets things working for me (but might break folks listening 
to XmppSocket::SignalCloseEvent):

diff -r e4224f1d078a 
stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.cc
--- a/stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.cc 
Fri Mar 25 10:20:00 2011 -0700
+++ b/stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.cc 
Fri Mar 25 13:49:43 2011 -0700
@@ -116,7 +116,7 @@
 }

 void XmppSocket::OnCloseEvent(talk_base::AsyncSocket * socket, int error) {
-  SignalCloseEvent(error);
+  SignalClosed();
 }

 #else  // USE_SSLSTREAM
diff -r e4224f1d078a 
stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.h
--- a/stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.h  
Fri Mar 25 10:20:00 2011 -0700
+++ b/stacks/texas_videoconf/jingle/libjingle/talk/examples/login/xmppsocket.h  
Fri Mar 25 13:49:43 2011 -0700
@@ -57,8 +57,6 @@
   virtual bool Close();
   virtual bool StartTls(const std::string & domainname);

-  sigslot::signal1<int> SignalCloseEvent;
-
 private:
 #ifndef USE_SSLSTREAM
   void OnReadEvent(talk_base::AsyncSocket * socket);

Original issue reported on code.google.com by bla...@suitabletech.com on 25 Mar 2011 at 8:50