Просмотр исходного кода

fix bogus error return on timeout for gameserver connect

David Rose 22 лет назад
Родитель
Сommit
9b0507a4c6
3 измененных файлов с 27 добавлено и 2 удалено
  1. 10 0
      panda/src/downloader/httpChannel.I
  2. 16 2
      panda/src/downloader/httpChannel.cxx
  3. 1 0
      panda/src/downloader/httpChannel.h

+ 10 - 0
panda/src/downloader/httpChannel.I

@@ -847,3 +847,13 @@ is_download_complete() const {
   return (_download_dest != DD_none &&
   return (_download_dest != DD_none &&
           (_state == S_read_body || _state == S_read_trailer));
           (_state == S_read_body || _state == S_read_trailer));
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: HTTPChannel::StatusEntry::Constructor
+//       Access: Public
+//  Description: 
+////////////////////////////////////////////////////////////////////
+INLINE HTTPChannel::StatusEntry::
+StatusEntry() {
+  _status_code = SC_incomplete;
+}

+ 16 - 2
panda/src/downloader/httpChannel.cxx

@@ -745,17 +745,31 @@ reached_done_state() {
     // response; go back and find the best one.
     // response; go back and find the best one.
     if (!_status_list.empty()) {
     if (!_status_list.empty()) {
       _status_list.push_back(_status_entry);
       _status_list.push_back(_status_entry);
-      if (downloader_cat.is_spam()) {
-        downloader_cat.spam()
+      if (downloader_cat.is_debug()) {
+        downloader_cat.debug()
           << "Reexamining failure responses.\n";
           << "Reexamining failure responses.\n";
       }
       }
       size_t best_i = 0;
       size_t best_i = 0;
+      if (downloader_cat.is_debug()) {
+        downloader_cat.debug()
+          << "  " << 0 << ". " << _status_list[0]._status_code << " "
+          << _status_list[0]._status_string << "\n";
+      }
       for (size_t i = 1; i < _status_list.size(); i++) {
       for (size_t i = 1; i < _status_list.size(); i++) {
+        if (downloader_cat.is_debug()) {
+          downloader_cat.debug()
+            << "  " << i << ". " << _status_list[i]._status_code << " "
+            << _status_list[i]._status_string << "\n";
+        }
         if (more_useful_status_code(_status_list[i]._status_code, 
         if (more_useful_status_code(_status_list[i]._status_code, 
                                     _status_list[best_i]._status_code)) {
                                     _status_list[best_i]._status_code)) {
           best_i = i;
           best_i = i;
         }
         }
       }
       }
+      if (downloader_cat.is_debug()) {
+        downloader_cat.debug()
+          << "chose index " << best_i << ", above.\n";
+      }
       _status_entry = _status_list[best_i];
       _status_entry = _status_list[best_i];
       _status_list.clear();
       _status_list.clear();
     }
     }

+ 1 - 0
panda/src/downloader/httpChannel.h

@@ -281,6 +281,7 @@ public:
 private:
 private:
   class StatusEntry {
   class StatusEntry {
   public:
   public:
+    INLINE StatusEntry();
     int _status_code;
     int _status_code;
     string _status_string;
     string _status_string;
   };
   };