The old method was racy, it did use the callback function to deliver the
result, which need special handling because of possible deadlocks.
Now we use a request function which returns the value directely.
The old method is still available, but will get removed soon.
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
extern "C" {
}
#include <mISDN/q931.h>
extern "C" {
}
#include <mISDN/q931.h>
extern unsigned int mt_assign_pid;
extern unsigned int mt_assign_pid;
/* creating l3id */
l1l2l3_trace_header(p_m_mISDNport, this, L3_NEW_L3ID_REQ, DIRECTION_OUT);
/* creating l3id */
l1l2l3_trace_header(p_m_mISDNport, this, L3_NEW_L3ID_REQ, DIRECTION_OUT);
/* see MT_ASSIGN notes at do_layer3() */
mt_assign_pid = 0;
ret = p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_ASSIGN, 0, NULL);
/* see MT_ASSIGN notes at do_layer3() */
mt_assign_pid = 0;
ret = p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_ASSIGN, 0, NULL);
- if (mt_assign_pid == 0 || ret < 0) {
+ if (mt_assign_pid == 0 || ret < 0)
+ p_m_d_l3id = mt_assign_pid;
+ mt_assign_pid = ~0;
+#else
+ p_m_d_l3id = request_new_pid(p_m_mISDNport->ml3);
+ if (p_m_d_l3id == MISDN_PID_NONE)
+#endif
+ {
struct lcr_msg *message;
add_trace("callref", NULL, "no free id");
struct lcr_msg *message;
add_trace("callref", NULL, "no free id");
trigger_work(&p_m_d_delete);
return;
}
trigger_work(&p_m_d_delete);
return;
}
p_m_d_l3id = mt_assign_pid;
mt_assign_pid = ~0;
p_m_d_l3id = mt_assign_pid;
mt_assign_pid = ~0;
add_trace("callref", "new", "0x%x", p_m_d_l3id);
end_trace();
add_trace("callref", "new", "0x%x", p_m_d_l3id);
end_trace();
unsigned char mISDN_rand[256];
int mISDN_rand_count = 0;
unsigned char mISDN_rand[256];
int mISDN_rand_count = 0;
unsigned int mt_assign_pid = ~0;
unsigned int mt_assign_pid = ~0;
int mISDNsocket = -1;
static int upqueue_pipe[2];
int mISDNsocket = -1;
static int upqueue_pipe[2];
struct mISDNport *mISDNport = (struct mISDNport *)ml3->priv;
struct mbuffer *mb;
struct mISDNport *mISDNport = (struct mISDNport *)ml3->priv;
struct mbuffer *mb;
/* special MT_ASSIGN handling:
*
* if we request a PID from mlayer, we always do it while lcr is locked.
/* special MT_ASSIGN handling:
*
* if we request a PID from mlayer, we always do it while lcr is locked.
mt_assign_pid = pid;
return(0);
}
mt_assign_pid = pid;
return(0);
}
/* queue message, create, if required */
if (!l3m) {
l3m = alloc_l3_msg();
/* queue message, create, if required */
if (!l3m) {
l3m = alloc_l3_msg();