[srvx-commits] CVS: services/src proto-common.c,1.16,1.17
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-10-16 03:38:34
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv10586/src
Modified Files:
proto-common.c
Log Message:
Modify the ioset client code to use the socket destruction callback to make sure it is notified when the socket is closed.
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** proto-common.c 18 Sep 2002 14:53:59 -0000 1.16
--- proto-common.c 16 Oct 2002 03:38:31 -0000 1.17
***************
*** 70,74 ****
pos = ioset_line_read(fd, buffer, sizeof(buffer));
! if (pos < 0) {
log(MAIN_LOG, LOG_ERROR, "Connection to server lost.\n");
close_socket();
--- 70,74 ----
pos = ioset_line_read(fd, buffer, sizeof(buffer));
! if (pos <= 0) {
log(MAIN_LOG, LOG_ERROR, "Connection to server lost.\n");
close_socket();
***************
*** 81,84 ****
--- 81,99 ----
}
+ void
+ socket_destroyed(struct io_fd *fd)
+ {
+ if (fd->eof)
+ {
+ log(MAIN_LOG, LOG_ERROR, "Connection to server lost.\n");
+ }
+ socket_io_fd = NULL;
+ cManager.uplink->state = DISCONNECTED;
+ if (self->uplink)
+ {
+ DelServer(self->uplink, 0, NULL);
+ }
+ }
+
void replay_event_loop(void)
{
***************
*** 121,124 ****
--- 136,140 ----
}
socket_io_fd->readable_cb = uplink_readable;
+ socket_io_fd->destroy_cb = socket_destroyed;
socket_io_fd->line_reads = 1;
socket_io_fd->wants_reads = 1;
***************
*** 249,258 ****
if (replay_file) {
replay_connected = 0;
} else {
ioset_close(socket_io_fd->fd, 1);
- socket_io_fd = NULL;
}
- cManager.uplink->state = DISCONNECTED;
- if (self->uplink) DelServer(self->uplink, 0, NULL);
}
--- 265,272 ----
if (replay_file) {
replay_connected = 0;
+ socket_destroyed(socket_io_fd);
} else {
ioset_close(socket_io_fd->fd, 1);
}
}
|