• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[7.6] -- TFS, Avesta, YourOTS, Neverland, RealOTS (outputmessage.cpp) fixing...

zup

New Member
Joined
Mar 13, 2008
Messages
187
Reaction score
2
Good day dear friends...

There is a good day to make something amazing..
So the idea is:
Many times i saw people who want open 7.6 old school tibia classic or not, not important actually :p. So to make a good OT 7.6 we need a good server with a many features. Making new own only by you its long, need to thief sources anyway and not correct idea actually :p.

Now the man who wants make hes own 7.6 OT must choose:
1.TFS 0.3a2.r83
2.TFS 0.3 (v2)
3.Avesta v1, v2, v3, v4
5.RealSoft OT 7.6
6.EldinWorld
7.YourOTS




Ok so this is a most popular public releases what we have. Now we look in sources and what?? And WHAT?
Avesta all of 4 versions 80% cpp files the same as TFS - What it gives to us? Right! The same system and same errors!
Just check: TFS and Avesta


So maker of avesta distro just kid who thiefed and totally modified sources based on TFS! Next!
Realsoft hmm nice idea cuz its more stable BUT! Its based on Avesta 0.6.3 and Realsoft no have globalevents then we know what Avesta based on TFS, so that TFS edition is totally fail! You can check it by yourself i just want open your eyes.

Ok! Eldinworld~! Based on Neverland 7.6 (it was the best distro in 2006- 2008 years YES THAT WAS AMAZING Time) BUT What features this server is can have?:
1. outputmessage.cpp doesn't exist in source folder(its sayingto us what it must work without this error but must take more RAM to stable)
2. globalevents is missed.
3. creaturescripts is missed.
4. talkactions is missed.
5. weapons is missed.
Totally stable and very very old distro what can't be better than TFS.

Ok! Now YourOTs 0.9.4d What comes from developers otfans.net (Yurez main developer)
1.First and main not good thing its XML Server!
2. The same globalevents, weapons, talkactions ETC.!



So what we have?
BEST FEATURES: TFS (but thanks for them it makes crash server)
LOW FEATURS: YOUROTs 0.9.4d (its stable but it never can be best OT, sorry Yourez)

So maybe we can do something with that?
PHP:
//////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
// This program 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.
// 
// This program 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 "otpch.h"

#include "outputmessage.h"
#include "connection.h"
#include "protocol.h"

OutputMessage::OutputMessage()
{
	freeMessage();
}

//*********** OutputMessagePool ****************

OutputMessagePool::OutputMessagePool()
{
	for(uint32_t i = 0; i < OUTPUT_POOL_SIZE; ++i){
		OutputMessage* msg = new OutputMessage();
		m_outputMessages.push_back(msg);
#ifdef __TRACK_NETWORK__
		m_allOutputMessages.push_back(msg);
#endif
	}
	m_frameTime = OTSYS_TIME();
}

void OutputMessagePool::startExecutionFrame()
{
	//boost::recursive_mutex::scoped_lock lockClass(m_outputPoolLock);
	m_frameTime = OTSYS_TIME();
	m_isOpen = true;
}

OutputMessagePool::~OutputMessagePool()
{
	InternalOutputMessageList::iterator it;
	for(it = m_outputMessages.begin(); it != m_outputMessages.end(); ++it){
		delete *it;
	}
	m_outputMessages.clear();
}

void OutputMessagePool::send(OutputMessage_ptr msg)
{
	m_outputPoolLock.lock();
	OutputMessage::OutputMessageState state = msg->getState();
	m_outputPoolLock.unlock();

	if(state == OutputMessage::STATE_ALLOCATED_NO_AUTOSEND){
		#ifdef __DEBUG_NET_DETAIL__
		std::cout << "Sending message - SINGLE" << std::endl;
		#endif

		if(msg->getConnection()){
			if(msg->getConnection()->send(msg)){
				// Note: if we ever decide to change how the pool works this will have to change
				m_outputPoolLock.lock();
				if(msg->getState() != OutputMessage::STATE_FREE) {
					msg->setState(OutputMessage::STATE_WAITING);
				}
				m_outputPoolLock.unlock();
			}
			else{
				msg->getProtocol()->onSendMessage(msg);
			}
		}
		else{
			#ifdef __DEBUG_NET__
			std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl;
            #endif
		}
	}
	else{
		#ifdef __DEBUG_NET__
		std::cout << "Warning: [OutputMessagePool::send] State != STATE_ALLOCATED_NO_AUTOSEND" << std::endl;
        #endif
	}
}

