RX: Add rx_InterruptCall
authorAndrew Deason <adeason@sinenomine.net>
Fri, 8 Oct 2010 20:39:21 +0000 (15:39 -0500)
committerDerrick Brashear <shadow@dementia.org>
Mon, 18 Oct 2010 17:19:54 +0000 (10:19 -0700)
Add rx_InterruptCall, to cause a call to error out and wakeup anyone
waiting to write or read to that call.

Change-Id: I0747ac9107dac6b9a6d8b8c59120a756416aad58
Reviewed-on: http://gerrit.openafs.org/2982
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/libafsrpc/afsrpc.def
src/rx/rx.c
src/rx/rx_prototypes.h
src/shlibafsrpc/libafsrpc.map

index 0c9c222..2a0a15a 100755 (executable)
@@ -266,6 +266,7 @@ EXPORTS
         rx_FreeStatistics                       @271
        rx_SetConnHardDeadTime                  @272
        rx_SetConnIdleDeadTime                  @273
+       rx_InterruptCall                        @274
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA
index 775fd62..f65df8b 100644 (file)
@@ -4936,6 +4936,21 @@ rxi_ConnectionError(struct rx_connection *conn,
     }
 }
 
+/**
+ * Interrupt an in-progress call with the specified error and wakeup waiters.
+ *
+ * @param[in] call  The call to interrupt
+ * @param[in] error  The error code to send to the peer
+ */
+void
+rx_InterruptCall(struct rx_call *call, afs_int32 error)
+{
+    MUTEX_ENTER(&call->lock);
+    rxi_CallError(call, error);
+    rxi_SendCallAbort(call, NULL, 0, 1);
+    MUTEX_EXIT(&call->lock);
+}
+
 void
 rxi_CallError(struct rx_call *call, afs_int32 error)
 {
index 4dba7c6..7fcfc29 100644 (file)
@@ -80,6 +80,7 @@ extern void rx_SetArrivalProc(struct rx_call *call,
                                                    int index),
                              void * handle, int arg);
 extern afs_int32 rx_EndCall(struct rx_call *call, afs_int32 rc);
+extern void rx_InterruptCall(struct rx_call *call, afs_int32 error);
 extern void rx_Finalize(void);
 extern void rxi_PacketsUnWait(void);
 extern struct rx_service *rxi_FindService(osi_socket socket,
index 992e8d3..adc6842 100755 (executable)
        rx_identity_new;
        rx_identity_freeContents;
        rx_identity_free;
+       rx_InterruptCall;
     local:
        *;
 };