diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-04-15 15:37:52 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-04-15 15:37:52 +0000 |
commit | 86e4df4bc8ba55485f95f5bb82c99742306f6a67 (patch) | |
tree | 8fcfab51498c31604748e105c61224960728501b /usr.sbin/ldpd/packet.c | |
parent | 03f0fb88a3788b14da4c011f6e5ae6d65e0da840 (diff) |
session_shutdown() issues a NBR_EVT_CLOSE_SESSION and therefore a
session_close() which does the event_del(&nbr->rev) so no need to do it
twice. There is also no need to send two S_SHUTDOWN messages.
OK michele@
Diffstat (limited to 'usr.sbin/ldpd/packet.c')
-rw-r--r-- | usr.sbin/ldpd/packet.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ldpd/packet.c b/usr.sbin/ldpd/packet.c index 7217553f515..1df9ae4d204 100644 --- a/usr.sbin/ldpd/packet.c +++ b/usr.sbin/ldpd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.7 2010/04/15 15:31:55 claudio Exp $ */ +/* $OpenBSD: packet.c,v 1.8 2010/04/15 15:37:51 claudio Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -325,8 +325,6 @@ session_read(int fd, short event, void *arg) if ((n = read(fd, nbr->rbuf->buf + nbr->rbuf->wpos, sizeof(nbr->rbuf->buf) - nbr->rbuf->wpos)) == -1) { if (errno != EINTR && errno != EAGAIN) { - /* XXX find better error */ - event_del(&nbr->rev); session_shutdown(nbr, S_SHUTDOWN, 0, 0); return; } @@ -335,7 +333,6 @@ session_read(int fd, short event, void *arg) } if (n == 0) { /* connection closed */ - event_del(&nbr->rev); session_shutdown(nbr, S_SHUTDOWN, 0, 0); return; } @@ -450,8 +447,12 @@ void session_shutdown(struct nbr *nbr, u_int32_t status, u_int32_t msgid, u_int32_t type) { + log_debug("session_shutdown: nbr ID %s, status %x", + inet_ntoa(nbr->id), status); + send_notification_nbr(nbr, status, msgid, type); - send_notification_nbr(nbr, S_SHUTDOWN, msgid, type); + if (status != S_SHUTDOWN) + send_notification_nbr(nbr, S_SHUTDOWN, msgid, type); nbr_fsm(nbr, NBR_EVT_CLOSE_SESSION); } |