summaryrefslogtreecommitdiffstats
path: root/src/fuse/helper.c
diff options
context:
space:
mode:
authorSimon Rettberg2015-11-24 12:30:46 +0100
committerSimon Rettberg2015-11-24 12:30:46 +0100
commit7b51c287a60d2f202fb131eeed9d1bf19b65a7a3 (patch)
tree031573c708b50aeafe9a6fe6f0992b3ae6456e7c /src/fuse/helper.c
parent[SERVER] Fix race condition potentially leading to use after release (diff)
downloaddnbd3-7b51c287a60d2f202fb131eeed9d1bf19b65a7a3.tar.gz
dnbd3-7b51c287a60d2f202fb131eeed9d1bf19b65a7a3.tar.xz
dnbd3-7b51c287a60d2f202fb131eeed9d1bf19b65a7a3.zip
[FUSE] Mid-refactoring, does not compile
Diffstat (limited to 'src/fuse/helper.c')
-rw-r--r--src/fuse/helper.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/fuse/helper.c b/src/fuse/helper.c
index 65644f8..6e46352 100644
--- a/src/fuse/helper.c
+++ b/src/fuse/helper.c
@@ -47,54 +47,3 @@ bool sock_printable( struct sockaddr *addr, socklen_t addrLen, char *output, int
}
return ret == 0;
}
-
-// TODO: Pretty much same as in server/*
-int connect_to_server( char *server_address, int port )
-{
- const int on = 1;
- int sock = -1;
- struct addrinfo hints, *res, *ptr;
- char portStr[6];
-
- // Set hints for local addresses.
- memset( &hints, 0, sizeof( hints ) );
- hints.ai_flags = AI_PASSIVE;
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- snprintf( portStr, sizeof portStr, "%d", port );
- if ( getaddrinfo( server_address, portStr, &hints, &res ) != 0 || res == NULL ) {
- return false;
- }
- // Attempt to bind to all of the addresses as long as there's room in the poll list
- for ( ptr = res; ptr != NULL; ptr = ptr->ai_next ) {
- char bla[100];
- if ( !sock_printable( ( struct sockaddr * ) ptr->ai_addr, ptr->ai_addrlen, bla, 100 ) ) {
- snprintf( bla, 100, "[invalid]" );
- }
- printf( "Trying to connect to %s ", bla );
- sock = socket( ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol );
- if ( sock < 0 ) {
- printf( "...cannot create socket, errno=%d\n", errno );
- sock = -1;
- continue;
- }
- setsockopt( sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof( on ) );
- if ( ptr->ai_family == PF_INET6 ) {
- setsockopt( sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof( on ) );
- }
- if ( connect( sock, ptr->ai_addr, ptr->ai_addrlen ) < 0 ) {
- // if ( bind( sock, ptr->ai_addr, ptr->ai_addrlen ) == -1 ) {
- printf( "...socket Error, errno=%d\n", errno );
- close( sock );
- sock = -1;
- continue;
- } else {
- printf( "... connecting successful!\n" );
- break;
- }
- }
-
- freeaddrinfo( res );
- return sock;
-}
-