Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Im also having this problem. I even upgraded SER to 0.9.7-pre8, but still the same. I tend to think, though, that this is a MySQL version problem. I installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or just upgrading it (or maybe downgrading to 4.1), should do the trick.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Thanks for the reply. Yup i tried upgrading to MySQL 5.0.37, but still sometimes ser just could not connect to mysql, even if mysql is running. I will try downgrading it, but is there a way in the configuration to detect whether ser can connect to mysql and if not it will drop all calls?
Nhadie
Andrey Kuprianov wrote:
Im also having this problem. I even upgraded SER to 0.9.7-pre8, but still the same. I tend to think, though, that this is a MySQL version problem. I installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or just upgrading it (or maybe downgrading to 4.1), should do the trick.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Sorry.. Im afraid its impossible to do such check. Actually, in my case, when SER loses MYSQL conn, then it would reply with 403 Forbidden to all my clients. However, if at least one call is still in progress, there's nothing you can do about it.
Hope it works out for you!
Andrey.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Thanks for the reply. Yup i tried upgrading to MySQL 5.0.37, but still sometimes ser just could not connect to mysql, even if mysql is running. I will try downgrading it, but is there a way in the configuration to detect whether ser can connect to mysql and if not it will drop all calls?
Nhadie
Andrey Kuprianov wrote:
Im also having this problem. I even upgraded SER to 0.9.7-pre8, but still the same. I tend to think, though, that this is a MySQL version problem. I installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or just upgrading it (or maybe downgrading to 4.1), should do the trick.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Hi can you help me on how i can configure it to send 403 Forbidden if it cannot connect to mysql. That's good enough for now until i figure out why ser loses connection to mysql.
thanks in advanced
nhadie
Andrey Kuprianov wrote:
Sorry.. Im afraid its impossible to do such check. Actually, in my case, when SER loses MYSQL conn, then it would reply with 403 Forbidden to all my clients. However, if at least one call is still in progress, there's nothing you can do about it.
Hope it works out for you!
Andrey.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Thanks for the reply. Yup i tried upgrading to MySQL 5.0.37, but still sometimes ser just could not connect to mysql, even if mysql is running. I will try downgrading it, but is there a way in the configuration to detect whether ser can connect to mysql and if not it will drop all calls?
Nhadie
Andrey Kuprianov wrote:
Im also having this problem. I even upgraded SER to 0.9.7-pre8, but still the same. I tend to think, though, that this is a MySQL version problem. I installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or just upgrading it (or maybe downgrading to 4.1), should do the trick.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
On Thu, May 24, 2007 at 05:09:43PM +0800, Nhadie wrote:
Hi can you help me on how i can configure it to send 403 Forbidden if it cannot connect to mysql. That's good enough for now until i figure out why ser loses connection to mysql.
you can use mysql_ping function from C Mysql API.
if(!your_module_mysql_ping()) { sl_reply("403 Forbidden"); break; }
smth. like this.
thanks in advanced
nhadie
Wbr,
In my case, SER send 403 automatically, when MySQL connection is lost. I didnt do any special configuration..
On 5/24/07, Alexandr Dubovikov shurik@start4.info wrote:
On Thu, May 24, 2007 at 05:09:43PM +0800, Nhadie wrote:
Hi can you help me on how i can configure it to send 403 Forbidden if it cannot connect to mysql. That's good enough for now until i figure out why ser loses connection to mysql.
you can use mysql_ping function from C Mysql API.
if(!your_module_mysql_ping()) { sl_reply("403 Forbidden"); break; }
smth. like this.
thanks in advanced
nhadie
Wbr,
Alexandr Dubovikov * baron@iRC RusNet * mailto:shurik@start4.info AD1-UANIC * ICQ: 122351182 * http://www.start4.info
Check the archives. I've answered this a couple of times already.
mysql 5.0.X has modified the default behaviour of how the socket timeout works. By default, it times out connections after a period of time. There was a patch after about 5.0.12 to allow people to modify this behaviour, but the patch didn't work until 5.0.19.
In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after a timed out socket, you need to modify the my_con.c in $SER-SRC/modules/mysql and recompile the mysql module.
I've attached a modified my_con.c file that has the correct options to utilise the patched mysql code. It will fix the reconnect issues (allowing SER to reconnect once the socket has timed out).
N.
Andrey Kuprianov wrote:
Im also having this problem. I even upgraded SER to 0.9.7-pre8, but still the same. I tend to think, though, that this is a MySQL version problem. I installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or just upgrading it (or maybe downgrading to 4.1), should do the trick.
On 5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls anymore? Because i had a problem, when mysql died, ser still continued to allow calls and i was not able to account it.
How can i resolve this. Thank You in Advance.
Regards Ronald
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
/* * $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $ * * * Copyright (C) 2001-2004 iptel.org * * This file is part of ser, a free SIP server. * * ser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: * info@iptel.org * * ser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <string.h> #include <time.h> #include "my_con.h" #include "../../mem/mem.h" #include "../../dprint.h" #include "utils.h"
/* * Create a new connection structure, * open the MySQL connection and set reference count to 1 */ struct my_con* new_connection(struct my_id* id) { struct my_con* ptr; my_bool my_true; my_true=1;
if (!id) { LOG(L_ERR, "new_connection(): Invalid parameter value\n"); return 0; }
ptr = (struct my_con*)pkg_malloc(sizeof(struct my_con)); if (!ptr) { LOG(L_ERR, "new_connection(): No memory left\n"); return 0; }
memset(ptr, 0, sizeof(struct my_con)); ptr->ref = 1; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "new_connection(): No enough memory\n"); goto err; }
mysql_init(ptr->con); mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true);
if (!mysql_real_connect(ptr->con, id->host.s, id->username.s, id->password.s, id->database.s, id->port, 0, 0)) { LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con)); mysql_close(ptr->con); goto err; }
ptr->timestamp = time(0);
ptr->id = id; return ptr;
err: if (ptr && ptr->con) pkg_free(ptr->con); if (ptr) pkg_free(ptr); return 0; }
/* * Close the connection and release memory */ void free_connection(struct my_con* con) { if (!con) return; if (con->res) mysql_free_result(con->res); if (con->id) free_my_id(con->id); if (con->con) { mysql_close(con->con); pkg_free(con->con); } pkg_free(con); }
Nice! Thanx.
On 5/24/07, SIP sip@arcdiv.com wrote:
Check the archives. I've answered this a couple of times already.
mysql 5.0.X has modified the default behaviour of how the socket timeout works. By default, it times out connections after a period of time. There was a patch after about 5.0.12 to allow people to modify this behaviour, but the patch didn't work until 5.0.19.
In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after a timed out socket, you need to modify the my_con.c in $SER-SRC/modules/mysql and recompile the mysql module.
I've attached a modified my_con.c file that has the correct options to utilise the patched mysql code. It will fix the reconnect issues (allowing SER to reconnect once the socket has timed out).
N.
Andrey Kuprianov wrote: Im also having this problem. I even upgraded SER to 0.9.7-pre8, but
still
the same.
I tend to think, though, that this is a MySQL version problem.
I
installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or
just upgrading it (or maybe downgrading to 4.1), should do the
trick.
On
5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls
anymore?
Because i had a problem, when mysql died, ser still continued to
allow
calls and i was not able to account it.
How can i resolve this. Thank
You in Advance.
Regards Ronald
_______________________________________________ Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
/*
- $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $
- Copyright (C) 2001-2004 iptel.org
- This file is part of ser, a free SIP server.
- ser is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version
- For a license to use the ser software under conditions
- other than those described here, or to purchase support for this
- software, please contact iptel.org by e-mail at the following addresses:
- info@iptel.org
- ser is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h> #include <time.h> #include "my_con.h" #include "../../mem/mem.h" #include "../../dprint.h" #include "utils.h"
/*
- Create a new connection structure,
- open the MySQL connection and set reference count to 1
*/ struct my_con* new_connection(struct my_id* id) { struct my_con* ptr; my_bool my_true; my_true=1;
if (!id) { LOG(L_ERR, "new_connection(): Invalid parameter value\n"); return 0; } ptr = (struct my_con*)pkg_malloc(sizeof(struct
my_con)); if (!ptr) { LOG(L_ERR, "new_connection(): No memory left\n"); return 0; }
memset(ptr, 0, sizeof(struct my_con)); ptr->ref = 1; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "new_connection(): No enough memory\n"); goto err; } mysql_init(ptr->con); mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true); if (!mysql_real_connect(ptr->con, id->host.s, id->username.s,
id->password.s, id->database.s, id->port, 0, 0)) { LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con)); mysql_close(ptr->con); goto err; }
ptr->timestamp = time(0); ptr->id = id; return ptr;
err: if (ptr && ptr->con) pkg_free(ptr->con); if (ptr) pkg_free(ptr); return 0; }
/*
- Close the connection and release memory
*/ void free_connection(struct my_con* con) { if (!con) return; if (con->res) mysql_free_result(con->res); if (con->id) free_my_id(con->id); if (con->con) { mysql_close(con->con); pkg_free(con->con); } pkg_free(con); }
No problem. I've now added this information to the FAQ:
http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_us...
N.
Andrey Kuprianov wrote:
Nice! Thanx.
On 5/24/07, SIP sip@arcdiv.com wrote:
Check the archives. I've answered this a couple of times already.
mysql 5.0.X has modified the default behaviour of how the socket timeout works. By default, it times out connections after a period of time. There was a patch after about 5.0.12 to allow people to modify this behaviour, but the patch didn't work until 5.0.19.
In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after a timed out socket, you need to modify the my_con.c in $SER-SRC/modules/mysql and recompile the mysql module.
I've attached a modified my_con.c file that has the correct options to utilise the patched mysql code. It will fix the reconnect issues (allowing SER to reconnect once the socket has timed out).
N.
Andrey Kuprianov wrote: Im also having this problem. I even upgraded SER to 0.9.7-pre8, but
still
the same.
I tend to think, though, that this is a MySQL version problem.
I
installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or
just upgrading it (or maybe downgrading to 4.1), should do the
trick.
On
5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls
anymore?
Because i had a problem, when mysql died, ser still continued to
allow
calls and i was not able to account it.
How can i resolve this. Thank
You in Advance.
Regards Ronald
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
/*
- $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $
- Copyright (C) 2001-2004 iptel.org
- This file is part of ser, a free SIP server.
- ser is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version
- For a license to use the ser software under conditions
- other than those described here, or to purchase support for this
- software, please contact iptel.org by e-mail at the following addresses:
- info@iptel.org
- ser is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h> #include <time.h> #include "my_con.h" #include "../../mem/mem.h" #include "../../dprint.h" #include "utils.h"
/*
- Create a new connection structure,
- open the MySQL connection and set reference count to 1
*/ struct my_con* new_connection(struct my_id* id) { struct my_con* ptr; my_bool my_true; my_true=1;
if (!id) { LOG(L_ERR, "new_connection(): Invalid parameter value\n"); return 0; } ptr = (struct my_con*)pkg_malloc(sizeof(struct
my_con)); if (!ptr) { LOG(L_ERR, "new_connection(): No memory left\n"); return 0; }
memset(ptr, 0, sizeof(struct my_con)); ptr->ref = 1; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "new_connection(): No enough memory\n"); goto err; } mysql_init(ptr->con); mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true); if (!mysql_real_connect(ptr->con, id->host.s, id->username.s,
id->password.s, id->database.s, id->port, 0, 0)) { LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con)); mysql_close(ptr->con); goto err; }
ptr->timestamp = time(0); ptr->id = id; return ptr;
err: if (ptr && ptr->con) pkg_free(ptr->con); if (ptr) pkg_free(ptr); return 0; }
/*
- Close the connection and release memory
*/ void free_connection(struct my_con* con) { if (!con) return; if (con->res) mysql_free_result(con->res); if (con->id) free_my_id(con->id); if (con->con) { mysql_close(con->con); pkg_free(con->con); } pkg_free(con); }
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Excellent! Has this been verified to be a problem for 2.0? g-)
SIP wrote:
No problem. I've now added this information to the FAQ:
http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_us...
N.
Andrey Kuprianov wrote:
Nice! Thanx.
On 5/24/07, SIP sip@arcdiv.com wrote:
Check the archives. I've answered this a couple of times already.
mysql 5.0.X has modified the default behaviour of how the socket timeout works. By default, it times out connections after a period of time. There was a patch after about 5.0.12 to allow people to modify this behaviour, but the patch didn't work until 5.0.19.
In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after a timed out socket, you need to modify the my_con.c in $SER-SRC/modules/mysql and recompile the mysql module.
I've attached a modified my_con.c file that has the correct options to utilise the patched mysql code. It will fix the reconnect issues (allowing SER to reconnect once the socket has timed out).
N.
Andrey Kuprianov wrote: Im also having this problem. I even upgraded SER to 0.9.7-pre8, but
still
the same.
I tend to think, though, that this is a MySQL version problem.
I
installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or
just upgrading it (or maybe downgrading to 4.1), should do the
trick.
On
5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls
anymore?
Because i had a problem, when mysql died, ser still continued to
allow
calls and i was not able to account it.
How can i resolve this. Thank
You in Advance.
Regards Ronald
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
/*
- $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $
- Copyright (C) 2001-2004 iptel.org
- This file is part of ser, a free SIP server.
- ser is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version
- For a license to use the ser software under conditions
- other than those described here, or to purchase support for this
- software, please contact iptel.org by e-mail at the following addresses:
- info@iptel.org
- ser is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h> #include <time.h> #include "my_con.h" #include "../../mem/mem.h" #include "../../dprint.h" #include "utils.h"
/*
- Create a new connection structure,
- open the MySQL connection and set reference count to 1
*/ struct my_con* new_connection(struct my_id* id) { struct my_con* ptr; my_bool my_true; my_true=1;
if (!id) { LOG(L_ERR, "new_connection(): Invalid parameter value\n"); return 0; } ptr = (struct my_con*)pkg_malloc(sizeof(struct
my_con)); if (!ptr) { LOG(L_ERR, "new_connection(): No memory left\n"); return 0; }
memset(ptr, 0, sizeof(struct my_con)); ptr->ref = 1; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "new_connection(): No enough memory\n"); goto err; } mysql_init(ptr->con); mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true); if (!mysql_real_connect(ptr->con, id->host.s, id->username.s,
id->password.s, id->database.s, id->port, 0, 0)) { LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con)); mysql_close(ptr->con); goto err; }
ptr->timestamp = time(0); ptr->id = id; return ptr;
err: if (ptr && ptr->con) pkg_free(ptr->con); if (ptr) pkg_free(ptr); return 0; }
/*
- Close the connection and release memory
*/ void free_connection(struct my_con* con) { if (!con) return; if (con->res) mysql_free_result(con->res); if (con->id) free_my_id(con->id); if (con->con) { mysql_close(con->con); pkg_free(con->con); } pkg_free(con); }
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
I have not tried it in 2.0, but logically, I would assume it is, as it's an issue with the mysql socket itself. Unless the code has already been changed for the mysql socket connection in 2.0, it would remain a problem.
N.
Greger V. Teigre wrote:
Excellent! Has this been verified to be a problem for 2.0? g-)
SIP wrote:
No problem. I've now added this information to the FAQ:
http://www.iptel.org/faq/why_does_my_mysql_5_0_x_connection_time_out_when_us...
N.
Andrey Kuprianov wrote:
Nice! Thanx.
On 5/24/07, SIP sip@arcdiv.com wrote:
Check the archives. I've answered this a couple of times already.
mysql 5.0.X has modified the default behaviour of how the socket timeout works. By default, it times out connections after a period of time. There was a patch after about 5.0.12 to allow people to modify this behaviour, but the patch didn't work until 5.0.19.
In order to get SER 0.9.X to work with 5.0.19 and above and reconnect after a timed out socket, you need to modify the my_con.c in $SER-SRC/modules/mysql and recompile the mysql module.
I've attached a modified my_con.c file that has the correct options to utilise the patched mysql code. It will fix the reconnect issues (allowing SER to reconnect once the socket has timed out).
N.
Andrey Kuprianov wrote: Im also having this problem. I even upgraded SER to 0.9.7-pre8, but
still
the same.
I tend to think, though, that this is a MySQL version problem.
I
installed MySQL 5.0 from Ubuntu's packages. I think reinstalling MySQL or
just upgrading it (or maybe downgrading to 4.1), should do the
trick.
On
5/24/07, Nhadie nhadie@tbgi.net.ph wrote:
Hi All
How can i make sure that when mysql dies, ser will not allow calls
anymore?
Because i had a problem, when mysql died, ser still continued to
allow
calls and i was not able to account it.
How can i resolve this. Thank
You in Advance.
Regards Ronald
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers
mailing list
Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
/*
- $Id: my_con.c,v 1.2 2004/08/03 17:22:06 janakj Exp $
- Copyright (C) 2001-2004 iptel.org
- This file is part of ser, a free SIP server.
- ser is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version
- For a license to use the ser software under conditions
- other than those described here, or to purchase support for this
- software, please contact iptel.org by e-mail at the following addresses:
- info@iptel.org
- ser is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h> #include <time.h> #include "my_con.h" #include "../../mem/mem.h" #include "../../dprint.h" #include "utils.h"
/*
- Create a new connection structure,
- open the MySQL connection and set reference count to 1
*/ struct my_con* new_connection(struct my_id* id) { struct my_con* ptr; my_bool my_true; my_true=1;
if (!id) { LOG(L_ERR, "new_connection(): Invalid parameter value\n"); return 0; } ptr = (struct my_con*)pkg_malloc(sizeof(struct
my_con)); if (!ptr) { LOG(L_ERR, "new_connection(): No memory left\n"); return 0; }
memset(ptr, 0, sizeof(struct my_con)); ptr->ref = 1; ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL)); if (!ptr->con) { LOG(L_ERR, "new_connection(): No enough memory\n"); goto err; } mysql_init(ptr->con); mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &my_true); if (!mysql_real_connect(ptr->con, id->host.s, id->username.s,
id->password.s, id->database.s, id->port, 0, 0)) { LOG(L_ERR, "new_connection(): %s\n", mysql_error(ptr->con)); mysql_close(ptr->con); goto err; }
ptr->timestamp = time(0); ptr->id = id; return ptr;
err: if (ptr && ptr->con) pkg_free(ptr->con); if (ptr) pkg_free(ptr); return 0; }
/*
- Close the connection and release memory
*/ void free_connection(struct my_con* con) { if (!con) return; if (con->res) mysql_free_result(con->res); if (con->id) free_my_id(con->id); if (con->con) { mysql_close(con->con); pkg_free(con->con); } pkg_free(con); }
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers