|
@@ -58,6 +58,12 @@ int camd_tcp_connect(struct in_addr ip, int port) {
|
58
|
58
|
return fd;
|
59
|
59
|
}
|
60
|
60
|
|
|
61
|
+static inline void camd_reconnect(struct camd *c) {
|
|
62
|
+ if (c->no_reconnect)
|
|
63
|
+ return;
|
|
64
|
+ c->ops.reconnect(c);
|
|
65
|
+}
|
|
66
|
+
|
61
|
67
|
void camd_set_cw(struct ts *ts, uint8_t *new_cw, int check_validity) {
|
62
|
68
|
struct camd *c = &ts->camd;
|
63
|
69
|
|
|
@@ -88,7 +94,7 @@ static int camd_recv_cw(struct ts *ts) {
|
88
|
94
|
if (ret <= 0) {
|
89
|
95
|
if (ret == -1) { // Fatal error it is better to reconnect to server.
|
90
|
96
|
ts_LOGf("ERR | No code word has been received (ret = %d)\n", ret);
|
91
|
|
- c->ops.reconnect(c);
|
|
97
|
+ camd_reconnect(c);
|
92
|
98
|
}
|
93
|
99
|
c->ecm_recv_errors++;
|
94
|
100
|
if (c->ecm_recv_errors >= ECM_RECV_ERRORS_LIMIT) {
|
|
@@ -134,7 +140,7 @@ static int camd_send_ecm(struct ts *ts, struct camd_msg *msg) {
|
134
|
140
|
if (ret <= 0) {
|
135
|
141
|
ts_LOGf("ERR | Error sending ecm packet, reconnecting to camd.\n");
|
136
|
142
|
ts->is_cw_error = 1;
|
137
|
|
- c->ops.reconnect(c);
|
|
143
|
+ camd_reconnect(c);
|
138
|
144
|
return ret;
|
139
|
145
|
}
|
140
|
146
|
|
|
@@ -167,9 +173,9 @@ static int camd_send_emm(struct ts *ts, struct camd_msg *msg) {
|
167
|
173
|
int ret = c->ops.do_emm(c, msg);
|
168
|
174
|
if (ret < 1) {
|
169
|
175
|
c->emm_recv_errors++;
|
170
|
|
- if (c->emm_recv_errors >= EMM_RECV_ERRORS_LIMIT) {
|
|
176
|
+ if (c->check_emm_errors || c->emm_recv_errors >= EMM_RECV_ERRORS_LIMIT) {
|
171
|
177
|
ts_LOGf("ERR | Error sending emm packet, reconnecting to camd.\n");
|
172
|
|
- c->ops.reconnect(c);
|
|
178
|
+ camd_reconnect(c);
|
173
|
179
|
c->emm_recv_errors = 0;
|
174
|
180
|
}
|
175
|
181
|
} else {
|