Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.19 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..e179468 100644
  64. --- a/module-stat.c
  65. +++ b/module-stat.c
  66. @@ -1457,6 +1457,12 @@ void stat_get_best_reader(ECM_REQUEST *er)
  67. { current = 1; }
  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. cs_log_dbg(D_LB, "loadbalancer: reader %s lbvalue = %d (time-avg %d)", rdr->label, (int) llabs(current), s->time_avg);
  78.  
  79. @@ -1495,6 +1501,9 @@ void stat_get_best_reader(ECM_REQUEST *er)
  80.  
  81. if(ea->value && (!best || ea->value < best->value))
  82. { best = ea; }
  83. +
  84. + if(ea->value == -123)
  85. + { best = ea; break;}
  86. }
  87. if(!best)
  88. { break; }
  89. diff --git a/module-webif.c b/module-webif.c
  90. index ae86e01..23419c0 100644
  91. --- a/module-webif.c
  92. +++ b/module-webif.c
  93. @@ -1778,6 +1778,7 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  94. // inactivate_reader(rdr); //Stop reader before reinitialization
  95. char servicelabels[1024] = "";
  96. char servicelabelslb[1024] = "";
  97. + char servicelabelslbprio[1024] = "";
  98.  
  99. for(i = 0; i < (*params).paramcount; ++i)
  100. {
  101. @@ -1787,6 +1788,8 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  102. { snprintf(servicelabels + strlen(servicelabels), sizeof(servicelabels) - strlen(servicelabels), "%s,", (*params).values[i]); }
  103. else if(!strcmp((*params).params[i], "lb_whitelist_services"))
  104. { snprintf(servicelabelslb + strlen(servicelabelslb), sizeof(servicelabelslb) - strlen(servicelabelslb), "%s,", (*params).values[i]); }
  105. + else if(!strcmp((*params).params[i], "lb_priority_services"))
  106. + { snprintf(servicelabelslbprio + strlen(servicelabelslbprio), sizeof(servicelabelslbprio) - strlen(servicelabelslbprio), "%s,", (*params).values[i]); }
  107. else
  108. /*if(strlen((*params).values[i]) > 0)*/
  109. { chk_reader((*params).params[i], (*params).values[i], rdr); }
  110. @@ -1795,6 +1798,7 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  111. }
  112. chk_reader("services", servicelabels, rdr);
  113. chk_reader("lb_whitelist_services", servicelabelslb, rdr);
  114. + chk_reader("lb_priority_services", servicelabelslbprio, rdr);
  115.  
  116. if(is_network_reader(rdr)) //physical readers make trouble if re-started
  117. {
  118. @@ -2205,6 +2209,9 @@ static char *send_oscam_reader_config(struct templatevars *vars, struct uriparam
  119. if(rdr->lb_sidtabs.ok & ((SIDTABBITS)1 << i)) { tpl_addVar(vars, TPLADD, "CHECKED", "checked"); }
  120. else { tpl_addVar(vars, TPLADD, "CHECKED", ""); }
  121. tpl_addVar(vars, TPLAPPEND, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDLBOKBIT"));
  122. + if(rdr->lb_prio_sidtabs.ok & ((SIDTABBITS)1 << i)) { tpl_addVar(vars, TPLADD, "CHECKED", "checked"); }
  123. + else { tpl_addVar(vars, TPLADD, "CHECKED", ""); }
  124. + tpl_addVar(vars, TPLAPPEND, "SIDS", tpl_getTpl(vars, "READERCONFIGSIDLBPRIOOKBIT"));
  125. sidtab = sidtab->next;
  126. i++;
  127. }
  128. diff --git a/oscam-chk.c b/oscam-chk.c
  129. index 33f3b36..df29f97 100644
  130. --- a/oscam-chk.c
  131. +++ b/oscam-chk.c
  132. @@ -175,6 +175,20 @@ int32_t has_lb_srvid(struct s_client *cl, ECM_REQUEST *er)
  133. return 0;
  134. }
  135.  
  136. +int32_t has_lb_prio_srvid(struct s_reader *rdr, ECM_REQUEST *er)
  137. +{
  138. + if(!rdr->lb_prio_sidtabs.ok)
  139. + { return 0; }
  140. +
  141. + int32_t nr;
  142. + SIDTAB *sidtab;
  143. +
  144. + for(nr = 0, sidtab = cfg.sidtab; sidtab; sidtab = sidtab->next, nr++)
  145. + if((rdr->lb_prio_sidtabs.ok & ((SIDTABBITS)1 << nr)) &&
  146. + (chk_srvid_match(er, sidtab)))
  147. + { return 1; }
  148. + return 0;
  149. +}
  150.  
  151. int32_t chk_srvid_match_by_caid_prov(uint16_t caid, uint32_t provid, SIDTAB *sidtab)
  152. {
  153. diff --git a/oscam-chk.h b/oscam-chk.h
  154. index 1c8cfdf..b3b4231 100644
  155. --- a/oscam-chk.h
  156. +++ b/oscam-chk.h
  157. @@ -16,6 +16,7 @@ int32_t chk_srvid_match(ECM_REQUEST *er, SIDTAB *sidtab);
  158. int32_t chk_srvid(struct s_client *cl, ECM_REQUEST *er);
  159. int32_t has_srvid(struct s_client *cl, ECM_REQUEST *er);
  160. int32_t has_lb_srvid(struct s_client *cl, ECM_REQUEST *er);
  161. +int32_t has_lb_prio_srvid(struct s_reader *rdr, ECM_REQUEST *er);
  162. int32_t chk_srvid_match_by_caid_prov(uint16_t caid, uint32_t provid, SIDTAB *sidtab);
  163. int32_t chk_srvid_by_caid_prov(struct s_client *cl, uint16_t caid, uint32_t provid);
  164. int32_t chk_srvid_by_caid_prov_rdr(struct s_reader *rdr, uint16_t caid, uint32_t provid);
  165. diff --git a/oscam-config-reader.c b/oscam-config-reader.c
  166. index 83bd898..8345378 100644
  167. --- a/oscam-config-reader.c
  168. +++ b/oscam-config-reader.c
  169. @@ -197,6 +197,17 @@ static void reader_lb_services_fn(const char *token, char *value, void *setting,
  170. }
  171. }
  172.  
  173. +static void reader_lb_prio_services_fn(const char *token, char *value, void *setting, FILE *f)
  174. +{
  175. + services_fn(token, value, setting, f);
  176. + if(value)
  177. + {
  178. + struct s_reader *rdr = container_of(setting, struct s_reader, lb_prio_sidtabs);
  179. + if(rdr)
  180. + { rdr->changes_since_shareupdate = 1; }
  181. + }
  182. +}
  183. +
  184. static void reader_caid_fn(const char *token, char *value, void *setting, FILE *f)
  185. {
  186. check_caidtab_fn(token, value, setting, f);
  187. @@ -802,6 +813,7 @@ static const struct config_list reader_opts[] =
  188. DEF_OPT_STR("readnano" , OFS(emmfile), NULL),
  189. DEF_OPT_FUNC("services" , OFS(sidtabs), reader_services_fn),
  190. DEF_OPT_FUNC("lb_whitelist_services" , OFS(lb_sidtabs), reader_lb_services_fn),
  191. + DEF_OPT_FUNC("lb_priority_services" , OFS(lb_prio_sidtabs), reader_lb_prio_services_fn),
  192. DEF_OPT_INT32("inactivitytimeout" , OFS(tcp_ito), DEFAULT_INACTIVITYTIMEOUT),
  193. DEF_OPT_INT32("reconnecttimeout" , OFS(tcp_rto), DEFAULT_TCP_RECONNECT_TIMEOUT),
  194. DEF_OPT_INT32("reconnectdelay" , OFS(tcp_reconnect_delay), 60000),
  195. diff --git a/webif/include/css.css b/webif/include/css.css
  196. index 105fa27..291c69a 100644
  197. --- a/webif/include/css.css
  198. +++ b/webif/include/css.css
  199. @@ -406,7 +406,7 @@ th.statuscol0 {
  200. width:0
  201. }
  202. /* readerconfig.html */
  203. -th.withservices, th.notservices, th.lbservices {}
  204. +th.withservices, th.notservices, th.lbservices, th.lbprioservices {}
  205.  
  206. /* **************** 10. TABLE TD */
  207. td {
  208. @@ -462,7 +462,7 @@ td.statuscol1 {
  209. vertical-align:middle
  210. }
  211. /* readerconfig_sidokbit.html */
  212. -td.servicescol1, td.servicescol2, td.servicescol3 {
  213. +td.servicescol1, td.servicescol2, td.servicescol3, td.servicescol4 {
  214. width:30%
  215. }
  216. /* Actionbutton readers.html */
  217. diff --git a/webif/pages_index.txt b/webif/pages_index.txt
  218. index a043afa..ca4477f 100644
  219. --- a/webif/pages_index.txt
  220. +++ b/webif/pages_index.txt
  221. @@ -202,6 +202,7 @@ READERCONFIGRADEGASTBIT readerconfig/readerconfig_radegastbit.html
  222. READERCONFIGSCAMBIT readerconfig/readerconfig_scambit.html MODULE_SCAM
  223. READERCONFIGSID readerconfig/readerconfig_sid.html
  224. READERCONFIGSIDLBOKBIT readerconfig/readerconfig_sidlbokbit.html
  225. +READERCONFIGSIDLBPRIOOKBIT readerconfig/readerconfig_sidlbpriookbit.html
  226. READERCONFIGSIDNOBIT readerconfig/readerconfig_sidnobit.html
  227. READERCONFIGSIDOKBIT readerconfig/readerconfig_sidokbit.html
  228.  
  229. diff --git a/webif/readerconfig/readerconfig_sid.html b/webif/readerconfig/readerconfig_sid.html
  230. index 031f706..d77a919 100644
  231. --- a/webif/readerconfig/readerconfig_sid.html
  232. +++ b/webif/readerconfig/readerconfig_sid.html
  233. @@ -6,6 +6,7 @@
  234. <TH CLASS="withservices"><A data-p="services">With_Services:</A></TH>
  235. <TH CLASS="notservices"><A data-p="services">Not_Services:</A></TH>
  236. <TH CLASS="lbservices"><A data-p="lb_whitelist_services">LB_Whitelist_Services:</A></TH>
  237. + <TH CLASS="lbprioservices"><A data-p="lb_priority_services">LB_Priority_Services:</A></TH>
  238. </TR>
  239. ##SIDS##
  240. </TABLE>
  241. diff --git a/webif/readerconfig/readerconfig_sidlbokbit.html b/webif/readerconfig/readerconfig_sidlbokbit.html
  242. index 8b51f4d..1b44c41 100644
  243. --- a/webif/readerconfig/readerconfig_sidlbokbit.html
  244. +++ b/webif/readerconfig/readerconfig_sidlbokbit.html
  245. @@ -1,2 +1 @@
  246. <TD CLASS="servicescol3"><input name="lb_whitelist_services" type="checkbox" value="##SIDLABEL##" ##CHECKED##><label>##SIDLABEL##</label></TD>
  247. - </TR>
  248. diff --git a/webif/readerconfig/readerconfig_sidlbpriookbit.html b/webif/readerconfig/readerconfig_sidlbpriookbit.html
  249. new file mode 100644
  250. index 0000000..07354f8
  251. --- /dev/null
  252. +++ b/webif/readerconfig/readerconfig_sidlbpriookbit.html
  253. @@ -0,0 +1,2 @@
  254. + <TD CLASS="servicescol4"><input name="lb_priority_services" type="checkbox" value="##SIDLABEL##" ##CHECKED##><label>##SIDLABEL##</label></TD>
  255. + </TR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement