summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-03-30 12:43:37 +0200
committerMartin Mares <mj@ucw.cz>2000-03-30 12:43:37 +0200
commit320f41735795b51c51a9f5c976a2335a9ec96e32 (patch)
tree5f4bdd3981d1d99bf4c91d14cfa1c639ebfd772e /lib
parent3a6337ecb2f6e5c8454a8416214c60432611aaa6 (diff)
downloadbird-320f41735795b51c51a9f5c976a2335a9ec96e32.tar
bird-320f41735795b51c51a9f5c976a2335a9ec96e32.zip
Defined sk_close() which closes the socket safely even if called from
socket hook. Replaces the SK_DELETED hack. Squashed a couple of bugs in handling of TCP sockets.
Diffstat (limited to 'lib')
-rw-r--r--lib/socket.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/socket.h b/lib/socket.h
index 65ba9a2..147e5ce 100644
--- a/lib/socket.h
+++ b/lib/socket.h
@@ -38,10 +38,12 @@ typedef struct birdsock {
int fd; /* System-dependent data */
node n;
+ int entered;
} sock;
sock *sk_new(pool *); /* Allocate new socket */
int sk_open(sock *); /* Open socket */
+void sk_close(sock *); /* Safe close of socket even from socket hook */
int sk_send(sock *, unsigned len); /* Send data, <0=err, >0=ok, 0=sleep */
int sk_send_to(sock *, unsigned len, ip_addr to, unsigned port); /* sk_send to given destination */
void sk_dump_all(void);
@@ -66,7 +68,7 @@ sk_send_buffer_empty(sock *sk)
#define SK_MAGIC 7 /* Internal use by sysdep code */
#define SK_UNIX_PASSIVE 8
#define SK_UNIX 9
-#define SK_DELETED 10 /* Set to this if you want to delete socket from err_hook */
+#define SK_DELETED 10 /* Internal use by sk_close */
/*
* Multicast sockets are slightly different from the other ones: