Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP Keepalive for none listening connections #415

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## Modifications of this fork

- uses TCP feature keepalive
- starts to ping IRC server after 30 seconds instead of 270 seconds

This mod was done to solve my ping timeouts with the following setup:
- Freenode IRC
- Kabel Deutschland provider
- IPv6 tunnel with sixxs
- Fritz!Box 7270 router

keepalive does not really help here, since by default gets only active after some hours.
the pinging seems to work. unfortunately I do not really know why - just have some ideas in mind.

the modification was done with the ubuntu source of znc. this I just put here as reference.


#[![ZNC](http://wiki.znc.in/skins/common/images/wiki.png)](http://znc.in) - An advanced IRC bouncer

## Table of contents
Expand Down
7 changes: 6 additions & 1 deletion src/Csocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2538,14 +2538,19 @@ cs_sock_t Csock::CreateSocket( bool bListen )

if( iRet != CS_INVALID_SOCK )
{
const int on = 1;
set_close_on_exec( iRet );

if( bListen )
{
const int on = 1;
if( setsockopt( iRet, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof( on ) ) != 0 )
PERROR( "SO_REUSEADDR" );
}
else
{
if ( setsockopt ( iRet, SOL_SOCKET, SO_KEEPALIVE, (char*)&on, sizeof( on ) ) != 0 )
PERROR( "SO_KEEPALIVE" );
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/User.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CUserTimer : public CCron {
CIRCNetwork* pNetwork = vNetworks[a];
CIRCSock* pIRCSock = pNetwork->GetIRCSock();

if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 270) {
if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 30) {
pIRCSock->PutIRC("PING :ZNC");
}

Expand Down