Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. diff --git a/Distribution/doc/html/oscam.server.5.html b/Distribution/doc/html/oscam.server.5.html
  2. index 9801708..78e1279 100644
  3. --- a/Distribution/doc/html/oscam.server.5.html
  4. +++ b/Distribution/doc/html/oscam.server.5.html
  5. @@ -789,6 +789,13 @@ reader assignement to service group for channels which may never be blocked by t
  6.  
  7. <P>
  8.  
  9. +<B>lb_priority_services</B> = <B>&lt;services&gt;,&lt;services&gt;...</B>
  10. +<DL COMPACT><DT><DD>
  11. +reader assignement to service group for channels which are always tried regardless of the load balacing status, default=none
  12. +</DL>
  13. +
  14. +<P>
  15. +
  16. <B>lb_weight</B> = <B>weight</B>
  17. <DL COMPACT><DT><DD>
  18. the higher the value the higher the probability for reader selection in load balacing mode, default:100
  19. diff --git a/Distribution/doc/man/oscam.server.5 b/Distribution/doc/man/oscam.server.5
  20. index 53e8acf..9ab816a 100644
  21. --- a/Distribution/doc/man/oscam.server.5
  22. +++ b/Distribution/doc/man/oscam.server.5
  23. @@ -608,6 +608,11 @@ use this reader as local in loadbalancer's reader selection, default:none
  24. reader assignement to service group for channels which may never be blocked by the loadbalancer to the reader , default=none
  25. .RE
  26. .PP
  27. +\fBlb_priority_services\fP = \fB<services>,<services>...\fP
  28. +.RS 3n
  29. +reader assignement to service group for channels which are always tried regardless of the load balacing status , default=none
  30. +.RE
  31. +.PP
  32. \fBlb_weight\fP = \fBweight\fP
  33. .RS 3n
  34. the higher the value the higher the probability for reader selection in load balacing mode, default:100
  35. diff --git a/Distribution/doc/txt/oscam.server.txt b/Distribution/doc/txt/oscam.server.txt
  36. index 545cc25..99bb51a 100644
  37. --- a/Distribution/doc/txt/oscam.server.txt
  38. +++ b/Distribution/doc/txt/oscam.server.txt
  39. @@ -447,6 +447,10 @@ DESCRIPTIONS
  40. reader assignement to service group for channels which may never be blocked by the loadbalancer to the reader ,
  41. default=none
  42.  
  43. + lb_whitelist_services = <services>,<services>...
  44. + reader assignement to service group for channels which are always tried regardless of the load balacing status ,
  45. + default=none
  46. +
  47. lb_weight = weight
  48. the higher the value the higher the probability for reader selection in load balacing mode, default:100
  49.  
  50. diff --git a/globals.h b/globals.h
  51. index 65ba525..2fb0990 100644
  52. --- a/globals.h
  53. +++ b/globals.h
  54. @@ -1469,6 +1469,7 @@ struct s_reader //contains device info, read
  55. int32_t atrlen;
  56. SIDTABS sidtabs;
  57. SIDTABS lb_sidtabs;
  58. + SIDTABS lb_prio_sidtabs;
  59. uchar hexserial[8];
  60. int32_t nprov;
  61. uchar prid[CS_MAXPROV][8];
  62. diff --git a/module-stat.c b/module-stat.c
  63. index 9754e41..76a4e4f 100644
  64. --- a/module-stat.c
  65. +++ b/module-stat.c
  66. @@ -1441,6 +1441,13 @@ void stat_get_best_reader(ECM_REQUEST *er)
  67. { current = current - 1; } //so when all reaches retrylimit (all have lb_value=1000) or all have same current, it prioritizes the one with s->time_avg<=retrylimit! This avoid a loop!
  68. }
  69.  
  70. + //Check Priority flag
  71. + if (has_lb_prio_srvid(rdr, er))
  72. + {
  73. + cs_log_dbg(D_LB, "loadbalancer: reader %s has lb_priority set on this srvid", rdr->label);
  74. + current = -123;
  75. + }
  76. +
  77. break;
  78. }
  79.  
  80. @@ -1453,7 +1460,7 @@ void stat_get_best_reader(ECM_REQUEST *er)
  81. if (cl && cl->pending)
  82. current=current*cl->pending;
  83. */
  84. - if(current < 1)
  85. + if(current < 1 && current != -123)
  86. { current = 1; }
  87. }
  88.  
  89. @@ -1495,6 +1502,9 @@ void stat_get_best_reader(ECM_REQUEST *er)
  90.  
  91. if(ea->value && (!best || ea->value < best->value))
  92. { best = ea; }
  93. +
  94. + if(ea->value == -123)
  95. + { best = ea; break;}
  96. }
  97. if(!best)
  98. { break; }
  99. diff --git a/module-webif.c b/module-webif.c
  100. index ae86e01..23419c0 100644
  101. --- a/module-webif.c
  102. +++ b/module-webif.c
  103. @@ -1778,6 +1778,7 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  104. // inactivate_reader(rdr); //Stop reader before reinitialization
  105. char servicelabels[1024] = "";
  106. char servicelabelslb[1024] = "";
  107. + char servicelabelslbprio[1024] = "";
  108.  
  109. for(i = 0; i < (*params).paramcount; ++i)
  110. {
  111. @@ -1787,6 +1788,8 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  112. { snprintf(servicelabels + strlen(servicelabels), sizeof(servicelabels) - strlen(servicelabels), "%s,", (*params).values[i]); }
  113. else if(!strcmp((*params).params[i], "lb_whitelist_services"))
  114. { snprintf(servicelabelslb + strlen(servicelabelslb), sizeof(servicelabelslb) - strlen(servicelabelslb), "%s,", (*params).values[i]); }
  115. + else if(!strcmp((*params).params[i], "lb_priority_services"))
  116. + { snprintf(servicelabelslbprio + strlen(servicelabelslbprio), sizeof(servicelabelslbprio) - strlen(servicelabelslbprio), "%s,", (*params).values[i]); }
  117. else
  118. /*if(strlen((*params).values[i]) > 0)*/
  119. { chk_reader((*params).params[i], (*params).values[i], rdr); }
  120. @@ -1795,6 +1798,7 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  121. }
  122. chk_reader("services", servicelabels, rdr);
  123. chk_reader("lb_whitelist_services", servicelabelslb, rdr);
  124. + chk_reader("lb_priority_services", servicelabelslbprio, rdr);
  125.  
  126. if(is_network_reader(rdr)) //physical readers make trouble if re-started
  127. {
  128. @@ -2205,6 +2209,9 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  129. if(rdr->lb_sidtabs.ok & ((SIDTABBITS)1 << i)) { tpl_addVar(vars, TPLADD, "CHECKED", "checked"); }
  130. else { tpl_addVar(vars, TPLADD, "CHECKED", ""); }
  131. tpl_addVar(vars, TPLAPPEND, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDLBOKBIT"));
  132. + if(rdr->lb_prio_sidtabs.ok & ((SIDTABBITS)1 << i)) { tpl_addVar(vars, TPLADD, "CHECKED", "checked"); }
  133. + else { tpl_addVar(vars, TPLADD, "CHECKED", ""); }
  134. + tpl_addVar(vars, TPLAPPEND, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDLBPRIOOKBIT"));
  135. sidtab = sidtab->next;
  136. i++;
  137. }
  138. diff --git a/oscam-chk.c b/oscam-chk.c
  139. index 33f3b36..df29f97 100644
  140. --- a/oscam-chk.c
  141. +++ b/oscam-chk.c
  142. @@ -175,6 +175,20 @@ int32_t has_lb_srvid(struct s_client *cl, ECM_REQUEST *er)
  143. return 0;
  144. }
  145.  
  146. +int32_t has_lb_prio_srvid(struct s_reader *rdr, ECM_REQUEST *er)
  147. +{
  148. + if(!rdr->lb_prio_sidtabs.ok)
  149. + { return 0; }
  150. +
  151. + int32_t nr;
  152. + SIDTAB *sidtab;
  153. +
  154. + for(nr = 0, sidtab = cfg.sidtab; sidtab; sidtab = sidtab->next, nr++)
  155. + if((rdr->lb_prio_sidtabs.ok & ((SIDTABBITS)1 << nr)) &&
  156. + (chk_srvid_match(er, sidtab)))
  157. + { return 1; }
  158. + return 0;
  159. +}
  160.  
  161. int32_t chk_srvid_match_by_caid_prov(uint16_t caid, uint32_t provid, SIDTAB *sidtab)
  162. {
  163. diff --git a/oscam-chk.h b/oscam-chk.h
  164. index 1c8cfdf..b3b4231 100644
  165. --- a/oscam-chk.h
  166. +++ b/oscam-chk.h
  167. @@ -16,6 +16,7 @@ int32_t chk_srvid_match(ECM_REQUEST *er, SIDTAB *sidtab);
  168. int32_t chk_srvid(struct s_client *cl, ECM_REQUEST *er);
  169. int32_t has_srvid(struct s_client *cl, ECM_REQUEST *er);
  170. int32_t has_lb_srvid(struct s_client *cl, ECM_REQUEST *er);
  171. +int32_t has_lb_prio_srvid(struct s_reader *rdr, ECM_REQUEST *er);
  172. int32_t chk_srvid_match_by_caid_prov(uint16_t caid, uint32_t provid, SIDTAB *sidtab);
  173. int32_t chk_srvid_by_caid_prov(struct s_client *cl, uint16_t caid, uint32_t provid);
  174. int32_t chk_srvid_by_caid_prov_rdr(struct s_reader *rdr, uint16_t caid, uint32_t provid);
  175. diff --git a/oscam-config-reader.c b/oscam-config-reader.c
  176. index 83bd898..8345378 100644
  177. --- a/oscam-config-reader.c
  178. +++ b/oscam-config-reader.c
  179. @@ -197,6 +197,17 @@ static void reader_lb_services_fn(const char *token, char *value, void *setting,
  180. }
  181. }
  182.  
  183. +static void reader_lb_prio_services_fn(const char *token, char *value, void *setting, FILE *f)
  184. +{
  185. + services_fn(token, value, setting, f);
  186. + if(value)
  187. + {
  188. + struct s_reader *rdr = container_of(setting, struct s_reader, lb_prio_sidtabs);
  189. + if(rdr)
  190. + { rdr->changes_since_shareupdate = 1; }
  191. + }
  192. +}
  193. +
  194. static void reader_caid_fn(const char *token, char *value, void *setting, FILE *f)
  195. {
  196. check_caidtab_fn(token, value, setting, f);
  197. @@ -802,6 +813,7 @@ static const struct config_list reader_opts[] =
  198. DEF_OPT_STR("readnano" , OFS(emmfile), NULL),
  199. DEF_OPT_FUNC("services" , OFS(sidtabs), reader_services_fn),
  200. DEF_OPT_FUNC("lb_whitelist_services" , OFS(lb_sidtabs), reader_lb_services_fn),
  201. + DEF_OPT_FUNC("lb_priority_services" , OFS(lb_prio_sidtabs), reader_lb_prio_services_fn),
  202. DEF_OPT_INT32("inactivitytimeout" , OFS(tcp_ito), DEFAULT_INACTIVITYTIMEOUT),
  203. DEF_OPT_INT32("reconnecttimeout" , OFS(tcp_rto), DEFAULT_TCP_RECONNECT_TIMEOUT),
  204. DEF_OPT_INT32("reconnectdelay" , OFS(tcp_reconnect_delay), 60000),
  205. diff --git a/webif/include/css.css b/webif/include/css.css
  206. index 105fa27..291c69a 100644
  207. --- a/webif/include/css.css
  208. +++ b/webif/include/css.css
  209. @@ -406,7 +406,7 @@ th.statuscol0 {
  210. width:0
  211. }
  212. /* readerconfig.html */
  213. -th.withservices, th.notservices, th.lbservices {}
  214. +th.withservices, th.notservices, th.lbservices, th.lbprioservices {}
  215.  
  216. /* **************** 10. TABLE TD */
  217. td {
  218. @@ -462,7 +462,7 @@ td.statuscol1 {
  219. vertical-align:middle
  220. }
  221. /* readerconfig_sidokbit.html */
  222. -td.servicescol1, td.servicescol2, td.servicescol3 {
  223. +td.servicescol1, td.servicescol2, td.servicescol3, td.servicescol4 {
  224. width:30%
  225. }
  226. /* Actionbutton readers.html */
  227. diff --git a/webif/pages_index.txt b/webif/pages_index.txt
  228. index a043afa..ca4477f 100644
  229. --- a/webif/pages_index.txt
  230. +++ b/webif/pages_index.txt
  231. @@ -202,6 +202,7 @@ READERCONFIGRADEGASTBIT readerconfig/readerconfig_radegastbit.html
  232. READERCONFIGSCAMBIT readerconfig/readerconfig_scambit.html MODULE_SCAM
  233. READERCONFIGSID readerconfig/readerconfig_sid.html
  234. READERCONFIGSIDLBOKBIT readerconfig/readerconfig_sidlbokbit.html
  235. +READERCONFIGSIDLBPRIOOKBIT readerconfig/readerconfig_sidlbpriookbit.html
  236. READERCONFIGSIDNOBIT readerconfig/readerconfig_sidnobit.html
  237. READERCONFIGSIDOKBIT readerconfig/readerconfig_sidokbit.html
  238.  
  239. diff --git a/webif/readerconfig/readerconfig_sid.html b/webif/readerconfig/readerconfig_sid.html
  240. index 031f706..d77a919 100644
  241. --- a/webif/readerconfig/readerconfig_sid.html
  242. +++ b/webif/readerconfig/readerconfig_sid.html
  243. @@ -6,6 +6,7 @@
  244. <TH CLASS="withservices"><A data-p="services">With_Services:</A></TH>
  245. <TH CLASS="notservices"><A data-p="services">Not_Services:</A></TH>
  246. <TH CLASS="lbservices"><A data-p="lb_whitelist_services">LB_Whitelist_Services:</A></TH>
  247. + <TH CLASS="lbprioservices"><A data-p="lb_priority_services">LB_Priority_Services:</A></TH>
  248. </TR>
  249. ##SIDS##
  250. </TABLE>
  251. diff --git a/webif/readerconfig/readerconfig_sidlbokbit.html b/webif/readerconfig/readerconfig_sidlbokbit.html
  252. index 8b51f4d..1b44c41 100644
  253. --- a/webif/readerconfig/readerconfig_sidlbokbit.html
  254. +++ b/webif/readerconfig/readerconfig_sidlbokbit.html
  255. @@ -1,2 +1 @@
  256. <TD CLASS="servicescol3"><input name="lb_whitelist_services" type="checkbox" value="##SIDLABEL##" ##CHECKED##><label>##SIDLABEL##</label></TD>
  257. - </TR>
  258. diff --git a/webif/readerconfig/readerconfig_sidlbpriookbit.html b/webif/readerconfig/readerconfig_sidlbpriookbit.html
  259. new file mode 100644
  260. index 0000000..07354f8
  261. --- /dev/null
  262. +++ b/webif/readerconfig/readerconfig_sidlbpriookbit.html
  263. @@ -0,0 +1,2 @@
  264. + <TD CLASS="servicescol4"><input name="lb_priority_services" type="checkbox" value="##SIDLABEL##" ##CHECKED##><label>##SIDLABEL##</label></TD>
  265. + </TR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement