mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-28 17:48:21 +00:00
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:
parent
fc1e1a91f2
commit
f2841e0280
@ -1261,6 +1261,7 @@ static FIO_WRITE_FUNCTION(misdn_write)
|
|||||||
struct mISDNhead *hh = (struct mISDNhead *)wbuf;
|
struct mISDNhead *hh = (struct mISDNhead *)wbuf;
|
||||||
int size = *datalen;
|
int size = *datalen;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
ftdm_wait_flag_t wflags;
|
||||||
|
|
||||||
assert(priv);
|
assert(priv);
|
||||||
|
|
||||||
@ -1284,6 +1285,15 @@ static FIO_WRITE_FUNCTION(misdn_write)
|
|||||||
memcpy(wbuf + MISDN_HEADER_LEN, data, size);
|
memcpy(wbuf + MISDN_HEADER_LEN, data, size);
|
||||||
size += MISDN_HEADER_LEN;
|
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
|
#ifdef MISDN_DEBUG_IO
|
||||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "mISDN writing %d bytes to channel socket %d [dev.ch: %d.%d]\n",
|
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);
|
size, ftdmchan->sockfd, priv->addr.dev, priv->addr.channel);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user