TMXR: Properly initialize TMXR and UNIT connections
This will fix the SEGFAULT discussed in #528
This commit is contained in:
parent
335b4ef210
commit
ba962252b0
1 changed files with 17 additions and 3 deletions
20
sim_tmxr.c
20
sim_tmxr.c
|
@ -986,15 +986,29 @@ if (mp->last_poll_time == 0) { /* first poll initializa
|
||||||
if (!uptr) /* Attached ? */
|
if (!uptr) /* Attached ? */
|
||||||
return -1; /* No connections are possinle! */
|
return -1; /* No connections are possinle! */
|
||||||
|
|
||||||
|
uptr->dynflags |= UNIT_TM_POLL; /* Tag as polling unit */
|
||||||
|
uptr->tmxr = (void *)mp; /* Connect UNIT to TMXR */
|
||||||
|
|
||||||
if (mp->poll_interval == 0) /* Assure reasonable polling interval */
|
if (mp->poll_interval == 0) /* Assure reasonable polling interval */
|
||||||
mp->poll_interval = TMXR_DEFAULT_CONNECT_POLL_INTERVAL;
|
mp->poll_interval = TMXR_DEFAULT_CONNECT_POLL_INTERVAL;
|
||||||
|
|
||||||
if (!(uptr->dynflags & TMUF_NOASYNCH)) { /* if asynch not disabled */
|
if (!(uptr->dynflags & TMUF_NOASYNCH)) /* if asynch not disabled */
|
||||||
sim_cancel (uptr);
|
sim_cancel (uptr);
|
||||||
}
|
|
||||||
for (i=0; i < mp->lines; i++) {
|
for (i=0; i < mp->lines; i++) {
|
||||||
|
if (mp->ldsc[i].uptr)
|
||||||
|
mp->ldsc[i].uptr->dynflags |= UNIT_TM_POLL; /* Tag as polling unit */
|
||||||
|
else
|
||||||
|
mp->ldsc[i].uptr = uptr; /* default line input polling to primary poll unit */
|
||||||
|
if (mp->ldsc[i].o_uptr)
|
||||||
|
mp->ldsc[i].o_uptr->dynflags |= UNIT_TM_POLL;/* Tag as polling unit */
|
||||||
|
else
|
||||||
|
mp->ldsc[i].o_uptr = uptr; /* default line output polling to primary poll unit */
|
||||||
if (!(mp->uptr->dynflags & TMUF_NOASYNCH)) { /* if asynch not disabled */
|
if (!(mp->uptr->dynflags & TMUF_NOASYNCH)) { /* if asynch not disabled */
|
||||||
sim_cancel (mp->ldsc[i].uptr);
|
if (mp->ldsc[i].uptr)
|
||||||
|
sim_cancel (mp->ldsc[i].uptr);
|
||||||
|
if (mp->ldsc[i].o_uptr)
|
||||||
|
sim_cancel (mp->ldsc[i].o_uptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue