return {};
}
+void Stub::RemoveAcceptedPorts(std::string instance) {
+ auto iter = ports_.begin();
+ while (iter != ports_.end()) {
+ if ((*iter)->GetInstance().compare(instance) == 0) {
+ LOGI("Close: fd(%d)", (*iter)->GetFd());
+ iter = ports_.erase(iter);
+ } else {
+ iter++;
+ }
+ }
+}
+
gboolean Stub::OnDataReceived(GIOChannel *gio, GIOCondition cond,
gpointer data) {
Stub* stub = static_cast<Stub*>(data);
if (recv(fd, buffer, sizeof(buffer), MSG_PEEK | MSG_DONTWAIT) == 0) {
LOGW("Socket was disconnected from proxy. fd(%d)", fd);
stub->listener_->OnDisconnected(p->GetId(), p->GetInstance());
- stub->ports_.remove(p);
+ stub->RemoveAcceptedPorts(p->GetInstance());
if (aul_rpc_port_notify_rpc_finished() != AUL_R_OK)
LOGW("Failed to notify rpc finished");
if (ret != 0) {
LOGW("Invalid protocol");
stub->listener_->OnDisconnected(p->GetId(), p->GetInstance());
- stub->ports_.remove(p);
+ stub->RemoveAcceptedPorts(p->GetInstance());
if (aul_rpc_port_notify_rpc_finished() != AUL_R_OK)
LOGW("Failed to notify rpc finished");
if (aul_rpc_port_notify_rpc_finished() != AUL_R_OK)
LOGW("Failed to notify rpc finished");
}
- stub->ports_.remove(p);
+ stub->RemoveAcceptedPorts(p->GetInstance());
break;
}
}