+  HandyCache форум
|-+  Главная категория» English forum» request function connections number
Имя пользователя:
Пароль:
Страниц: [1]   Вниз
  Отправить эту тему    Печать  
Автор Тема: request function connections number  (Прочитано 2944 раз)
0 Пользователей и 1 Гость смотрят эту тему.
reges007
Новичок
*

Репутация: +0/-0
Offline Offline

Сообщений: 29


« : 11 января 2015, 07:57:10 »

by default handycache function connections number only work with get_users_stat
is it possible to add new function connections number for hc.url ?

thank's
Сообщить модератору   Записан
mai62
Автор HC
*****

Репутация: +226/-4
Offline Offline

Сообщений: 6383


« Ответ #1 : 11 января 2015, 17:39:17 »

Usually for loading of URL used one connection. Or I didn't understand something?
Сообщить модератору   Записан
reges007
Новичок
*

Репутация: +0/-0
Offline Offline

Сообщений: 29


« Ответ #2 : 11 января 2015, 20:23:46 »

you are right, but what I mean is
if the same url and load queue as use download manager
I want to limit the number of active connections to receive specific url, not the total active connection by user


other samples
I want to restrict a user open two tabs open youtube page
if one tab has to load the video and the other tabs video url will disconnect/refuse

my extension
Код:
--[[ <HCExtension>
@name          limit
@author        reges007
@version       1
@description   only one accept url at the same time
@rule          googlevideo.com/videoplayback
@event         BeforeRequestHeaderSend/Request

</HCExtension> ]]

function Request()
        local l = hc.get_users_stat('local')
        local lnk = re.find(hc.url, [[googlevideo.com/videoplayback]])
        if hc.method == 'GET' and lnk and l and l['local'].connections_number > 1 then
        hc.monitor_string = 'disconnect'
        hc.client_disconnect()
    end
end



this will immediately disconnect because user local is already/still active connection one or more

for it I asked is it possible function .connection_number for the url connection active?
Сообщить модератору   Записан
Страниц: [1]   Вверх
  Отправить эту тему    Печать  

 
Перейти в: