* soabort() is used to abruptly tear down a connection, such as when a * resource limit is reached (listen queue depth exceeded), or if a listen * socket is closed while there are sockets waiting to be accepted. * * This interface is tricky, because it is called on an unreferenced socket, * and must be called only by a thread that has actually removed the socket * from the listen queue it wa
| 1267 | * to review in the future. |
| 1268 | */ |
| 1269 | void |
| 1270 | soabort(struct socket *so) |
| 1271 | { |
| 1272 | |
| 1273 | /* |
| 1274 | * In as much as is possible, assert that no references to this |
| 1275 | * socket are held. This is not quite the same as asserting that the |
| 1276 | * current thread is responsible for arranging for no references, but |
| 1277 | * is as close as we can get for now. |
| 1278 | */ |
| 1279 | KASSERT(so->so_count == 0, ("soabort: so_count")); |
| 1280 | KASSERT((so->so_state & SS_PROTOREF) == 0, ("soabort: SS_PROTOREF")); |
| 1281 | KASSERT(so->so_state & SS_NOFDREF, ("soabort: !SS_NOFDREF")); |
| 1282 | VNET_SO_ASSERT(so); |
| 1283 | |
| 1284 | if (so->so_proto->pr_usrreqs->pru_abort != NULL) |
| 1285 | (*so->so_proto->pr_usrreqs->pru_abort)(so); |
| 1286 | SOCK_LOCK(so); |
| 1287 | sofree(so); |
| 1288 | } |
| 1289 | |
| 1290 | int |
| 1291 | soaccept(struct socket *so, struct sockaddr **nam) |
no test coverage detected