;deny=0.0.0.0/0.0.0.0
;permit=209.16.236.73/255.255.255.0
;
+; If the device connected via this user accepts input slowly,
+; the timeout for writes to it can be increased to keep it
+; from being disconnected (value is in milliseconds)
+;
+; writetimeout = 100
+;
; Authorization for various classes
;read = system,call,log,verbose,command,agent,user
;write = system,call,log,verbose,command,agent,user
} else if (!strcasecmp(v->name, "permit") ||
!strcasecmp(v->name, "deny")) {
ha = ast_append_ha(v->name, v->value, ha);
- }
+ } else if (!strcasecmp(v->name, "writetimeout")) {
+ int val = atoi(v->value);
+
+ if (val < 100)
+ ast_log(LOG_WARNING, "Invalid writetimeout value '%s' at line %d\n", v->value, v->lineno);
+ else
+ s->writetimeout = val;
+ }
v = v->next;
}
ast_mutex_lock(&s->__lock);
s->busy = 0;
while(s->eventq) {
- if (ast_carefulwrite(s->fd, s->eventq->eventdata, strlen(s->eventq->eventdata), 100)) {
+ if (ast_carefulwrite(s->fd, s->eventq->eventdata, strlen(s->eventq->eventdata), s->writetimeout)) {
ret = -1;
break;
}
}
memset(s, 0, sizeof(struct mansession));
memcpy(&s->sin, &sin, sizeof(sin));
+ s->writetimeout = 100;
if(! block_sockets) {
/* For safety, make sure socket is non-blocking */
ast_mutex_lock(&s->__lock);
if (s->busy) {
append_event(s, tmp);
- } else if (ast_carefulwrite(s->fd, tmp, tmp_next - tmp, 100) < 0) {
+ } else if (ast_carefulwrite(s->fd, tmp, tmp_next - tmp, s->writetimeout) < 0) {
ast_log(LOG_WARNING, "Disconnecting slow (or gone) manager session!\n");
s->dead = 1;
pthread_kill(s->t, SIGURG);