*** 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>
|
2010-07-02 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Fixed crash due to octstr_delete on immutable string in mm7 receiver
|
* Fixed crash due to octstr_delete on immutable string in mm7 receiver
|
||||||
2010-05-26 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2010-05-26 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
|
|
@ -359,7 +359,7 @@ static void handle_mm1(MM1Settings *mm1)
|
||||||
{
|
{
|
||||||
/* stop smsc, start GPRS, transact, stop GPRS, start SMSC. And so on. */
|
/* stop smsc, start GPRS, transact, stop GPRS, start SMSC. And so on. */
|
||||||
MM1Request *r;
|
MM1Request *r;
|
||||||
|
|
||||||
mms_info(0, "mmsbox-mm1", NULL, "handle_mm1 started");
|
mms_info(0, "mmsbox-mm1", NULL, "handle_mm1 started");
|
||||||
mm1->sender_alive++;
|
mm1->sender_alive++;
|
||||||
while ((r = gwlist_consume(mm1->requests)) != NULL) {
|
while ((r = gwlist_consume(mm1->requests)) != NULL) {
|
||||||
|
@ -512,10 +512,28 @@ static void handle_mm1(MM1Settings *mm1)
|
||||||
octstr_destroy(body);
|
octstr_destroy(body);
|
||||||
octstr_destroy(ms);
|
octstr_destroy(ms);
|
||||||
mms_destroy(m);
|
mms_destroy(m);
|
||||||
} while (gwlist_len(mm1->requests) > 0 &&
|
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);
|
(r = gwlist_consume(mm1->requests)) != NULL);
|
||||||
|
|
||||||
kill_gprs:
|
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. */
|
if (pid > 0) { /* stop GPRS, restart SMSC connection. */
|
||||||
int xkill, status;
|
int xkill, status;
|
||||||
pid_t wpid;
|
pid_t wpid;
|
||||||
|
@ -532,7 +550,7 @@ static void handle_mm1(MM1Settings *mm1)
|
||||||
} while (1);
|
} while (1);
|
||||||
gwthread_sleep(2);
|
gwthread_sleep(2);
|
||||||
}
|
}
|
||||||
|
after_gprs_dead:
|
||||||
if (mm1->smsc_on) {
|
if (mm1->smsc_on) {
|
||||||
system(octstr_get_cstr(mm1->smsc_on));
|
system(octstr_get_cstr(mm1->smsc_on));
|
||||||
gwthread_sleep(5);
|
gwthread_sleep(5);
|
||||||
|
@ -610,10 +628,13 @@ 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_WRITEFUNCTION, write_octstr_data);
|
||||||
curl_easy_setopt(cl, CURLOPT_WRITEDATA, s);
|
curl_easy_setopt(cl, CURLOPT_WRITEDATA, s);
|
||||||
curl_easy_setopt(cl, CURLOPT_NOSIGNAL, 1L);
|
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: */*");
|
h = curl_slist_append(h, "Accept: */*");
|
||||||
if (body) { /* POST. */
|
if (body) { /* POST. */
|
||||||
h = curl_slist_append(h, "Content-Type: application/vnd.wap.mms-message");
|
h = curl_slist_append(h, "Content-Type: application/vnd.wap.mms-message");
|
||||||
curl_easy_setopt(cl, CURLOPT_POSTFIELDS, octstr_get_cstr(body));
|
curl_easy_setopt(cl, CURLOPT_POSTFIELDS, octstr_get_cstr(body));
|
||||||
curl_easy_setopt(cl, CURLOPT_POSTFIELDSIZE, octstr_len(body));
|
curl_easy_setopt(cl, CURLOPT_POSTFIELDSIZE, octstr_len(body));
|
||||||
}
|
}
|
||||||
|
@ -635,7 +656,7 @@ static Octstr *fetch_content(Octstr *url, Octstr *proxy, Octstr *body, int *hsta
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define MAX_GPRS_WAIT 60
|
#define MAX_GPRS_WAIT 80
|
||||||
#define GPRS_POLL 5
|
#define GPRS_POLL 5
|
||||||
static long start_gprs(Octstr *cmd, Octstr *pid_cmd)
|
static long start_gprs(Octstr *cmd, Octstr *pid_cmd)
|
||||||
{
|
{
|
||||||
|
@ -661,6 +682,14 @@ static long start_gprs(Octstr *cmd, Octstr *pid_cmd)
|
||||||
WIFEXITED(status))
|
WIFEXITED(status))
|
||||||
return -1;
|
return -1;
|
||||||
} while (GPRS_POLL*ct++ < MAX_GPRS_WAIT);
|
} 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;
|
return -1;
|
||||||
} else if (pid == 0) { /* child. */
|
} else if (pid == 0) { /* child. */
|
||||||
List *l = octstr_split_words(cmd);
|
List *l = octstr_split_words(cmd);
|
||||||
|
|
Loading…
Reference in New Issue