-
-//
-// Terminate a Connection normally.
-// This is assumed to be properly sequenced, so no thread races are possible.
-//
-void Connection::terminate()
-{
- // cleanly discard port rights
- assert(state == idle);
- mClientPort.modRefs(MACH_PORT_RIGHT_SEND, -1); // discard surplus send right
- assert(mClientPort.getRefs(MACH_PORT_RIGHT_SEND) == 1); // one left for final reply
- secdebug("SS", "Connection %p terminated", this);
-}
-
-
-//
-// Abort a Connection.
-// This may be called from thread A while thread B is working a request for the Connection,
-// so we must be careful.
-//
-void Connection::abort(bool keepReplyPort)
-{
- StLock<Mutex> _(*this);
- if (!keepReplyPort)
- mClientPort.destroy(); // dead as a doornail already
- switch (state) {
- case idle:
- secdebug("SS", "Connection %p aborted", this);
- break;
- case busy:
- state = dying; // shoot me soon, please
- if (agentWait)
- agentWait->disconnect();
- secdebug("SS", "Connection %p abort deferred (busy)", this);
- break;
- default:
- assert(false); // impossible (we hope)
- break;
- }
-}
-
-