summaryrefslogtreecommitdiff
path: root/omapip/connection.c
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2009-10-15 18:39:49 +0000
committerShawn Routhier <sar@isc.org>2009-10-15 18:39:49 +0000
commit0493fdca5ebc93fe800462728875f9495651caa6 (patch)
treefa563f79e193efac431ee13fe7495bd441922176 /omapip/connection.c
parentd5e0cd6f28c5b6d8c246c8056a5441d687f598ea (diff)
downloadisc-dhcp-0493fdca5ebc93fe800462728875f9495651caa6.tar.gz
Fix handling of changing a connectiong from connecting to connected, avoiding
releasing the memory for the omapi io object.
Diffstat (limited to 'omapip/connection.c')
-rw-r--r--omapip/connection.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/omapip/connection.c b/omapip/connection.c
index e95fd3f7..e9289643 100644
--- a/omapip/connection.c
+++ b/omapip/connection.c
@@ -674,16 +674,16 @@ static isc_result_t omapi_connection_connect_internal (omapi_object_t *h)
(struct sockaddr *)&c -> local_addr, &sl) < 0) {
}
- /* Disconnect from I/O object, if any. */
- if (h -> outer)
- omapi_unregister_io_object (h);
-
- status = omapi_register_io_object (h,
- omapi_connection_readfd,
- omapi_connection_writefd,
- omapi_connection_reader,
- omapi_connection_writer,
- omapi_connection_reaper);
+ /* Reregister with the I/O object. If we don't already have an
+ I/O object this turns into a register call, otherwise we simply
+ modify the pointers in the I/O object. */
+
+ status = omapi_reregister_io_object (h,
+ omapi_connection_readfd,
+ omapi_connection_writefd,
+ omapi_connection_reader,
+ omapi_connection_writer,
+ omapi_connection_reaper);
if (status != ISC_R_SUCCESS) {
omapi_disconnect (h, 1);