void OutputMessagePool::sendAll()
{
	boost::recursive_mutex::scoped_lock lockClass(m_outputPoolLock);

	OutputMessageMessageList::iterator it;
	for(it = m_autoSendOutputMessages.begin(); it != m_autoSendOutputMessages.end(); ){
		OutputMessage_ptr omsg = *it;
		#ifdef __NO_PLAYER_SENDBUFFER__
		//use this define only for debugging
		bool v = 1;
		#else
		//It will send only messages bigger then 1 kb or with a lifetime greater than 10 ms
		bool v = omsg->getMessageLength() > 1024 || (m_frameTime - omsg->getFrame() > 10);
		#endif
		if(v){
			#ifdef __DEBUG_NET_DETAIL__
			std::cout << "Sending message - ALL" << std::endl;
			#endif

			if(omsg->getConnection()){
				if(omsg->getConnection()->send(omsg)){
					// Note: if we ever decide to change how the pool works this will have to change
					if(omsg->getState() != OutputMessage::STATE_FREE) {
						omsg->setState(OutputMessage::STATE_WAITING);
					}
				}
				else
                {
					omsg->getProtocol()->onSendMessage(omsg);
				}
			}
			else{
				#ifdef __DEBUG_NET__
				std::cout << "Error: [OutputMessagePool::send] NULL connection." << std::endl;
                #endif
			}

			it = m_autoSendOutputMessages.erase(it);
		}
		else{
			++it;
		}
	}
}

void OutputMessagePool::internalReleaseMessage(OutputMessage* msg)
{
	if(msg->getProtocol()){
		msg->getProtocol()->unRef();
#ifdef __DEBUG_NET_DETAIL__
		std::cout << "Removing reference to protocol " << msg->getProtocol() << std::endl;
#endif
	}
	else{
		std::cout << "No protocol found." << std::endl;
	}

	if(msg->getConnection()){
		msg->getConnection()->unRef();
#ifdef __DEBUG_NET_DETAIL__
		std::cout << "Removing reference to connection " << msg->getConnection() << std::endl;
#endif
	}
	else{
		std::cout << "No connection found." << std::endl;
	}

	msg->freeMessage();
	m_outputMessages.push_back(msg);
}

OutputMessage_ptr OutputMessagePool::getOutputMessage(Protocol* protocol, bool autosend /*= true*/)
{
	#ifdef __DEBUG_NET_DETAIL__
	std::cout << "request output message - auto = " << autosend << std::endl;
    #endif

	if(!m_isOpen){
		return OutputMessage_ptr();
	}

	boost::recursive_mutex::scoped_lock lockClass(m_outputPoolLock);

	if(protocol->getConnection() == NULL){
		return OutputMessage_ptr();
	}

	OutputMessage_ptr outputmessage;
	if(m_outputMessages.empty()) {
#ifdef __TRACK_NETWORK__
		if(m_allOutputMessages.size() >= 5000){
			std::cout << "High usage of outputmessages: " << std::endl;
			m_allOutputMessages.back()->PrintTrace();
		}
#endif
		outputmessage.reset(new OutputMessage,
			boost::bind(&OutputMessagePool::internalReleaseMessage, this, _1));

#ifdef __TRACK_NETWORK__
		m_allOutputMessages.push_back(outputmessage..get());
#endif
	} else {
		outputmessage.reset(m_outputMessages.back(),
			boost::bind(&OutputMessagePool::internalReleaseMessage, this, _1));
#ifdef __TRACK_NETWORK__
		// Print message trace
		if(outputmessage->getState() != OutputMessage::STATE_FREE) {
			std::cout << "Using allocated message, message trace:" << std::endl;
			outputmessage->PrintTrace();
		}
#else
		assert(outputmessage->getState() == OutputMessage::STATE_FREE);
#endif
		m_outputMessages.pop_back();
	}

	configureOutputMessage(outputmessage, protocol, autosend);
	return outputmessage;
}

