commit f68e021b90f804b102f598856bf0f01ca36e95c3
Author: Oswald Buddenhagen <[email protected]>
Date: Sun Dec 7 12:51:01 2014 +0100
factor out socket_open_internal()
src/socket.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/socket.c b/src/socket.c
index 0108243..0ea4ae8 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -286,6 +286,14 @@ static void socket_connected( conn_t * );
static void socket_connect_bail( conn_t * );
static void
+socket_open_internal( conn_t *sock, int fd )
+{
+ sock->fd = fd;
+ fcntl( fd, F_SETFL, O_NONBLOCK );
+ add_fd( fd, socket_fd_cb, sock );
+}
+
+static void
socket_close_internal( conn_t *sock )
{
del_fd( sock->fd );
@@ -322,10 +330,7 @@ socket_connect( conn_t *sock, void (*cb)( int ok, void
*aux ) )
}
close( a[0] );
- sock->fd = a[1];
-
- fcntl( a[1], F_SETFL, O_NONBLOCK );
- add_fd( a[1], socket_fd_cb, sock );
+ socket_open_internal( sock, a[1] );
info( "\vok\n" );
socket_connected( sock );
@@ -417,9 +422,7 @@ socket_connect_one( conn_t *sock )
perror( "socket" );
exit( 1 );
}
- sock->fd = s;
- fcntl( s, F_SETFL, O_NONBLOCK );
- add_fd( s, socket_fd_cb, sock );
+ socket_open_internal( sock, s );
infon( "Connecting to %s... ", sock->name );
#ifdef HAVE_IPV6
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel