diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-23 17:37:24 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-23 17:37:24 +0000 |
commit | bc009cd7a3a20d44d5fbed8b4cd2ba4c227a7b9a (patch) | |
tree | 6bf75b49ebe365142d3ef204d889dec8c03714c4 /channels/chan_zap.c | |
parent | 913beb48cab9d7111f078d0068d5b8dd0ee3a489 (diff) |
Make the guardtime work even if the date is < the year 1970, and if something weird happens in zap, don't stack overflow
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3636 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-x | channels/chan_zap.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 43ed33524..73876d6ff 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -6245,7 +6245,7 @@ static inline int available(struct zt_pvt *p, int channelmatch, int groupmatch, if (p->dnd) return 0; /* If guard time, definitely not */ - if (time(NULL) < p->guardtime) + if (p->guardtime && (time(NULL) < p->guardtime)) return 0; /* If no owner definitely available */ @@ -6503,7 +6503,7 @@ static struct ast_channel *zt_request(char *type, int format, void *data) if (roundrobin) round_robin[x] = p; #if 0 - ast_verbose("name = %s, %d\n",p->owner->name,p->channel); + ast_verbose("name = %s, %d, %d, %d\n",p->owner ? p->owner->name : "<none>", p->channel, channelmatch, groupmatch); #endif if (p && available(p, channelmatch, groupmatch, &busy)) { if (option_debug) @@ -6595,7 +6595,7 @@ next: ast_mutex_unlock(lock); restart_monitor(); if (!tmp) { - if (busy) { + if (busy && (channelmatch != CHAN_PSEUDO)) { tmp = zt_request("Zap", format, "pseudo"); if (tmp) { char newname[80]; @@ -6605,6 +6605,8 @@ next: ast_setstate(tmp, AST_STATE_BUSY); ast_mutex_unlock(&tmp->lock); } + } else if (busy) { + ast_log(LOG_WARNING, "Whoa, the pseudo was busy somehow!\n"); } } return tmp; |