MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ~KUnixSocketObject

Method ~KUnixSocketObject

source/kernel/kunixsocket.cpp:31–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31KUnixSocketObject::~KUnixSocketObject() {
32 if (this->node) {
33 std::shared_ptr<FsNode> parent = this->node->getParent().lock();
34 if (parent) {
35 parent->removeChildByName(this->node->name);
36 }
37 }
38
39 std::shared_ptr<KUnixSocketObject> con = this->connection.lock();
40 if (con) {
41 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(con->lockCond);
42 con = this->connection.lock();
43 if (con) {
44 con->connection.reset();
45 con->inClosed = true;
46 con->outClosed = true;
47 BOXEDWINE_CONDITION_SIGNAL_ALL(con->lockCond);
48 }
49 }
50
51 std::shared_ptr<KUnixSocketObject> c = this->connecting.lock();
52 if (c) {
53 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(c->lockCond);
54 auto it = c->pendingConnections.begin();
55 while (it != c->pendingConnections.end()) {
56 std::shared_ptr<KUnixSocketObject> p = (*it).lock();
57 if (p == shared_from_this()) {
58 it = c->pendingConnections.erase(it);
59 } else {
60 it++;
61 }
62 }
63 this->connecting.reset();
64 }
65 {
66 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(this->lockCond);
67 for (auto& weakSocket : this->pendingConnections) {
68 std::shared_ptr<KUnixSocketObject> s = weakSocket.lock();
69 if (s) {
70 s->connecting.reset();
71 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(s->lockCond);
72 BOXEDWINE_CONDITION_SIGNAL_ALL(s->lockCond);
73 }
74 }
75 while (!msgs.empty()) {
76 this->msgs.pop();
77 }
78 BOXEDWINE_CONDITION_SIGNAL_ALL(this->lockCond);
79 }
80}
81
82void KUnixSocketObject::setBlocking(bool blocking) {
83 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(this->lockCond);

Callers

nothing calls this directly

Calls 9

removeChildByNameMethod · 0.80
lockMethod · 0.45
getParentMethod · 0.45
resetMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected