projects
/
cascardo
/
rnetproxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Always wait for the SSL handshake before connecting to server.
[cascardo/rnetproxy.git]
/
tcp_server.c
diff --git
a/tcp_server.c
b/tcp_server.c
index
35ad630
..
1bd3933
100644
(file)
--- a/
tcp_server.c
+++ b/
tcp_server.c
@@
-1,5
+1,6
@@
/*
/*
- * Copyright (C) 2008-2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ * Copyright (C) 2008 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+ * Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-28,9
+29,11
@@
static int
tcp_server (struct addrinfo *ai)
{
int fd;
tcp_server (struct addrinfo *ai)
{
int fd;
+ int optval = 1;
fd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (fd < 0)
return -1;
fd = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (fd < 0)
return -1;
+ setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (int));
if (bind (fd, ai->ai_addr, ai->ai_addrlen) < 0)
{
close (fd);
if (bind (fd, ai->ai_addr, ai->ai_addrlen) < 0)
{
close (fd);