Skip to content

Commit 0953947

Browse files
committed
Sink Service: change default timeout to 120s for com with sink
Override the c-mesh-api timeout inside sink_service directly (same as with max fragment duration).
1 parent 78d37b5 commit 0953947

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sink_service/source/main.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ static char * port_name = "/dev/ttyACM0";
2929
#define MAX_SIZE_SERVICE_NAME 100
3030
/* Prefix for sink service name */
3131
#define BASE_SERVICE_NAME "com.wirepas.sink.sink0"
32-
/* max poll fail duration undefined */
33-
#define UNDEFINED_MAX_POLL_FAIL_DURATION 0xffffffff
32+
3433
/* max default delay to keep incomplete fragmented packet inside our buffers */
3534
#define DEFAULT_FRAGMENT_MAX_DURATION_S 900
35+
/* max default delay for poll fail duration */
36+
/* 120s should cover most scratchpad exchanges and image processing. Sink is
37+
not answearing during that time */
38+
#define DEFAULT_MAX_POLL_FAIL_DURATION_S 120
3639

3740
/* Dbus bus instance*/
3841
static sd_bus * m_bus = NULL;
@@ -153,7 +156,7 @@ int main(int argc, char * argv[])
153156
int r;
154157
int c;
155158
unsigned int sink_id = 0;
156-
unsigned int max_poll_fail_duration = UNDEFINED_MAX_POLL_FAIL_DURATION;
159+
unsigned int max_poll_fail_duration = DEFAULT_MAX_POLL_FAIL_DURATION_S;
157160
unsigned int fragment_max_duration_s = DEFAULT_FRAGMENT_MAX_DURATION_S;
158161
unsigned int downlink_limit = 0;
159162

@@ -256,13 +259,10 @@ int main(int argc, char * argv[])
256259
}
257260
}
258261

259-
if (max_poll_fail_duration != UNDEFINED_MAX_POLL_FAIL_DURATION)
262+
if (WPC_set_max_poll_fail_duration(max_poll_fail_duration))
260263
{
261-
if (WPC_set_max_poll_fail_duration(max_poll_fail_duration))
262-
{
263-
LOGE("Cannot set max poll fail duration (%d)\n", max_poll_fail_duration);
264-
return EXIT_FAILURE;
265-
}
264+
LOGE("Cannot set max poll fail duration (%d)\n", max_poll_fail_duration);
265+
return EXIT_FAILURE;
266266
}
267267

268268
if (WPC_set_max_fragment_duration(fragment_max_duration_s))

0 commit comments

Comments
 (0)