]> Some of my projects - anidbudpclient.git/commitdiff
3 seconds is enough...
authorAPTX <mail@example.com>
Thu, 31 Dec 2009 19:52:33 +0000 (20:52 +0100)
committerAPTX <mail@example.com>
Thu, 31 Dec 2009 19:52:33 +0000 (20:52 +0100)
client.cpp

index f4693437ef8238972b0cda8157e910e26d12e6be..25f3ebccf737a557b3ab6fdd8b6e4328e8eaa344 100644 (file)
@@ -8,6 +8,7 @@
 #include <QCoreApplication>
 #include <QUdpSocket>
 #include <QTimer>
+#include <QRegExp>
 
 #include "rawcommand.h"
 #include "logoutcommand.h"
@@ -465,6 +466,45 @@ qDebug() << "COMPRESSED DATAGRAM = " << tmp;
                                .arg(senderPort)
                                .arg(reply);
 
+/*
+               // Check if it is a 6xx error.
+               {
+                       QRegExp rx("6[0-9]{2} ");
+                       if (rx.exactMatch(tmp.mid(0, 4)))
+                       {
+                       
+                               int replyCode = tmp.mid(0, 3).toInt();
+                               switch (replyCode)
+                               {
+                                       case INTERNAL_SERVER_ERROR:
+                                               m_error = ServerError;
+                                               m_errorString = tr("Internal Server Error");
+                                               emit connectionError();
+                                               goto endLoop;
+                                       break;
+                                       case ANIDB_OUT_OF_SERVICE:
+                                               m_error = ServerError;
+                                               m_errorString = tr("AniDB out of service");
+                                               emit connectionError();
+                                               goto endLoop;
+                                       break;
+                                       case SERVER_BUSY:
+                                               m_error = ServerError;
+                                               m_errorString = tr("Server busy. Try again later. Wait at least 30 minutes.");
+                                               emit connectionError();
+                                               goto endLoop;
+                                       default:
+                                               if (replyCode > 601 && replyCode < 700)
+                                               {
+                                                       qDebug() << QString("SERVER ERROR %1").arg(replyCode);
+                                               }
+                                               emit connectionError();
+                                       break;
+                               }
+                       }
+                       continue;
+               }
+*/
                QByteArray commandId = tmp.mid(0, 5);
 
                commandsTimedOut = 0;
@@ -540,6 +580,7 @@ qDebug() << "LOGIN FIRST required, authing";
                                {
                                        qDebug() << QString("SERVER ERROR %1").arg(replyCode);
                                }
+                               emit connectionError();
                        break;
                }
                // tag + space + replyCode + space = 5 + 1 + 3 + 1