Let socket library return correct socket number in all cases.

This commit is contained in:
Thulinma 2014-12-05 13:11:12 +01:00
parent fcf540af8e
commit 06f88ef296

View file

@ -283,7 +283,16 @@ void Socket::Connection::drop() {
/// Returns internal socket number.
int Socket::Connection::getSocket() {
return sock;
if (sock != -1){
return sock;
}
if (pipes[0] != -1) {
return pipes[0];
}
if (pipes[1] != -1) {
return pipes[1];
}
return -1;
}
/// Returns a string describing the last error that occured.