Changeset 8658
- Timestamp:
- 05/22/13 22:35:26 (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-radegast.c
r8646 r8658 24 24 cs_ddump_mask(D_CLIENT, buf, n, "radegast: received %d bytes from %s", n, remote_txt()); 25 25 client->last = time((time_t *) 0); 26 27 if (buf[0] == 2) { // dcw received 28 if (buf[3] != 0x10) { // dcw ok 29 cs_log("radegast: no dcw"); 30 n = -1; 31 } 32 } 26 if ((buf[0] == 0x02)&&(buf[1] == 0x12) && (buf[2] == 0x05)&&(buf[3] == 0x10)) return(n); // dcw received 27 else if ((buf[0] == 0x02)&&(buf[1] == 0x02) && (buf[2] == 0x04)&&(buf[3] == 0x00)) return(n); // dcw no found 28 else if ((buf[0] == 0x81)&&(buf[1] == 0x00)) return(n); // cmd unknown 29 else n = -1;// no cmd radegast disconnect 33 30 } 34 31 } … … 210 207 int32_t handle; 211 208 209 handle = network_tcp_connection_open(cl->reader); 210 if(handle < 0) return -1; 211 212 212 cs_log("radegast: proxy %s:%d (fd=%d)", 213 213 cl->reader->device, cl->reader->r_port, cl->udp_fd); 214 215 handle = network_tcp_connection_open(cl->reader);216 if(handle < 0) return -1;217 214 218 215 cl->reader->tcp_connected = 2; … … 235 232 } 236 233 return; 234 } 235 236 static int32_t radegast_connect(void) 237 { 238 struct s_client *cl = cur_client(); 239 240 if (cl->reader->tcp_connected < 2 && radegast_cli_init(cl) < 0) 241 return 0; 242 243 if (!cl->udp_fd) 244 return 0; 245 246 return 1; 247 } 248 249 void radegast_idle(void) { 250 struct s_client *client = cur_client(); 251 struct s_reader *rdr = client->reader; 252 253 if (!rdr) return; 254 255 if (rdr->tcp_ito > 0) { 256 // inactivitytimeout > 0 enables protocol 257 time_t now; 258 int32_t time_diff; 259 time(&now); 260 time_diff = abs(now - rdr->last_s); 261 if (time_diff>(rdr->tcp_ito)) { 262 network_tcp_connection_close(client->reader, "inactivity"); 263 } 264 } 265 else if (rdr->tcp_ito == -1) { 266 // idle reconnect 267 radegast_connect(); 268 } 237 269 } 238 270 … … 249 281 ph->s_handler=radegast_server; 250 282 ph->s_init=radegast_server_init; 283 ph->c_idle = radegast_idle; 251 284 ph->recv=radegast_recv; 252 285 ph->send_dcw=radegast_send_dcw; -
trunk/oscam-client.c
r8589 r8658 514 514 // execute reader do idle on proxy reader after a certain time (rdr->tcp_ito = inactivitytimeout) 515 515 // disconnect when no keepalive available 516 if ((rdr->tcp_ito && is_cascading_reader(rdr)) || rdr->typ == R_CCCAM) {516 if ((rdr->tcp_ito && is_cascading_reader(rdr)) || (rdr->typ == R_CCCAM) || (rdr->tcp_ito != 0 && rdr->typ == R_RADEGAST)) { 517 517 time_t now = time(NULL); 518 518 int32_t time_diff = abs(now - rdr->last_check); 519 if (time_diff > 60 || (time_diff > 30 && rdr->typ == R_CCCAM) ) { //check 1x per minute or every 30s for cccam519 if (time_diff > 60 || (time_diff > 30 && rdr->typ == R_CCCAM) || ((time_diff > (rdr->tcp_rto?rdr->tcp_rto:60)) && rdr->typ == R_RADEGAST)) { //check 1x per minute or every 30s for cccam or reconnecttimeout radegast if 0 defaut 60s 520 520 add_job(rdr->client, ACTION_READER_IDLE, NULL, 0); 521 521 rdr->last_check = now; -
trunk/webif/readerconfig/readerconfig_radegastbit.html
r8418 r8658 2 2 <TR><TD>##TPLHELPPREFIX##server#password##TPLHELPSUFFIX##Password:</A></TD><TD><input name="password" type="text" size="30" maxlength="50" value="##PASSWORD##"></TD></TR> 3 3 <TR><TD>##TPLHELPPREFIX##server#inactivitytimeout##TPLHELPSUFFIX##Inactivity timeout:</A></TD><TD><input name="inactivitytimeout" type="text" size="30" maxlength="50" value="##INACTIVITYTIMEOUT##">s</TD></TR> 4 <TR><TD>##TPLHELPPREFIX##server#reconnecttimeout##TPLHELPSUFFIX##Reconnect timeout:</A></TD><TD><input name="reconnecttimeout" type="text" size="30" maxlength="50" value="##RECEIVETIMEOUT##"> s</TD></TR>
Note:
See TracChangeset
for help on using the changeset viewer.