ftmod_misdn: misdn_write() workaround for signalling drivers that do not use write polling.

Wait till the channel is actually ready to send data.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2012-03-23 01:00:26 +01:00
parent fc1e1a91f2
commit f2841e0280

View File

@ -1261,6 +1261,7 @@ static FIO_WRITE_FUNCTION(misdn_write)
struct mISDNhead *hh = (struct mISDNhead *)wbuf;
int size = *datalen;
int retval = 0;
ftdm_wait_flag_t wflags;
assert(priv);
@ -1284,6 +1285,15 @@ static FIO_WRITE_FUNCTION(misdn_write)
memcpy(wbuf + MISDN_HEADER_LEN, data, size);
size += MISDN_HEADER_LEN;
/* wait for channel to get ready */
wflags = FTDM_WRITE;
retval = misdn_wait(ftdmchan, &wflags, 20);
if (retval) {
/* timeout, io error */
*datalen = 0;
return FTDM_FAIL;
}
#ifdef MISDN_DEBUG_IO
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN writing %d bytes to channel socket %d [dev.ch: %d.%d]\n",
size, ftdmchan->sockfd, priv->addr.dev, priv->addr.channel);