DrivenEngine channels are now shared_ptr

This commit is contained in:
2022-01-05 12:50:16 -05:00
parent 6b23651606
commit c733023823
7 changed files with 103 additions and 87 deletions

View File

@@ -169,14 +169,15 @@ public:
}
}
void handle_new_closed_sockets() {
std::set<int> chans;
driven_->drv_get_new_closed(chans);
for (int chid : chans) {
if (socket_[chid] != INVALID_SOCKET) {
assert(close(socket_[chid]) == 0);
socket_[chid] = INVALID_SOCKET;
connected_[chid] = false;
void handle_new_closed_sockets() {
for (int chid = 1; chid < MAX_CHAN; chid++) {
if (driven_->drv_get_channel_released(chid)) {
if (socket_[chid] != INVALID_SOCKET) {
assert(close(socket_[chid]) == 0);
socket_[chid] = INVALID_SOCKET;
connected_[chid] = false;
}
driven_->drv_notify_close(chid, "");
}
}
}