[pan2/testing: 217/279] a few fixes, should go smoothly now...



commit b6978889d7d0b823108e6a9c2baa0b07621ac2f9
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Sun Oct 23 00:24:52 2011 +0200

    a few fixes, should go smoothly now...

 pan/gui/post-ui.cc               |   13 ++++---------
 pan/tasks/socket-impl-gio.cc     |    1 -
 pan/tasks/socket-impl-openssl.cc |   19 +++++++++----------
 3 files changed, 13 insertions(+), 20 deletions(-)
---
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index d4a516d..c97cd28 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -2884,14 +2884,10 @@ PostUI :: select_parts ()
 
   if (!_upload_ptr) return;
 
-  int new_parts = get_total_parts(_upload_ptr->_filename.c_str());
-  if (_total_parts != new_parts)
-  {
-    _upload_ptr->_wanted.clear();
-    for (int i=1;i<=new_parts;++i)
-      _upload_ptr->_wanted.insert(i);
-  }
-  _total_parts = new_parts;
+  _total_parts = get_total_parts(_upload_ptr->_filename.c_str());
+//  _upload_ptr->_wanted.clear();
+//  for (int i=1;i<=_total_parts;++i)
+//    _upload_ptr->_wanted.insert(i);
 
   GtkWidget * w;
   GtkTreeIter iter;
@@ -3155,7 +3151,6 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
              a.xref.insert (profile.posting_server, *git,0);
 
           struct stat sb;
-          // yEnc encoding is the default, user can change that with popup-menu
           ui.total = get_total_parts((const char*)cur->data);
           TaskUpload* tmp = new TaskUpload(std::string((const char*)cur->data),
                             profile.posting_server, _cache, a, ui, msg);
diff --git a/pan/tasks/socket-impl-gio.cc b/pan/tasks/socket-impl-gio.cc
index 95f4993..d9cc962 100644
--- a/pan/tasks/socket-impl-gio.cc
+++ b/pan/tasks/socket-impl-gio.cc
@@ -280,7 +280,6 @@ bool
 GIOChannelSocket :: open (const StringView& address, int port, std::string& setme_err)
 {
   _host.assign (address.str, address.len);
-  std::cerr<<"open normal "<<address<<":"<<port<<std::endl;
   _channel = create_channel (address, port, setme_err);
   return _channel != 0;
 }
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 2c8f544..e404f5b 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -265,7 +265,7 @@ namespace
     unsigned int verify:1;
   } GIOSSLChannel;
 
-  static pthread_mutex_t *lock_cs;
+  pthread_mutex_t *lock_cs;
 
   void gio_lock(int mode, int type, const char *file, int line)
   {
@@ -293,7 +293,7 @@ namespace
     {
       for (int i=0; i<CRYPTO_num_locks(); i++)
         if (&lock_cs[i]) pthread_mutex_destroy(&lock_cs[i]);
-      free(lock_cs);
+      if (lock_cs) free(lock_cs);
     }
   }
 
@@ -360,6 +360,7 @@ GIOChannelSocketSSL :: ~GIOChannelSocketSSL ()
   {
     g_io_channel_shutdown (_channel, true, 0);
     ssl_free(_channel);
+    g_string_free(_channel->read_buf,true);
     _channel = 0;
   }
 
@@ -452,7 +453,7 @@ namespace
 
     ret = chan->verify ? ssl_verify(chan->ssl, chan->ctx, cert) : true;
     X509_free(cert);
-    return ret ? 0 : -1;
+    return ret ? true : false;
   }
 
   GIOStatus ssl_read(GIOChannel *handle, gchar *buf, gsize len, gsize *ret, GError **gerr)
@@ -609,7 +610,6 @@ GIOChannelSocketSSL :: do_read ()
         increment_xfer_byte_count ((int)ret);
         _partial_read.append (_channel->read_buf->str, _channel->read_buf->len);
         g_string_set_size (_channel->read_buf, 0);
-//        std::cerr<<"partial read : "<<_partial_read<<"("<<_channel->read_buf->len<<"/"<<_partial_read.size()<<")\n";
       }
       return IO_READ;
     }
@@ -803,8 +803,6 @@ GIOChannelSocketSSL :: ssl_get_iochannel(GIOChannel *handle, gboolean verify)
 		return 0;
 	}
 
-	thread_setup();
-
 	chan = g_new0(GIOSSLChannel, 1);
 	chan->fd = fd;
 	chan->giochan = handle;
@@ -817,10 +815,11 @@ GIOChannelSocketSSL :: ssl_get_iochannel(GIOChannel *handle, gboolean verify)
 	g_io_channel_init(gchan);
   gchan->read_buf = g_string_sized_new(4096*128);
 
-  /// FIXME : callback
   if (ssl_handshake(gchan))
+  {
+    thread_setup();
+    return gchan;
+  }
+  return 0;
 
-//  std::cerr<<"handshake success!\n";
-
-	return gchan;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]