summaryrefslogtreecommitdiffstats
path: root/mISDN.cpp
diff options
context:
space:
mode:
authorSuper User2008-05-02 21:40:31 +0200
committerSuper User2008-05-02 21:40:31 +0200
commit9ae0e0e4e2359705ec9c193a65cfc55ab05f7b26 (patch)
tree3ae0a3d3dc344d0843238233880d889f1101a973 /mISDN.cpp
parentSOCKET BRANCH: (diff)
downloadlcr-9ae0e0e4e2359705ec9c193a65cfc55ab05f7b26.tar.gz
lcr-9ae0e0e4e2359705ec9c193a65cfc55ab05f7b26.tar.xz
lcr-9ae0e0e4e2359705ec9c193a65cfc55ab05f7b26.zip
mISDN-socket port opens
modified: mISDN.cpp modified: main.c
Diffstat (limited to 'mISDN.cpp')
-rw-r--r--mISDN.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/mISDN.cpp b/mISDN.cpp
index 6e74a90..9bff716 100644
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -3153,7 +3153,7 @@ struct mISDNport *mISDNport_open(int port, int ptp, int force_nt, int l2hold, st
/* allocate ressources of port */
#ifdef SOCKET_MISDN
- /* open layer 3 */
+ /* open layer 3 and init upqueue */
protocol = (nt)?L3_PROTOCOL_DSS1_USER:L3_PROTOCOL_DSS1_NET;
prop = 0;
if (ptp) // ptp forced
@@ -3165,9 +3165,11 @@ struct mISDNport *mISDNport_open(int port, int ptp, int force_nt, int l2hold, st
mISDNport->ml3 = open_layer3(port-1, protocol, prop , do_layer3, mISDNport);
if (!mISDNport->ml3)
{
- PERROR_RUNTIME("Cannot get layer(%d) id of port %d\n", nt?2:4, port);
+ PERROR_RUNTIME("oper_layer3() failed for port %d\n", port);
+ mISDNport_close(mISDNport);
return(NULL);
}
+ mqueue_init(&mISDNport->upqueue);
#if 0
/* if ntmode, establish L1 to send the tei removal during start */
@@ -3352,11 +3354,6 @@ struct mISDNport *mISDNport_open(int port, int ptp, int force_nt, int l2hold, st
}
#endif
-#ifdef SOCKET_MISDN
- /* init stack queue */
- mqueue_init(&mISDNport->upqueue);
-#endif
-
/* initially, we assume that the link is down, exept for nt-ptmp */
mISDNport->l2link = (mISDNport->ntmode && !mISDNport->ptp)?1:0;
@@ -3448,8 +3445,12 @@ void mISDNport_close(struct mISDNport *mISDNport)
}
#ifdef SOCKET_MISDN
- close_layer3(mISDNport->ml3);
- mqueue_purge(&mISDNport->upqueue);
+ /* close layer 3, if open and purge upqueue */
+ if (mISDNport->ml3)
+ {
+ close_layer3(mISDNport->ml3);
+ mqueue_purge(&mISDNport->upqueue);
+ }
#else
/* free ressources of port */
msg_queue_purge(&mISDNport->downqueue);