xapian-core  2.0.0
Functions
socket_utils.cc File Reference

Socket handling utilities. More...

#include <config.h>
#include "socket_utils.h"
#include <limits>
#include "realtime.h"
#include "safesyssocket.h"
#include "stringutils.h"
#include <arpa/inet.h>
#include <netinet/in.h>
+ Include dependency graph for socket_utils.cc:

Go to the source code of this file.

Functions

void set_socket_timeouts (int fd, double timeout)
 Attempt to set socket-level timeouts. More...
 
int pretty_ip6 (const void *p, char *buf)
 

Detailed Description

Socket handling utilities.

Definition in file socket_utils.cc.

Function Documentation

◆ pretty_ip6()

int pretty_ip6 ( const void *  p,
char *  buf 
)

Definition at line 113 of file socket_utils.cc.

References if(), p, PRETTY_IP6_LEN, and startswith().

◆ set_socket_timeouts()

void set_socket_timeouts ( int  fd,
double  timeout 
)

Attempt to set socket-level timeouts.

These aren't supported by all platforms, and some platforms allow them to set but ignore them, so we can't easily report failure.

Also sets SO_KEEPALIVE (if supported), which should ensure a stuck connection will eventually time out, though it may take up to ~2 hours.

Definition at line 69 of file socket_utils.cc.

References RealTime::to_timeval(), and usual.