void OutputMessagePool::configureOutputMessage(OutputMessage_ptr msg, Protocol* protocol, bool autosend)
{
	msg->Reset();
	if(autosend){
		msg->setState(OutputMessage::STATE_ALLOCATED);
		m_autoSendOutputMessages.push_back(msg);
	}
	else{
		msg->setState(OutputMessage::STATE_ALLOCATED_NO_AUTOSEND);
	}

	Connection* connection = protocol->getConnection();
	assert(connection != NULL);

	msg->setProtocol(protocol);
	protocol->addRef();
#ifdef __DEBUG_NET_DETAIL__
	std::cout << "Adding reference to protocol - " << protocol << std::endl;
#endif
	msg->setConnection(connection);
	connection->addRef();
#ifdef __DEBUG_NET_DETAIL__
	std::cout << "Adding reference to connection - " << connection << std::endl;
#endif
	msg->setFrame(m_frameTime);
}

The important function IS:
PHP:
OutputMessage_ptr OutputMessagePool::getOutputMessage(Protocol* protocol, bool autosend /*= true*/)
{
	#ifdef __DEBUG_NET_DETAIL__
	std::cout << "request output message - auto = " << autosend << std::endl;
    #endif

	if(!m_isOpen){
		return OutputMessage_ptr();
	}

	boost::recursive_mutex::scoped_lock lockClass(m_outputPoolLock);

	if(protocol->getConnection() == NULL){
		return OutputMessage_ptr();
	}

	OutputMessage_ptr outputmessage;
	if(m_outputMessages.empty()) {
#ifdef __TRACK_NETWORK__
		if(m_allOutputMessages.size() >= 5000){
			std::cout << "High usage of outputmessages: " << std::endl;
			m_allOutputMessages.back()->PrintTrace();
		}
#endif
		outputmessage.reset(new OutputMessage,
			boost::bind(&OutputMessagePool::internalReleaseMessage, this, _1));

#ifdef __TRACK_NETWORK__
		m_allOutputMessages.push_back(outputmessage..get());
#endif
	} else {
		outputmessage.reset(m_outputMessages.back(),
			boost::bind(&OutputMessagePool::internalReleaseMessage, this, _1));
#ifdef __TRACK_NETWORK__
		// Print message trace
		if(outputmessage->getState() != OutputMessage::STATE_FREE) {
			std::cout << "Using allocated message, message trace:" << std::endl;
			outputmessage->PrintTrace();
		}
#else
		assert(outputmessage->getState() == OutputMessage::STATE_FREE);
#endif
		m_outputMessages.pop_back();
	}

	configureOutputMessage(outputmessage, protocol, autosend);
	return outputmessage;
}



So What we have to do with
PHP:
#ifdef __TRACK_NETWORK__
		// Print message trace
		if(outputmessage->getState() != OutputMessage::STATE_FREE) {
			std::cout << "Using allocated message, message trace:" << std::endl;
			outputmessage->PrintTrace();
		}
#else
		assert(outputmessage->getState() == OutputMessage::STATE_FREE);
#endif

to do 7.6 server STABLE and PERFECT!???
 
Do you want a stable 7.6 engine or what? I don't get it. I have the latest 7.6 server released by Ferrus (before he merged 7.6 and 7.4 to same sources)

Release 7.6.rar - Speedy Share - upload your files here

You don't have to worry about any outputmessage error.

Btw
zup said:
Avesta v1, v2, v3, v4

Are modified versions which is highly unstable
 
If you knew anything, Ferrus based Avesta off of an old OTServ revision and he is not a little kid. Also, saying someone thieved from TFS is like saying when you create a piece of artwork in Photoshop you actually thieved the painting/photo from Adobe. Since if you didn't know TFS stole everything from OTServ (Sim0ne, Remere, Elf, Tliff, Smygflik, and ect).

In simplest terms your a dumbass.
 
Zup, please edit your thread starting post to:

Code:
Hello! I'm looking for a stable 7.6 server, can someone help me find one?
 
no no guys i understand what you trying to explain me with features and credits BUT!

my post is correct!
I found a part of outputmessage.cpp source code.
And Anyone can't say what to fix to make TFS stable...
 
>2013
>not using avesta063

TFS is cool and all, but there are just so many things which make it not feel oldschool.
inb4 why not just make it feel oldschool
 
Back
Top