Closed jotx closed 3 years ago
This is perhaps a regression of issue #11.
I'm too lazy to debug this myself but I had a closer look at the code.
Perhaps direction=both
is required when using preamble? It would be make sense since we need to send the preamble 😄. If direction=in
, ifa->pair
will be NULL
and reread()
will not send the preamble?
if (ifa->pair) {
if (!(iftp = (struct if_tcp *) ifa->pair->info)) {
logerr(errno,"No pair information found for bi-directional tcp connection!");
nread=-1;
} else {
if (ift->shared->nodelay && (setsockopt(ift->fd,IPPROTO_TCP,
TCP_NODELAY,&on,sizeof(on)) < 0))
logerr(errno,
"Could not disable Nagle on new tcp connection");
iftp->fd = ift->fd;
if (iftp->shared->preamble)
do_preamble(iftp,NULL);
}
}
Maybe do_preamble()
should be called also when ifa->direction == IN
like before commit e654d68?
I'm testing with direction=both
now, maybe it works then.
Thanks for the report. I'll look at this today
Firstly thanks for submitting this and with such a great level of analysis. It looks like you're right about this being a bug in 1.4 but it seems to have been fixed when the reconnection logic was reworked for re-looking up addresses on each reconnection. The newer implementation looks like it would logically work and I've experimented to confirm that preamble is indeed sent on reconnection with direction=in. Could you possibly confirm that by checking out the develop branch and trying that?
Yep, direction=in + preamble seems to be fixed in the development branch! 👌
(For the record my workaround using direction=both with 1.4 also worked)
Great. Thanks again for an excellent issue report. I'll add this to known issues today.
I use the preamble feature when connecting to an AIS server which works fine. However, the AIS server (for unknown reasons) sometimes resets the connection and when kplex reconnects (I use
persist=fromstart
) no preamble is sent.The documentations says:
I had a quick look in the code but could not find anything obvious. Perhaps the preamble is cleaned up when the connection is reset?
Version:
My configuration (with private info removed):
Log output: