MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / process_accept

Function process_accept

src/plugin/ipc/socket/socketwrappers.cpp:138–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138static void
139process_accept(int ret, int sockfd, struct sockaddr *addr, socklen_t *addrlen)
140{
141 JASSERT(ret != -1);
142 Connection *parent = SocketConnList::instance().getConnection(sockfd);
143 if (parent == NULL) {
144 JTRACE("unable to get the connection.");
145 return;
146 }
147
148 SocketConnection *con = NULL;
149
150 // FIXME: Checking for conType is ugly; fix class design
151 if (parent->conType() == Connection::TCP) {
152 TcpConnection *tcpParent = dynamic_cast<TcpConnection *>(parent);
153 con = new TcpConnection(*tcpParent, ConnectionIdentifier::null());
154 } else if (parent->conType() == Connection::RAW) {
155 RawSocketConnection *rawSockParent =
156 dynamic_cast<RawSocketConnection *>(parent);
157 con = new RawSocketConnection(*rawSockParent, ConnectionIdentifier::null());
158 }
159
160 if (con == NULL) {
161 JTRACE("accept operation on unsupported socket type.");
162 return;
163 } else {
164 SocketConnList::instance().add(ret, dynamic_cast<Connection *>(con));
165 }
166}
167
168extern "C" int
169accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)

Callers 2

acceptFunction · 0.85
accept4Function · 0.85

Calls 3

getConnectionMethod · 0.80
conTypeMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected