[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/kresources/groupwise
From:       Will Stephenson <wstephenson () kde ! org>
Date:       2007-08-01 14:34:25
Message-ID: 1185978865.919818.18145.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 695171 by wstephens:

Don't crash if hostname or port are wrong

 M  +3 -1      kabc_resourcegroupwise.cpp  
 M  +1 -1      kabc_resourcegroupwise.h  
 M  +23 -6     soap/groupwiseserver.cpp  


--- branches/KDE/3.5/kdepim/kresources/groupwise/kabc_resourcegroupwise.cpp #695170:695171
@@ -648,7 +648,9 @@
       return InSync;
     }
   }
-  
+  else
+    emit loadingError( this, mServer->errorText() );
+
   if ( storedFirstSequence == 0 || storedLastSequence == 0 )
   {
     kdDebug() << "  Fallthrough - no fetched SAB exists yet, refresh" << endl;
--- branches/KDE/3.5/kdepim/kresources/groupwise/kabc_resourcegroupwise.h #695170:695171
@@ -73,7 +73,7 @@
     bool asyncLoad();
     bool save( Ticket * );
     bool asyncSave( Ticket * );
-    enum SABState { Stale, InSync, RefreshNeeded };
+    enum SABState { Error, Stale, InSync, RefreshNeeded };
 
     /**
      * Clears the cached data, in memory and on disk
--- branches/KDE/3.5/kdepim/kresources/groupwise/soap/groupwiseserver.cpp #695170:695171
@@ -46,6 +46,7 @@
 #include "incidenceconverter.h"
 #include "kcal_resourcegroupwise.h"
 #include "soapH.h"
+#include "stdsoap2.h"
 #include "soapGroupWiseBindingProxy.h"
 #include <stdlib.h>
 #include <stdio.h>
@@ -99,7 +100,7 @@
   return (*it)->gSoapReceiveCallback( soap, s, n );
 }
 
-int GroupwiseServer::gSoapOpen( struct soap *, const char *,
+int GroupwiseServer::gSoapOpen( struct soap *soap, const char *,
   const char *host, int port )
 {
 //  kdDebug() << "GroupwiseServer::gSoapOpen()" << endl;
@@ -124,8 +125,18 @@
   m_sock->setSocketFlags( KExtendedSocket::inetSocket );
 
   m_sock->setAddress( host, port );
-  m_sock->lookup();
-  int rc = m_sock->connect();
+  int rc = m_sock->lookup();
+  if (rc != 0 ) {
+    kdError() << "gSoapOpen: lookup of " << host << " failed " << rc << endl;
+    QString errorMessage;
+    errorMessage = QString::fromLatin1( strerror( errno ) );
+    perror( 0 );
+    soap->error = SOAP_TCP_ERROR;
+    mErrorText = i18n("Connect failed: %1.").arg( errorMessage );
+    return SOAP_INVALID_SOCKET;
+  }
+
+  rc = m_sock->connect();
   if ( rc != 0 ) {
     kdError() << "gSoapOpen: connect failed " << rc << endl;
     QString errorMessage;
@@ -133,12 +144,14 @@
       errorMessage = QString::fromLatin1( strerror( errno ) );
       perror( 0 );
     }
+	//set the soap struct's error here!
     else {
       if ( rc == -3 )
         errorMessage = QString::fromLatin1( "Connection timed out.  Check host and port number" );
     }
     mErrorText = i18n("Connect failed: %1.").arg( errorMessage );
-    return SOAP_INVALID_SOCKET;
+    soap->error =SOAP_TCP_ERROR;
+   return SOAP_INVALID_SOCKET;
   }
   m_sock->enableRead( true );
   m_sock->enableWrite( true );
@@ -165,17 +178,19 @@
    return SOAP_OK;
 }
 
-int GroupwiseServer::gSoapSendCallback( struct soap *, const char *s, size_t n )
+int GroupwiseServer::gSoapSendCallback( struct soap * soap, const char *s, size_t n )
 {
 //  kdDebug() << "GroupwiseServer::gSoapSendCallback()" << endl;
 
   if ( !m_sock ) {
     kdError() << "no open connection" << endl;
+    soap->error = SOAP_TCP_ERROR;
     return SOAP_TCP_ERROR;
   }
   if ( mError ) {
     kdError() << "SSL is in error state." << endl;
-    return SOAP_SSL_ERROR;
+     soap->error = SOAP_SSL_ERROR;
+     return SOAP_SSL_ERROR;
   }
 
   if ( getenv("DEBUG_GW_RESOURCE") ) {
@@ -194,6 +209,7 @@
     if ( ret < 0 ) {
       kdError() << "Send failed: " << strerror( m_sock->systemError() )
         << " " << m_sock->socketStatus() << " " << m_sock->fd() << endl;
+      soap->error = SOAP_TCP_ERROR;
       return SOAP_TCP_ERROR;
     }
     n -= ret;
@@ -202,6 +218,7 @@
   if ( n !=0 ) {
     kdError() << "Send failed: " << strerror( m_sock->systemError() )
       << " " << m_sock->socketStatus() << " " << m_sock->fd() << endl;
+    soap->error = SOAP_TCP_ERROR;
   }
 
   m_sock->flush();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic