Create a structure to hold client information in the network server and fix i2c hanging on destructor when bus is not available.

This commit is contained in:
Adam Honse 2020-05-06 23:57:29 -05:00
parent 9b8a0d465e
commit 6bfc9dd9db
3 changed files with 55 additions and 44 deletions

View file

@ -256,9 +256,6 @@ void DetectI2CBusses()
device_string[strlen(device_string) - 1] = 0x00;
close(test_fd);
bus = new i2c_smbus_linux();
strcpy(bus->device_name, device_string);
strcpy(device_string, "/dev/");
strcat(device_string, ent->d_name);
@ -266,11 +263,12 @@ void DetectI2CBusses()
if (test_fd < 0)
{
delete bus;
ent = readdir(dir);
continue;
}
bus = new i2c_smbus_linux();
strcpy(bus->device_name, device_string);
bus->handle = test_fd;
busses.push_back(bus);
}