]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add classic delay when reporting back failed authentication.
authorAndreas Öman <andreas@lonelycoder.com>
Mon, 29 Sep 2008 20:19:07 +0000 (20:19 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Mon, 29 Sep 2008 20:19:07 +0000 (20:19 +0000)
htsp.c

diff --git a/htsp.c b/htsp.c
index 9bdca9195bf56971e9019bd53521337cd14450e3..4beddd0514a29a3b1cd2dff489071510e3aaa808 100644 (file)
--- a/htsp.c
+++ b/htsp.c
@@ -502,6 +502,7 @@ htsp_read_loop(htsp_connection_t *htsp)
   const char *method, *username, *password;
 
   while(1) {
+  readmsg:
     if((r = htsp_read_message(htsp, &m, 0)) != 0)
       return r;
 
@@ -518,9 +519,18 @@ htsp_read_loop(htsp_connection_t *htsp)
                           (struct sockaddr *)htsp->htsp_peer,
                           htsp_methods[i].privmask)) {
 
-           reply = htsmsg_create();
+           pthread_mutex_unlock(&global_lock);
 
+           /* Classic authentication failed delay */
+           sleep(1); 
+           
+           reply = htsmsg_create();
            htsmsg_add_u32(reply, "_noaccess", 1);
+           htsp_reply(htsp, m, reply);
+
+           htsmsg_destroy(m);
+           goto readmsg;
+
          } else {
            reply = htsp_methods[i].fn(htsp, m);
          }