Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #16  
Old 05-05-2011, 10:59 PM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

Just got in and glanced at my server, no one had logged in all day (12 hours), so I logged in a toon and wham. DB err lost connection, but no crash it reconnected just fine.

Thanks for the fix!
Reply With Quote
  #17  
Old 05-06-2011, 01:50 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

WOOT! Grats!
Reply With Quote
  #18  
Old 05-16-2011, 02:59 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

Okay, I found a cosmetic error, as I interpreted the return value of RunQuery() wrong. RunQuery() returns true when successful, so we need to edit a line:

Code:
bool DBcore::RunQuery(const char* query, int32 querylen, char* errbuf, MYSQL_RES** result, int32* affected_rows, int32* last_insert_id, int32* errnum, bool retry) {
	_CP(DBcore_RunQuery);
	if (errnum)
		*errnum = 0;
	if (errbuf)
		errbuf[0] = 0;
	bool ret = false;
	LockMutex lock(&MDatabase);
	if (pStatus != Connected)
		Open();
#if DEBUG_MYSQL_QUERIES >= 1
	char tmp[120];
	strn0cpy(tmp, query, sizeof(tmp));
	cout << "QUERY: " << tmp << endl;
#endif
	if (mysql_real_query(&mysql, query, querylen)) {
		if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
			pStatus = Error;
		if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {
			if (retry) {
				cout << "Database Error: Lost connection, attempting to recover...." << endl;
				ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false);
				// if ( !ret )  // <- Wrong return value 
				if ( ret ) 
					cout << "Reconnection to database successful." << endl;
			}
			else {

...
...
...
Reply With Quote
  #19  
Old 05-16-2011, 04:55 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

lmao, I forgot about that. I meant to correct that before I committed it. I saw that, but was working on other stuff at the time and didn't get back to it. Thanks for the reminder. I will try to get that in unless someone else does before I find time to.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #20  
Old 05-16-2011, 05:44 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

I was wondering why I didnt get a reconnection message after my last crash, so I rechecked the code.
Reply With Quote
  #21  
Old 05-16-2011, 11:38 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 966
Default

UCS has been running great though, thanks Zothen
Reply With Quote
  #22  
Old 05-16-2011, 11:49 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

Glad to hear
Reply With Quote
  #23  
Old 05-16-2011, 12:03 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Gotcha covered Trev. Committed in r1901.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:48 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3