jeremyczhen / fdbus

FDBus - Fast Distributed Bus
https://blog.csdn.net/jeremy_cz/article/details/89060291
164 stars 85 forks source link

QNX下编译找不到TCP_KEEPIDLE TCP_KEEPINTVL TCP_KEEPCNT #24

Open thun-res opened 3 years ago

thun-res commented 3 years ago
if (setsockopt(CastToSocket(socket), IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
    return false;
}

/* Send next probes after the specified interval. Note that we set the
 * delay as interval / 3, as we send three probes before detecting
 * an error (see the next setsockopt call). */
val = interval / count;
if (val == 0) val = 1;
if (setsockopt(CastToSocket(socket), IPPROTO_TCP, TCP_KEEPINTVL, &val, sizeof(val)) < 0) {
    return false;
}

/* Consider the socket in error state after three we send three ACK
 * probes without getting a reply. */
val = count;
if (setsockopt(CastToSocket(socket), IPPROTO_TCP, TCP_KEEPCNT, &val, sizeof(val)) < 0) {
    return false;
}
jeremyczhen commented 3 years ago

Sorry already fixed: for QNX -Dfdbus_QNX_KEEPALIVE=ON should be added to QNX.