mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
fixed bug not clearing socket descriptor
This commit is contained in:
parent
78fcb7eb98
commit
ed9dc3b386
@ -16,7 +16,7 @@ namespace sls {
|
|||||||
DataSocket::DataSocket(int socketId) : socketId_(socketId) {}
|
DataSocket::DataSocket(int socketId) : socketId_(socketId) {}
|
||||||
|
|
||||||
DataSocket::~DataSocket() {
|
DataSocket::~DataSocket() {
|
||||||
if (socketId_ == -1) {
|
if (socketId_ <= 0) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -78,7 +78,11 @@ int DataSocket::setTimeOut(int t_seconds) {
|
|||||||
|
|
||||||
void DataSocket::close() {
|
void DataSocket::close() {
|
||||||
if (socketId_ > 0) {
|
if (socketId_ > 0) {
|
||||||
::close(socketId_);
|
if(::close(socketId_)){
|
||||||
|
throw SocketError("could not close socket");
|
||||||
|
}
|
||||||
|
socketId_ = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Socket ERROR: close called on bad socket\n");
|
throw std::runtime_error("Socket ERROR: close called on bad socket\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user