diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-03 14:31:51 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-03-03 14:31:51 +0300 |
commit | 5424cc32d47c5e98b9edfb2b342d9d98d97a1175 (patch) | |
tree | bd4a0d4418b71d0024f5d66d07de2cc24aded7ec /src/util.h | |
parent | 3ff032cf72164dc9aa8575c0a631f7c7b0079f46 (diff) | |
download | rspamd-5424cc32d47c5e98b9edfb2b342d9d98d97a1175.tar.gz rspamd-5424cc32d47c5e98b9edfb2b342d9d98d97a1175.zip |
* Unify socket creation and accepting by using utility functions
* Check SO_ERROR on socket immideately after connect/bind to avoid resourses allocation for
unsuccessful connections
* Avoid descriptors leakage when we create sockets and have errors on them
* Set on all socket descriptors FD_CLOEXEC flag to avoid problems with executing LDA
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/util.h b/src/util.h index 69ae0fe92..f0764b960 100644 --- a/src/util.h +++ b/src/util.h @@ -6,10 +6,12 @@ struct config_file; -/* Create socket and bind it to specified address and port */ -int make_socket(struct in_addr *, u_short ); -/* Create and bind unix socket */ -int make_unix_socket (const char *, struct sockaddr_un *); +/* Create socket and bind or connect it to specified address and port */ +int make_tcp_socket (struct in_addr *, u_short, gboolean is_server); +/* Accept from socket */ +int accept_from_socket (int listen_sock, struct sockaddr *addr, socklen_t *len); +/* Create and bind or connect unix socket */ +int make_unix_socket (const char *, struct sockaddr_un *, gboolean is_server); /* Parse command line arguments using getopt (3) */ void read_cmd_line (int , char **, struct config_file *); /* Write pid to file */ |