aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-09-22 15:24:44 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-09-22 15:24:44 +0200
commite541cdb869535a660f19928e69b9a138b594d079 (patch)
tree63e38071357b0a4323abbf31737766dea409cbe7 /src
parentcd2198f0b60a01e7f40755efd8e4ab98e60d103c (diff)
downloadODR-PadEnc-e541cdb869535a660f19928e69b9a138b594d079.tar.gz
ODR-PadEnc-e541cdb869535a660f19928e69b9a138b594d079.tar.bz2
ODR-PadEnc-e541cdb869535a660f19928e69b9a138b594d079.zip
Fix padsocket communication on intermittently missing receive requests
Diffstat (limited to 'src')
-rw-r--r--src/odr-padenc.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index a22cba6..1d170ca 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -325,25 +325,22 @@ int main(int argc, char *argv[]) {
while (!do_exit) {
options.padlen = intf.receive_request();
- if (previous_padlen != options.padlen) {
- previous_padlen = options.padlen;
-
- if (options.padlen == 0) {
- /* ignore */
- }
- else if (!PADPacketizer::CheckPADLen(options.padlen)) {
- fprintf(stderr, "ODR-PadEnc Error: PAD length %d invalid: Possible values: %s\n",
- options.padlen, PADPacketizer::ALLOWED_PADLEN.c_str());
- result = 2;
- break;
- }
- else {
- fprintf(stderr, "ODR-PadEnc Reinitialise PAD length to %d\n", options.padlen);
- pad_encoder = std::make_shared<PadEncoder>(options);
+ if (options.padlen > 0) {
+ if (previous_padlen != options.padlen) {
+ previous_padlen = options.padlen;
+
+ if (!PADPacketizer::CheckPADLen(options.padlen)) {
+ fprintf(stderr, "ODR-PadEnc Error: PAD length %d invalid: Possible values: %s\n",
+ options.padlen, PADPacketizer::ALLOWED_PADLEN.c_str());
+ result = 2;
+ break;
+ }
+ else {
+ fprintf(stderr, "ODR-PadEnc Reinitialise PAD length to %d\n", options.padlen);
+ pad_encoder = std::make_shared<PadEncoder>(options);
+ }
}
- }
- if (options.padlen > 0) {
result = pad_encoder->Encode(intf);
if (result > 0) {
break;