mirror of
https://github.com/proxytunnel/proxytunnel.git
synced 2026-01-23 02:34:59 +00:00
cygwin/daemon_mode related changes by Marc (dot) Heuse (at) ecb (dot) int
git-svn-id: https://proxytunnel.svn.sourceforge.net/svnroot/proxytunnel/trunk/proxytunnel@149 bc163920-b10d-0410-b2c5-a5491ca2ceef
This commit is contained in:
parent
3c52e456fc
commit
c7ea350724
2 changed files with 16 additions and 7 deletions
7
Makefile
7
Makefile
|
|
@ -4,11 +4,14 @@
|
|||
|
||||
CC ?= cc
|
||||
CFLAGS ?= -Wall -O2 -ggdb
|
||||
CFLAGS += -DHAVE_GETOPT_LONG # Comment on non-gnu systems
|
||||
CFLAGS += -DUSE_SSL # Comment if you don't have/want ssl
|
||||
CFLAGS += -DHAVE_GETOPT_LONG # Comment on non-gnu systems
|
||||
CFLAGS += -DUSE_SSL # Comment if you don't have/want ssl
|
||||
# Most systems
|
||||
CFLAGS += -DSETPROCTITLE -DSPT_TYPE=2
|
||||
|
||||
# Testing new flags
|
||||
CFLAGS += -DSO_REUSEPORT # Comment if you don't have this flag
|
||||
|
||||
# System dependant blocks... if your system is listed below, uncomment
|
||||
# the relevant lines
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ void closeall() {
|
|||
void do_daemon()
|
||||
{
|
||||
int listen_sd;
|
||||
int one = 1;
|
||||
struct sockaddr_in sa_serv;
|
||||
struct sockaddr_in sa_cli;
|
||||
socklen_t client_len;
|
||||
|
|
@ -176,19 +177,24 @@ void do_daemon()
|
|||
/* Socket descriptor */
|
||||
int sd;
|
||||
|
||||
|
||||
if ( ( listen_sd = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 )
|
||||
if ( ( listen_sd = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) < 0 )
|
||||
{
|
||||
my_perror( "Server socket creation failed" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef SO_REUSEPORT /* doesnt exist everywhere... */
|
||||
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof (one));
|
||||
#endif
|
||||
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
|
||||
|
||||
|
||||
memset( &sa_serv, '\0', sizeof( sa_serv ) );
|
||||
sa_serv.sin_family = AF_INET;
|
||||
sa_serv.sin_addr.s_addr = INADDR_ANY;
|
||||
sa_serv.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
sa_serv.sin_port = htons( args_info.standalone_arg );
|
||||
|
||||
if ( bind( listen_sd, (struct sockaddr * )&sa_serv, sizeof( sa_serv ) ) < 0)
|
||||
if ( bind( listen_sd, (struct sockaddr * )&sa_serv, sizeof( struct sockaddr ) ) < 0)
|
||||
{
|
||||
my_perror("Server socket bind failed");
|
||||
exit(1);
|
||||
|
|
@ -228,7 +234,7 @@ void do_daemon()
|
|||
i_am_daemon = 1;
|
||||
#endif /* CYGWIN */
|
||||
atexit( closeall );
|
||||
listen( listen_sd, 5 );
|
||||
listen( listen_sd, 8 );
|
||||
|
||||
while (1==1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue