1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

fixed two more places where we don't correctly handle write errors on sockets

(This used to be ctdb commit f4a71bb63e7f75d21b66f9eaeac997c2029cd146)
This commit is contained in:
Andrew Tridgell 2007-05-15 14:08:58 +10:00
parent 67f5601bef
commit 527b2352ac
2 changed files with 7 additions and 3 deletions

View File

@ -170,9 +170,11 @@ static void queue_io_write(struct ctdb_queue *queue)
}
if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
talloc_free(queue->fde);
queue->fde = NULL;
queue->fd = -1;
event_add_timed(queue->ctdb->ev, queue, timeval_zero(),
queue_dead, queue);
EVENT_FD_NOT_WRITEABLE(queue->fde);
return;
}
if (n <= 0) return;
@ -232,6 +234,9 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
!(queue->ctdb->flags & CTDB_FLAG_TORTURE)) {
ssize_t n = write(queue->fd, data, length2);
if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
talloc_free(queue->fde);
queue->fde = NULL;
queue->fd = -1;
event_add_timed(queue->ctdb->ev, queue, timeval_zero(),
queue_dead, queue);
/* yes, we report success, as the dead node is

View File

@ -49,9 +49,7 @@ void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data)
/* start a new connect cycle to try to re-establish the
link */
close(tnode->fd);
ctdb_queue_set_fd(tnode->queue, -1);
tnode->fd = -1;
event_add_timed(node->ctdb->ev, node, timeval_zero(),
ctdb_tcp_node_connect, node);
}
@ -157,6 +155,7 @@ void ctdb_tcp_node_connect(struct event_context *ev, struct timed_event *te,
errno != EINPROGRESS) {
/* try again once a second */
close(tnode->fd);
tnode->fd = -1;
event_add_timed(ctdb->ev, node, timeval_current_ofs(1, 0),
ctdb_tcp_node_connect, node);
return;