diff options
author | paul <paul> | 2005-01-05 08:14:13 +0000 |
---|---|---|
committer | paul <paul> | 2005-01-05 08:14:13 +0000 |
commit | 1f4d240f6b0790e6804029e86a345d052b82ec80 (patch) | |
tree | 2086d19c5bc0b5bebb1cd9cb87807889f626e3e8 | |
parent | 3ed38d3e64429d36e926b3bbcc42d4f18e7ec65e (diff) | |
download | quagga-1f4d240f6b0790e6804029e86a345d052b82ec80.tar.bz2 quagga-1f4d240f6b0790e6804029e86a345d052b82ec80.tar.xz |
2005-01-05 Paul Jakma <paul@dishone.st>
* bgp_packet.c: (bgp_write) set socket to nonblock while writing
this should be generalised. See bugzilla #102. Fix supplied by
wawa@yandex-team.ru (Vladimir Ivanov).
-rw-r--r-- | bgpd/ChangeLog | 6 | ||||
-rw-r--r-- | bgpd/bgp_packet.c | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index b9d0cd59..79414def 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,9 @@ +2005-01-05 Paul Jakma <paul@dishone.st> + + * bgp_packet.c: (bgp_write) set socket to nonblock while writing + this should be generalised. See bugzilla #102. Fix supplied by + wawa@yandex-team.ru (Vladimir Ivanov). + 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * *.c: Change level of debug messages to LOG_DEBUG. diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 4eb7050c..5640e2b7 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -566,10 +566,17 @@ bgp_write (struct thread *thread) while (1) { int writenum; + int val; s = bgp_write_packet (peer); if (! s) return 0; + + /* XXX: FIXME, the socket should be NONBLOCK from the start + * status shouldnt need to be toggled on each write + */ + val = fcntl (peer->fd, F_GETFL, 0); + fcntl (peer->fd, F_SETFL, val|O_NONBLOCK); /* Number of bytes to be sent. */ writenum = stream_get_endp (s) - stream_get_getp (s); @@ -577,6 +584,7 @@ bgp_write (struct thread *thread) /* Call write() system call. */ num = write (peer->fd, STREAM_PNT (s), writenum); write_errno = errno; + fcntl (peer->fd, F_SETFL, val); if (num <= 0) { /* Partial write. */ |