subscr: Store the state of a subscr request for inspection.
diff --git a/openbsc/src/gsm_subscriber.c b/openbsc/src/gsm_subscriber.c
index ec639a9..9b8adeb 100644
--- a/openbsc/src/gsm_subscriber.c
+++ b/openbsc/src/gsm_subscriber.c
@@ -58,11 +58,22 @@
 	/* the requested channel type */
 	int channel_type;
 
+	/* what did we do */
+	int state;
+
 	/* the callback data */
 	gsm_cbfn *cbfn;
 	void *param;
 };
 
+enum {
+	REQ_STATE_INITIAL,
+	REQ_STATE_QUEUED,
+	REQ_STATE_PAGED,
+	REQ_STATE_FAILED_START,
+	REQ_STATE_DISPATCHED,
+};
+
 /*
  * We got the channel assigned and can now hand this channel
  * over to one of our callbacks.
@@ -98,6 +109,7 @@
 	 * the subscr_put_channel work as required...
 	 */
 	request = (struct subscr_request *)subscr->requests.next;
+	request->state = REQ_STATE_DISPATCHED;
 	llist_del(&request->entry);
 	subscr->in_callback = 1;
 	request->cbfn(hooknum, event, msg, data, request->param);
@@ -178,11 +190,13 @@
 	assert(!llist_empty(&subscr->requests));
 
 	request = (struct subscr_request *)subscr->requests.next;
+	request->state = REQ_STATE_PAGED;
 	rc = paging_request(subscr->net, subscr, request->channel_type,
 			    subscr_paging_cb, subscr);
 
 	/* paging failed, quit now */
 	if (rc <= 0) {
+		request->state = REQ_STATE_FAILED_START;
 		subscr_paging_cb(GSM_HOOK_RR_PAGING, GSM_PAGING_BUSY,
 				 NULL, NULL, subscr);
 	}
@@ -206,6 +220,7 @@
 	request->channel_type = type;
 	request->cbfn = cbfn;
 	request->param = param;
+	request->state = REQ_STATE_INITIAL;
 
 	/*
 	 * FIXME: We might be able to assign more than one
@@ -219,6 +234,7 @@
 	} else {
 		/* this will be picked up later, from subscr_put_channel */
 		llist_add_tail(&request->entry, &subscr->requests);
+		request->state = REQ_STATE_QUEUED;
 	}
 }