use Net::Server::PreFork;
use Net::Server::Proto;
use IO::Socket::INET;
-use Socket qw(:crlf);
+use Socket qw(:crlf SOL_SOCKET SO_KEEPALIVE IPPROTO_TCP TCP_KEEPALIVE);
use Data::Dumper; # For debugging
require UNIVERSAL::require;
my ($sockaddr, $port, $proto);
my $transport;
+ eval { # If it fails ... oh well
+ use Socket::Linux qw(TCP_KEEPINTVL TCP_KEEPIDLE TCP_KEEPCNT);
+ setsockopt($self->{server}->{client}, SOL_SOCKET, SO_KEEPALIVE, 1);
+ setsockopt($self->{server}->{client}, IPPROTO_TCP, TCP_KEEPALIVE, 1);
+ setsockopt($self->{server}->{client}, IPPROTO_TCP, TCP_KEEPIDLE, 120);
+ setsockopt($self->{server}->{client}, IPPROTO_TCP, TCP_KEEPINTVL, 10);
+ };
+
$self->{account} = undef; # New connection, no need to keep login info
$self->{config} = $config;