aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxjoaalm <joao.almeida@blue-tc.com>2014-07-31 15:30:59 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2015-02-23 22:01:15 +0100
commitf32e5f219182e59b66e98096bbc4c46d0829e06f (patch)
tree32f159467553f70645412baef583445e3435d120 /src
parentcd078c7085b1b1cd3ed40943ecc8c02b48d88fa4 (diff)
downloadlibssh-f32e5f219182e59b66e98096bbc4c46d0829e06f.tar.gz
libssh-f32e5f219182e59b66e98096bbc4c46d0829e06f.tar.xz
libssh-f32e5f219182e59b66e98096bbc4c46d0829e06f.zip
Sending EOF on Socket that received a Broken Pipe makes call to poll to hang
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be> Signed-off-by: Joao Pedro Almeida Pereira <joao.almeida@blue-tc.com>
Diffstat (limited to 'src')
-rw-r--r--src/socket.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/socket.c b/src/socket.c
index 498da77e..aa9c4579 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -636,10 +636,15 @@ int ssh_socket_nonblocking_flush(ssh_socket s) {
if (!ssh_socket_is_open(s)) {
session->alive = 0;
- /* FIXME use ssh_socket_get_errno */
- ssh_set_error(session, SSH_FATAL,
- "Writing packet: error on socket (or connection closed): %s",
- strerror(s->last_errno));
+ if(s->callbacks && s->callbacks->exception){
+ s->callbacks->exception(
+ SSH_SOCKET_EXCEPTION_ERROR,
+ s->last_errno,s->callbacks->userdata);
+ }else{
+ ssh_set_error(session, SSH_FATAL,
+ "Writing packet: error on socket (or connection closed): %s",
+ strerror(s->last_errno));
+ }
return SSH_ERROR;
}
@@ -656,12 +661,16 @@ int ssh_socket_nonblocking_flush(ssh_socket s) {
if (w < 0) {
session->alive = 0;
ssh_socket_close(s);
- /* FIXME use ssh_socket_get_errno() */
- /* FIXME use callback for errors */
- ssh_set_error(session, SSH_FATAL,
- "Writing packet: error on socket (or connection closed): %s",
- strerror(s->last_errno));
+ if(s->callbacks && s->callbacks->exception){
+ s->callbacks->exception(
+ SSH_SOCKET_EXCEPTION_ERROR,
+ s->last_errno,s->callbacks->userdata);
+ }else{
+ ssh_set_error(session, SSH_FATAL,
+ "Writing packet: error on socket (or connection closed): %s",
+ strerror(s->last_errno));
+ }
return SSH_ERROR;
}
buffer_pass_bytes(s->out_buffer, w);