version 3.9.0, add PIEthernet::NoDelay parameter
This commit is contained in:
@@ -203,8 +203,7 @@ bool PIEthernet::init() {
|
||||
piCoutObj << "Can`t create socket," << ethErrorString();
|
||||
return false;
|
||||
}
|
||||
if (params[PIEthernet::ReuseAddress]) ethSetsockoptBool(sock, SOL_SOCKET, SO_REUSEADDR);
|
||||
if (params[PIEthernet::Broadcast]) ethSetsockoptBool(sock, SOL_SOCKET, SO_BROADCAST);
|
||||
applyParameters();
|
||||
applyTimeouts();
|
||||
applyOptInt(IPPROTO_IP, IP_TTL, TTL());
|
||||
// piCoutObj << "inited" << path();
|
||||
@@ -814,6 +813,14 @@ PIIODevice::DeviceInfoFlags PIEthernet::deviceInfoFlags() const {
|
||||
}
|
||||
|
||||
|
||||
void PIEthernet::applyParameters() {
|
||||
if (sock == -1) return;
|
||||
if (params[PIEthernet::ReuseAddress]) ethSetsockoptBool(sock, SOL_SOCKET, SO_REUSEADDR);
|
||||
if (params[PIEthernet::Broadcast]) ethSetsockoptBool(sock, SOL_SOCKET, SO_BROADCAST);
|
||||
if (params[PIEthernet::NoDelay] && (type() == TCP_Client)) ethSetsockoptBool(sock, IPPROTO_TCP, TCP_NODELAY, true);
|
||||
}
|
||||
|
||||
|
||||
void PIEthernet::clientDeleted(PIObject * o) {
|
||||
clients_mutex.lock();
|
||||
clients_.removeOne((PIEthernet *)o);
|
||||
|
||||
Reference in New Issue
Block a user