*** empty log message ***
This commit is contained in:
parent
6e23d68a16
commit
f23dfb66b9
|
@ -1,3 +1,5 @@
|
|||
2010-08-04 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Fixed mmsbox-mm1 hangs under load, thanks to Piotr Isajew <pki at ex.com.pl>
|
||||
2010-07-02 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
* Fixed crash due to octstr_delete on immutable string in mm7 receiver
|
||||
2010-05-26 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||
|
|
|
@ -512,10 +512,28 @@ static void handle_mm1(MM1Settings *mm1)
|
|||
octstr_destroy(body);
|
||||
octstr_destroy(ms);
|
||||
mms_destroy(m);
|
||||
r = NULL;
|
||||
pid_t wp;
|
||||
int st;
|
||||
wp = waitpid(pid, &st, WNOHANG);
|
||||
if(wp == pid && WIFEXITED(st)) {
|
||||
mms_info(0, "mmsbox-mm1", NULL, "GPRS pid (%d) appears to be dead - quitting loop", pid);
|
||||
goto after_gprs_dead;
|
||||
}
|
||||
} while (gwlist_len(mm1->requests) > 0 &&
|
||||
(r = gwlist_consume(mm1->requests)) != NULL);
|
||||
|
||||
kill_gprs:
|
||||
if(r != NULL) {
|
||||
if(r->waiter_exists) {
|
||||
pthread_mutex_unlock(&r->mutex);
|
||||
pthread_cond_signal(&r->cond);
|
||||
} else{
|
||||
gw_free(r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (pid > 0) { /* stop GPRS, restart SMSC connection. */
|
||||
int xkill, status;
|
||||
pid_t wpid;
|
||||
|
@ -532,7 +550,7 @@ static void handle_mm1(MM1Settings *mm1)
|
|||
} while (1);
|
||||
gwthread_sleep(2);
|
||||
}
|
||||
|
||||
after_gprs_dead:
|
||||
if (mm1->smsc_on) {
|
||||
system(octstr_get_cstr(mm1->smsc_on));
|
||||
gwthread_sleep(5);
|
||||
|
@ -610,6 +628,9 @@ static Octstr *fetch_content(Octstr *url, Octstr *proxy, Octstr *body, int *hsta
|
|||
curl_easy_setopt(cl, CURLOPT_WRITEFUNCTION, write_octstr_data);
|
||||
curl_easy_setopt(cl, CURLOPT_WRITEDATA, s);
|
||||
curl_easy_setopt(cl, CURLOPT_NOSIGNAL, 1L);
|
||||
curl_easy_setopt(cl, CURLOPT_TIMEOUT, 120L);
|
||||
curl_easy_setopt(cl, CURLOPT_FORBID_REUSE, 1L);
|
||||
curl_easy_setopt(cl, CURLOPT_CONNECTTIMEOUT, 40L);
|
||||
|
||||
h = curl_slist_append(h, "Accept: */*");
|
||||
if (body) { /* POST. */
|
||||
|
@ -635,7 +656,7 @@ static Octstr *fetch_content(Octstr *url, Octstr *proxy, Octstr *body, int *hsta
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_GPRS_WAIT 60
|
||||
#define MAX_GPRS_WAIT 80
|
||||
#define GPRS_POLL 5
|
||||
static long start_gprs(Octstr *cmd, Octstr *pid_cmd)
|
||||
{
|
||||
|
@ -661,6 +682,14 @@ static long start_gprs(Octstr *cmd, Octstr *pid_cmd)
|
|||
WIFEXITED(status))
|
||||
return -1;
|
||||
} while (GPRS_POLL*ct++ < MAX_GPRS_WAIT);
|
||||
/* Timed out, but still need to wait for child pid, as
|
||||
start-gprs script is still running and we don't need a
|
||||
zombie */
|
||||
pid_t rpid;
|
||||
int st;
|
||||
|
||||
rpid = waitpid(pid, &st, 0);
|
||||
mms_info(0, "mmsbox-mm1", NULL, "pid %d terminated", pid);
|
||||
return -1;
|
||||
} else if (pid == 0) { /* child. */
|
||||
List *l = octstr_split_words(cmd);
|
||||
|
|
Loading…
Reference in New Issue