diff options
| author | ajs <ajs> | 2005-04-11 15:51:40 +0000 | 
|---|---|---|
| committer | ajs <ajs> | 2005-04-11 15:51:40 +0000 | 
| commit | 634f9ea20fce82c94407cb677b5487b65bde1973 (patch) | |
| tree | 32db82e4ae3b0f409d6d06a0fda401f9d5df5cc9 /isisd | |
| parent | dfb9a545f8e3500e6a99518193872f526c1f56ba (diff) | |
2005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
	Implement non-blocking zclient I/O with buffering.
	* zclient.h (struct zclient): Add two fields to support non-blocking
	  I/O: struct buffer *wb, and struct thread *t_write.
	  (zclient_free): Remove function.
	  (zebra_redistribute_send): Change 2nd arg from socket fd to
	  struct zclient * (needed to support non-blocking I/O and buffering).
	  (zclient_send_message): New function to send an arbitrary
	  message with non-blocking I/O.
	* zclient.c (zclient_new): Create write buffer.
	  (zclient_free): Remove unused function.
	  (zclient_stop): Must cancel new t_write thread.  Also, reset
	  all buffers: ibuf, obuf, and wb.
	  (zclient_failed): New helper function for typical error handling.
	  (zclient_flush_data): New thread to flush queued data.
	  (zclient_send_message): New function to send the message in
	  zclient->obuf to zebra using non-blocking I/O and buffering.
	  (zebra_message_send, zapi_ipv4_route, zapi_ipv6_route): Use
	  new zclient_send_message function instead of calling writen.
	  (zclient_start): Set socket non-blocking.  Also, change 2nd arg
	  to zebra_redistribute_send from zclient->sock to zclient.
	  (zebra_redistribute_send): Change 2nd arg to struct zclient *.
	  Can now use zclient->obuf to assemble the message instead of
	  allocating a temporary stream.  And call zclient_send_message to
	  send the message instead of writen.
	  (zclient_read): Convert to support non-blocking I/O by using
	  stream_read_try instead of deprecated stream_read.
	  (zclient_redistribute): Change 2nd arg to zebra_redistribute_send
	  from zclient->sock to zclient.
	* ospf6_zebra.c (ospf6_zebra_redistribute, ospf6_zebra_no_redistribute):
	  Change 2nd arg to zebra_redistribute_send from zclient->sock
	  to zclient.
	* ospf_zebra.c (ospf_zebra_add): Call zclient_send_message instead
	  of writen.
	* rip_zebra.c (rip_redistribute_set, rip_redistribute_unset,
	  rip_redistribute_clean): Change 2nd arg to zebra_redistribute_send
	  from zclient->sock to zclient.
	* ripng_zebra.c (ripng_redistribute_unset, ripng_redistribute_clean):
	  Change 2nd arg to zebra_redistribute_send from zclient->sock
	  to zclient.
	* bgp_zebra.c (bgp_redistribute_set, bgp_redistribute_unset):
	  The 2nd arg to zebra_redistribute_send is now zclient instead of
	  zclient->sock.
	* isis_zebra.h (isis_zebra_finish): Remove declaration of unused
	  function.
	* isis_zebra.c (isis_zebra_route_add_ipv4): Call zclient_send_message
	  to send the message to zebra instead of calling writen directly, since
	  zclient_send_message understands non-blocking I/O and will manage
	  the buffer queue appropriately.
	  (isis_zebra_finish): Remove unused function, particularly since
	  the zclient_free function has been removed.
Diffstat (limited to 'isisd')
| -rw-r--r-- | isisd/ChangeLog | 11 | ||||
| -rw-r--r-- | isisd/isis_zebra.c | 12 | ||||
| -rw-r--r-- | isisd/isis_zebra.h | 1 | 
3 files changed, 12 insertions, 12 deletions
| diff --git a/isisd/ChangeLog b/isisd/ChangeLog index 38ab2fcb..e4792d89 100644 --- a/isisd/ChangeLog +++ b/isisd/ChangeLog @@ -1,3 +1,14 @@ +2005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + +	* isis_zebra.h (isis_zebra_finish): Remove declaration of unused +	  function. +	* isis_zebra.c (isis_zebra_route_add_ipv4): Call zclient_send_message +	  to send the message to zebra instead of calling writen directly, since +	  zclient_send_message understands non-blocking I/O and will manage +	  the buffer queue appropriately. +	  (isis_zebra_finish): Remove unused function, particularly since +	  the zclient_free function has been removed. +  2005-04-10 Paul Jakma <paul@dishone.st>  	* Makefile.am: topology should not be a conditional SUBDIR, diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index f45b9c13..889c5bfb 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -302,7 +302,7 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix,  	stream_putl (stream, route_info->cost);        stream_putw_at (stream, 0, stream_get_endp (stream)); -      writen (zclient->sock, stream->data, stream_get_endp (stream)); +      zclient_send_message(zclient);      }  } @@ -612,13 +612,3 @@ isis_zebra_init ()    return;  } - -void -isis_zebra_finish () -{ -  zclient_stop (zclient); -  zclient_free (zclient); -  zclient = (struct zclient *) NULL; - -  return; -} diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h index 0dce7995..889cd9b6 100644 --- a/isisd/isis_zebra.h +++ b/isisd/isis_zebra.h @@ -25,7 +25,6 @@  extern struct zclient *zclient;  void isis_zebra_init (void); -void isis_zebra_finish (void);  void isis_zebra_route_update (struct prefix *prefix,  			      struct isis_route_info *route_info);  int isis_distribute_list_update (int routetype); | 
