Metze is right: If we have *any* error at the socket level, we just can
not continue.
Also, apply some defensive programming: With this async stuff someone else
might already have closed the socket.
nwritten = writev_recv(subreq, &err);
TALLOC_FREE(subreq);
if (nwritten == -1) {
- if (err == EPIPE) {
+ if (state->cli->fd != -1) {
close(state->cli->fd);
state->cli->fd = -1;
}
received = read_smb_recv(subreq, talloc_tos(), &inbuf, &err);
TALLOC_FREE(subreq);
if (received == -1) {
- if (err == EPIPE) {
+ if (cli->fd != -1) {
close(cli->fd);
cli->fd = -1;
}
state->received = async_recv_recv(subreq, &err);
if (state->received == -1) {
- if (err == EPIPE) {
+ if (state->transp->fd != -1) {
close(state->transp->fd);
state->transp->fd = -1;
}
state->sent = async_send_recv(subreq, &err);
if (state->sent == -1) {
- if (err == EPIPE) {
+ if (state->transp->fd != -1) {
close(state->transp->fd);
state->transp->fd = -1;
}