2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
// Cyphesis Online RPG Server and AI Engine
|
2004-12-08 16:36:42 +00:00
|
|
|
// Copyright (C) 2000-2004 Alistair Riddoch
|
2006-01-19 Al Riddoch <alriddoch@zepler.org>
* aiclient/ClientAccount.cpp, aiclient/ClientAccount.h,
aiclient/ClientConnection.cpp, aiclient/ClientConnection.h,
aiclient/client.cpp, aiclient/client.h, client/BaseClient.cpp,
client/BaseClient.h, client/CharacterClient.cpp,
client/CharacterClient.h, client/ClientConnection.cpp,
client/ClientConnection.h, client/CreatorClient.cpp,
client/CreatorClient.h, client/ObserverClient.cpp,
client/ObserverClient.h, client/Py_CreatorClient.cpp,
client/Py_CreatorClient.h, client/client.cpp,
client/define_world.cpp, client/define_world.h, common/Add.h,
common/Affect.h, common/AtlasFileLoader.cpp,
common/AtlasFileLoader.h, common/Attack.h, common/BaseEntity.cpp,
common/BaseEntity.h, common/BaseWorld.cpp, common/BaseWorld.h,
common/Burn.h, common/Chop.h, common/Connect.h, common/CustomOp.cpp,
common/CustomOp.h, common/CustomOp_impl.h, common/Cut.h,
common/Database.cpp, common/Database.h, common/Delve.h, common/Dig.h,
common/Eat.h, common/FormattedXMLWriter.cpp,
common/FormattedXMLWriter.h, common/Generic.h, common/Load.h,
common/Monitor.h, common/Mow.h, common/Nourish.h,
common/OOGThing.cpp, common/OOGThing.h, common/Property.cpp,
common/Property.h, common/Property_impl.h, common/Save.h,
common/Setup.h, common/Tick.h, common/Unseen.h, common/Update.h,
common/Use.h, common/Wield.h, common/accountbase.cpp,
common/accountbase.h, common/const.cpp, common/const.h,
common/custom.cpp, common/debug.h, common/globals.cpp,
common/globals.h, common/id.cpp, common/id.h, common/inheritance.cpp,
common/inheritance.h, common/inheritance_impl.h, common/log.cpp,
common/log.h, common/newid.cpp, common/nls.h, common/op_switch.h,
common/operations.cpp, common/operations.h, common/random.h,
common/refno.h, common/serialno.cpp, common/serialno.h,
common/system.cpp, common/system.h, common/terrain_utils.cpp,
common/terrain_utils.h, common/type_utils.h, common/types.h,
common/utility.cpp, common/utility.h, modules/DateTime.cpp,
modules/DateTime.h, modules/Location.cpp, modules/Location.h,
modules/WorldTime.cpp, modules/WorldTime.h, physics/BBox.cpp,
physics/BBox.h, physics/Collision.cpp, physics/Collision.h,
physics/Quaternion.cpp, physics/Quaternion.h, physics/Vector3D.cpp,
physics/Vector3D.h, physics/VectorPol.h, rulesets/Area.cpp,
rulesets/Area.h, rulesets/AreaProperty.cpp, rulesets/AreaProperty.h,
rulesets/ArithmeticScript.cpp, rulesets/ArithmeticScript.h,
rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/CalendarProperty.cpp, rulesets/CalendarProperty.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Combat.cpp,
rulesets/Combat.h, rulesets/Container.cpp, rulesets/Container.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/EntityProperties.cpp,
rulesets/Entity_getLocation.h, rulesets/Fell.cpp, rulesets/Fell.h,
rulesets/Food.cpp, rulesets/Food.h, rulesets/Line.cpp,
rulesets/Line.h, rulesets/LineProperty.cpp, rulesets/LineProperty.h,
rulesets/MemEntity.cpp, rulesets/MemEntity.h, rulesets/MemMap.cpp,
rulesets/MemMap.h, rulesets/MemMap_methods.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Missile.h,
rulesets/Motion.cpp, rulesets/Motion.h, rulesets/Movement.cpp,
rulesets/Movement.h, rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Plant.h, rulesets/Py_BBox.cpp,
rulesets/Py_BBox.h, rulesets/Py_EntityWrapper.h,
rulesets/Py_Location.cpp, rulesets/Py_Location.h,
rulesets/Py_Map.cpp, rulesets/Py_Map.h, rulesets/Py_Mind.cpp,
rulesets/Py_Mind.h, rulesets/Py_Object.cpp, rulesets/Py_Object.h,
rulesets/Py_Operation.cpp, rulesets/Py_Operation.h,
rulesets/Py_Oplist.cpp, rulesets/Py_Oplist.h, rulesets/Py_Optime.cpp,
rulesets/Py_Optime.h, rulesets/Py_Point3D.cpp, rulesets/Py_Point3D.h,
rulesets/Py_Property.cpp, rulesets/Py_Property.h,
rulesets/Py_Quaternion.cpp, rulesets/Py_Quaternion.h,
rulesets/Py_RootEntity.cpp, rulesets/Py_RootEntity.h,
rulesets/Py_Statistics.cpp, rulesets/Py_Statistics.h,
rulesets/Py_Task.cpp, rulesets/Py_Task.h, rulesets/Py_Thing.cpp,
rulesets/Py_Thing.h, rulesets/Py_Vector3D.cpp,
rulesets/Py_Vector3D.h, rulesets/Py_World.cpp, rulesets/Py_World.h,
rulesets/Py_WorldTime.cpp, rulesets/Py_WorldTime.h,
rulesets/PythonArithmeticScript.cpp,
rulesets/PythonArithmeticScript.h, rulesets/PythonMindScript.cpp,
rulesets/PythonMindScript.h, rulesets/PythonScript.cpp,
rulesets/PythonScript.h, rulesets/PythonThingScript.cpp,
rulesets/PythonThingScript.h, rulesets/PythonWrapper.cpp,
rulesets/PythonWrapper.h, rulesets/Python_API.cpp,
rulesets/Python_API.h, rulesets/Python_Script_Utils.h,
rulesets/Script.cpp, rulesets/Script.h, rulesets/Stackable.cpp,
rulesets/Stackable.h, rulesets/Statistics.cpp, rulesets/Statistics.h,
rulesets/StatisticsProperty.cpp, rulesets/StatisticsProperty.h,
rulesets/Structure.cpp, rulesets/Structure.h, rulesets/Task.cpp,
rulesets/Task.h, rulesets/TaskScript.cpp, rulesets/TaskScript.h,
rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
rulesets/Thing.cpp, rulesets/Thing.h, rulesets/ThingFactory.cpp,
rulesets/ThingFactory.h, rulesets/World.cpp, rulesets/World.h,
rulesets/attributes.h, server/Account.cpp, server/Account.h,
server/Admin.cpp, server/Admin.h, server/ArithmeticFactory.cpp,
server/ArithmeticFactory.h, server/CommClient.cpp,
server/CommClient.h, server/CommIdleSocket.cpp,
server/CommIdleSocket.h, server/CommListener.cpp,
server/CommListener.h, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommMDNSPublisher.cpp,
server/CommMDNSPublisher.h, server/CommMaster.cpp,
server/CommMaster.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommPSQLSocket.cpp,
server/CommPSQLSocket.h, server/CommPeer.cpp,
server/CommPeer.h, server/CommPeerListener.cpp,
server/CommPeerListener.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommServer.cpp,
server/CommServer.h, server/CommSlaveClient.cpp,
server/CommSlaveClient.h, server/CommSlaveListener.cpp,
server/CommSlaveListener.h, server/CommSocket.cpp,
server/CommSocket.h, server/CommUnixListener.cpp,
server/CommUnixListener.h, server/Connection.cpp,
server/Connection.h, server/Connection_methods.h,
server/EntityFactory.cpp, server/EntityFactory.h,
server/ExternalMind.cpp, server/ExternalMind.h,
server/Idle.cpp, server/Idle.h, server/Lobby.cpp, server/Lobby.h,
server/Master.cpp, server/Master.h, server/Peer.cpp, server/Peer.h,
server/Persistance.cpp, server/Persistance.h,
server/PersistantThingFactory.cpp, server/PersistantThingFactory.h,
server/PersistantThingFactory_impl.h, server/Persistor.cpp,
server/Persistor.h, server/Persistor_impl.h,
server/Player.cpp, server/Player.h, server/Restoration.cpp,
server/Restoration.h, server/Restorer.cpp, server/Restorer.h,
server/Restorer_impl.h, server/ScriptFactory.cpp,
server/ScriptFactory.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/ServerRouting_methods.h,
server/SlaveClientConnection.cpp, server/SlaveClientConnection.h,
server/TaskFactory.cpp, server/TaskFactory.h,
server/TrustedConnection.cpp, server/TrustedConnection.h,
server/WorldRouter.cpp, server/WorldRouter.h,
server/server.cpp, server/server.h, server/slave.cpp,
tests/Areatest.cpp, tests/BaseEntitytest.cpp,
tests/Charactertest.cpp, tests/Containertest.cpp,
tests/Creatortest.cpp, tests/EntityExerciser.h,
tests/EntityFactorytest.cpp, tests/Entitytest.cpp,
tests/Foodtest.cpp, tests/IGEntityExerciser.h,
tests/Linetest.cpp, tests/Locationtest.cpp, tests/OOGThingtest.cpp,
tests/Planttest.cpp, tests/Propertytest.cpp, tests/Stackabletest.cpp,
tests/Structuretest.cpp, tests/Tasktest.cpp, tests/TestWorld.h,
tests/Thingtest.cpp, tests/WorldTimetest.cpp, tests/Worldtest.cpp,
tests/allOperations.h, tests/collisiontest.cpp, tests/consttest.cpp,
tests/distancetest.cpp, tests/emergencetest.cpp,
tests/inheritancetest.cpp, tests/logtest.cpp, tests/randomtest.cpp,
tests/systemtest.cpp, tests/transformtest.cpp,
tests/type_utilstest.cpp, tests/utilitytest.cpp,
tools/AdminClient.cpp, tools/AdminClient.h, tools/cyaddrules.cpp,
tools/cycmd.cpp, tools/cyconfig.cpp, tools/cyconvertrules.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cydumprules.cpp,
tools/cyisoload.cpp, tools/cyloadrules.cpp, tools/cypasswd.cpp,
tools/cywatchdog.cpp: Replace the copyright and license statements
with new versions that include disclaimer of warranty, and
permit distribution under later versions of the GPL.
2006-01-19 02:17:06 +00:00
|
|
|
//
|
|
|
|
|
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-01-26 16:38:23 +00:00
|
|
|
|
2004-11-11 14:26:21 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2018-12-16 23:20:33 +01:00
|
|
|
|
2004-11-11 14:26:21 +00:00
|
|
|
#include "config.h"
|
2018-12-16 23:20:33 +01:00
|
|
|
|
2004-11-11 14:26:21 +00:00
|
|
|
#endif
|
|
|
|
|
|
2014-01-29 13:08:52 +01:00
|
|
|
#include "CommHttpClient.h"
|
2014-01-29 15:15:10 +01:00
|
|
|
#include "CommPythonClient.h"
|
2003-10-27 01:59:53 +00:00
|
|
|
#include "CommPSQLSocket.h"
|
2002-12-19 20:04:37 +00:00
|
|
|
#include "CommMetaClient.h"
|
2004-11-11 14:26:21 +00:00
|
|
|
#include "CommMDNSPublisher.h"
|
2014-01-27 22:00:21 +01:00
|
|
|
#include "CommAsioListener_impl.h"
|
2012-03-05 14:15:34 +00:00
|
|
|
#include "Connection.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
#include "ServerRouting.h"
|
2009-03-12 00:50:25 +00:00
|
|
|
#include "EntityBuilder.h"
|
2010-07-13 16:23:46 +01:00
|
|
|
#include "ArithmeticBuilder.h"
|
2009-03-24 03:08:45 +00:00
|
|
|
#include "Persistence.h"
|
2003-03-07 00:22:12 +00:00
|
|
|
#include "WorldRouter.h"
|
2009-08-19 02:47:15 +01:00
|
|
|
#include "Ruleset.h"
|
2008-08-17 21:18:45 +00:00
|
|
|
#include "StorageManager.h"
|
2008-08-22 18:59:06 +00:00
|
|
|
#include "IdleConnector.h"
|
2005-01-13 00:38:41 +00:00
|
|
|
#include "Admin.h"
|
2013-07-26 20:14:33 +02:00
|
|
|
#include "PossessionAuthenticator.h"
|
2012-03-05 14:15:34 +00:00
|
|
|
#include "TrustedConnection.h"
|
2015-04-08 19:15:00 +02:00
|
|
|
#include "HttpCache.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2018-10-31 21:38:35 +01:00
|
|
|
#include "rules/python/Python_API.h"
|
|
|
|
|
#include "rules/LocatedEntity.h"
|
|
|
|
|
#include "rules/simulation/World.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2018-05-19 23:18:40 +02:00
|
|
|
#if POSTGRES_FOUND
|
2018-05-16 21:48:18 +02:00
|
|
|
#include "common/DatabasePostgres.h"
|
2018-05-19 23:18:40 +02:00
|
|
|
#endif
|
|
|
|
|
|
2005-01-13 00:38:41 +00:00
|
|
|
#include "common/id.h"
|
|
|
|
|
#include "common/const.h"
|
2009-03-20 15:31:38 +00:00
|
|
|
#include "common/Inheritance.h"
|
2003-03-07 00:22:12 +00:00
|
|
|
#include "common/system.h"
|
2009-04-08 21:22:19 +01:00
|
|
|
#include "common/sockets.h"
|
2011-10-31 11:19:33 +01:00
|
|
|
#include "common/SystemTime.h"
|
2015-04-06 21:47:55 +02:00
|
|
|
#include "common/Monitors.h"
|
2018-08-04 01:12:45 +02:00
|
|
|
#include "ExternalMindsManager.h"
|
2002-07-14 21:04:50 +00:00
|
|
|
|
2006-01-04 15:06:46 +00:00
|
|
|
#include <varconf/config.h>
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2013-11-24 22:26:22 +01:00
|
|
|
#include <thread>
|
|
|
|
|
#include <fstream>
|
2018-02-06 13:11:04 +01:00
|
|
|
#include <boost/filesystem/operations.hpp>
|
2018-04-25 13:16:33 +02:00
|
|
|
#include <common/FileSystemObserver.h>
|
2018-04-26 19:28:20 +02:00
|
|
|
#include <common/AssetsManager.h>
|
2018-05-19 21:47:24 +02:00
|
|
|
#include <common/DatabaseSQLite.h>
|
2018-05-19 23:52:16 +02:00
|
|
|
#include <common/RepeatedTask.h>
|
2018-09-22 23:11:22 +02:00
|
|
|
#include <common/MainLoop.h>
|
2018-10-31 21:38:35 +01:00
|
|
|
#include <rules/simulation/python/CyPy_Server.h>
|
|
|
|
|
#include <rules/python/CyPy_Physics.h>
|
|
|
|
|
#include <rules/entityfilter/python/CyPy_EntityFilter.h>
|
|
|
|
|
#include <rules/python/CyPy_Atlas.h>
|
|
|
|
|
#include <rules/python/CyPy_Common.h>
|
|
|
|
|
#include <rules/python/CyPy_Rules.h>
|
2013-11-24 22:26:22 +01:00
|
|
|
|
|
|
|
|
using String::compose;
|
2014-01-29 09:05:07 +01:00
|
|
|
using namespace boost::asio;
|
2012-07-24 08:35:33 +01:00
|
|
|
|
2009-01-28 02:21:29 +00:00
|
|
|
class TrustedConnection;
|
2018-12-16 23:20:33 +01:00
|
|
|
|
2009-01-28 02:21:29 +00:00
|
|
|
class Peer;
|
2009-01-27 23:46:20 +00:00
|
|
|
|
2001-02-04 07:08:07 +00:00
|
|
|
static const bool debug_flag = false;
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2009-04-08 02:02:44 +01:00
|
|
|
INT_OPTION(http_port_num, 6780, CYPHESIS, "httpport",
|
2018-12-16 23:20:33 +01:00
|
|
|
"Network listen port for http connection to the server");
|
2009-04-07 23:17:49 +01:00
|
|
|
|
2009-04-08 21:56:24 +01:00
|
|
|
BOOL_OPTION(useMetaserver, true, CYPHESIS, "usemetaserver",
|
2018-12-16 23:20:33 +01:00
|
|
|
"Flag to control registration with the metaserver");
|
2009-04-08 21:56:24 +01:00
|
|
|
|
2009-04-09 00:13:15 +01:00
|
|
|
STRING_OPTION(mserver, "metaserver.worldforge.org", CYPHESIS, "metaserver",
|
2018-12-16 23:20:33 +01:00
|
|
|
"Hostname to use as the metaserver");
|
2009-04-09 00:13:15 +01:00
|
|
|
|
2015-05-23 23:21:09 +02:00
|
|
|
INT_OPTION(ai_clients, 1, CYPHESIS, "aiclients",
|
2018-12-16 23:20:33 +01:00
|
|
|
"Number of AI clients to spawn.");
|
2015-04-10 22:00:56 +02:00
|
|
|
|
2014-02-04 15:56:46 +01:00
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
int main(int argc, char** argv)
|
2000-12-03 14:23:26 +00:00
|
|
|
{
|
2008-11-03 17:12:31 +00:00
|
|
|
if (security_init() != 0) {
|
2014-02-04 20:57:09 +01:00
|
|
|
log(CRITICAL, "Security initialization Error. Exiting.");
|
2008-11-03 17:12:31 +00:00
|
|
|
return EXIT_SECURITY_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-25 10:55:53 +00:00
|
|
|
if (security_check() != SECURITY_OKAY) {
|
2008-12-11 18:34:13 +00:00
|
|
|
log(CRITICAL, "Security check error. Exiting.");
|
2006-03-25 10:55:53 +00:00
|
|
|
return EXIT_SECURITY_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 20:57:07 +02:00
|
|
|
//Turn on soft exits so we get a chance to persist external clients' thoughts.
|
|
|
|
|
exit_soft_enabled = true;
|
|
|
|
|
|
2001-10-06 16:52:02 +00:00
|
|
|
interactive_signals();
|
2001-04-10 19:05:14 +00:00
|
|
|
|
2007-11-14 22:40:17 +00:00
|
|
|
int config_status = loadConfig(argc, argv, USAGE_SERVER);
|
2007-04-28 15:21:17 +00:00
|
|
|
if (config_status < 0) {
|
|
|
|
|
if (config_status == CONFIG_VERSION) {
|
|
|
|
|
std::cout << argv[0] << " (cyphesis) " << consts::version
|
2018-12-16 23:20:33 +01:00
|
|
|
<< " (Cyphesis build: " << consts::buildId << ")"
|
|
|
|
|
<< std::endl << std::flush;
|
2007-04-28 15:21:17 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
} else if (config_status == CONFIG_HELP) {
|
2007-04-28 16:45:13 +00:00
|
|
|
showUsage(argv[0], USAGE_SERVER);
|
2007-04-28 15:21:17 +00:00
|
|
|
return 0;
|
|
|
|
|
} else if (config_status != CONFIG_ERROR) {
|
|
|
|
|
log(ERROR, "Unknown error reading configuration.");
|
|
|
|
|
}
|
2007-10-01 04:57:15 +00:00
|
|
|
// Fatal error loading config file.
|
2002-10-03 10:51:59 +00:00
|
|
|
return EXIT_CONFIG_ERROR;
|
2001-07-12 16:10:41 +00:00
|
|
|
}
|
2001-11-24 13:23:17 +00:00
|
|
|
|
2001-10-07 01:08:25 +00:00
|
|
|
if (daemon_flag) {
|
|
|
|
|
int pid = daemonise();
|
|
|
|
|
if (pid == -1) {
|
2002-12-19 20:04:37 +00:00
|
|
|
return EXIT_FORK_ERROR;
|
2001-10-07 01:08:25 +00:00
|
|
|
} else if (pid > 0) {
|
2002-10-03 10:51:59 +00:00
|
|
|
return EXIT_SUCCESS;
|
2001-10-07 01:08:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
auto monitors = new Monitors();
|
2015-05-23 23:21:09 +02:00
|
|
|
//Check if we should spawn AI clients.
|
|
|
|
|
if (ai_clients) {
|
|
|
|
|
log(INFO, compose("Spawning %1 AI client processes.", ai_clients));
|
|
|
|
|
for (int i = 0; i < ai_clients; ++i) {
|
|
|
|
|
auto pid = fork();
|
|
|
|
|
if (pid == 0) {
|
2018-01-30 16:54:49 +01:00
|
|
|
execl((bin_directory + "/cyaiclient").c_str(), (bin_directory + "/cyaiclient").c_str(), nullptr);
|
2015-05-23 23:21:09 +02:00
|
|
|
return EXIT_FORK_ERROR;
|
|
|
|
|
} else if (pid == -1) {
|
|
|
|
|
log(WARNING, "Could not spawn AI client process.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-02 Al Riddoch <alriddoch@zepler.org>
* common/Database.h: Declaration for register relations.
* server/Account.cpp, server/Account.h, server/Admin.cpp,
server/Admin.h, server/Connection.cpp, server/Player.cpp,
server/Player.h, server/ServerRouting.cpp,
server/ServerRouting.h: Properlly separate username and id from
account, and use the database code to assign numerical ids to
account objects. Eliminate extraneous member variables in account.
* server/CommClient.cpp, server/CommServer.cpp,
server/CommServer.h, server/server.cpp:
Eliminate storing server name string twice.
2003-01-02 08:52:56 +00:00
|
|
|
// If we are a daemon logging to syslog, we need to set it up.
|
2002-07-14 21:04:50 +00:00
|
|
|
initLogger();
|
|
|
|
|
|
2018-02-06 13:11:04 +01:00
|
|
|
//Check that there's a valid assets directory, and warn if not.
|
|
|
|
|
if (!boost::filesystem::is_directory(assets_directory)) {
|
|
|
|
|
log(ERROR, String::compose("Could not find any valid assets directory at '%1'.", assets_directory));
|
|
|
|
|
log(ERROR, "If you've built Cyphesis yourself make sure you've run the 'make assets-download' command.");
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-19 23:18:40 +02:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
auto io_service = new boost::asio::io_service();
|
2018-05-19 23:18:40 +02:00
|
|
|
|
|
|
|
|
// Initialise the persistence subsystem.
|
|
|
|
|
std::string databaseBackend;
|
|
|
|
|
readConfigItem(instance, "database", databaseBackend);
|
|
|
|
|
|
|
|
|
|
Database* database;
|
2018-12-16 23:20:33 +01:00
|
|
|
CommPSQLSocket* dbsocket = nullptr;
|
2018-05-19 23:52:16 +02:00
|
|
|
RepeatedTask* dbvacuumTask = nullptr;
|
2018-05-19 23:18:40 +02:00
|
|
|
if (databaseBackend == "postgres") {
|
|
|
|
|
#if POSTGRES_FOUND
|
|
|
|
|
database = new DatabasePostgres();
|
|
|
|
|
dbsocket = new CommPSQLSocket(*io_service, *database);
|
|
|
|
|
#else
|
|
|
|
|
log(ERROR, "Database specified as 'postgres', but this server is not built with Postgres SQL support.");
|
|
|
|
|
return -1;
|
|
|
|
|
#endif
|
|
|
|
|
} else {
|
2018-05-19 23:52:16 +02:00
|
|
|
auto sqliteDatabase = new DatabaseSQLite();
|
|
|
|
|
database = sqliteDatabase;
|
2018-12-16 23:20:33 +01:00
|
|
|
dbvacuumTask = new RepeatedTask(*io_service, boost::posix_time::seconds(25 * 60), [=]() { sqliteDatabase->runMaintainance(); });
|
2018-05-19 23:18:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto persistence = new Persistence(*database);
|
|
|
|
|
int dbstatus = persistence->init();
|
|
|
|
|
if (dbstatus < 0) {
|
|
|
|
|
log(ERROR, "Error opening database.");
|
|
|
|
|
return -1;
|
2007-11-05 19:24:50 +00:00
|
|
|
}
|
2001-10-07 01:08:25 +00:00
|
|
|
|
2007-11-05 19:24:50 +00:00
|
|
|
// If the restricted flag is set in the config file, then we
|
|
|
|
|
// don't allow connecting users to create accounts. Accounts must
|
|
|
|
|
// be created manually by the server administrator.
|
2009-04-09 00:27:11 +01:00
|
|
|
if (restricted_flag) {
|
|
|
|
|
log(INFO, "Setting restricted mode.");
|
2001-03-15 11:41:34 +00:00
|
|
|
}
|
2000-12-13 12:10:48 +00:00
|
|
|
|
2007-12-04 19:18:17 +00:00
|
|
|
readConfigItem(instance, "inittime", timeoffset);
|
* tools/cydbload.cpp: Added parameter handling so any file can
be loaded into the database.
* tools/cycmd.cpp: Cleaned up usage and help functions.
* tools/cyisoload.cpp: Cleaned up usage(), and made sure build
completes okay if libraries are missing, and missing
functionality is reported to the user.
* server/server.cpp: Added config options that specifies that
the contents of the db should loaded on server startup. Cleaned
up some debug code.
* server/WorldTime.cpp, server/WorldRouter.cpp,
server/Connection.cpp, rulesets/Structure.h,
rulesets/Python_API.cpp, rulesets/Py_WorldTime.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp,
physics/Vector3D.h, common/persistance.cpp,
common/database.h, common/database.cpp: Removed output either
to debug mode, or removed altogether.
* common/BaseEntity.h, common/BaseEntity.cpp: Removed redundant header
includes.
* server/ServerRouting.cpp, common/persistance.h,
common/persistance.cpp: Modified admin account function names it
fit convention.
* module/Location.h: Fixed collision detection so that entities
with velocity set to 0 still get checked.
* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/Character.cpp,
rulesets/BaseMind.cpp, rulesets/Creator.cpp,
rulesets/ExternalMind.cpp, rulesets/Food.cpp, rulesets/MemMap.cpp,
rulesets/Movement.cpp, rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Py_*.cpp, rulesets/World.cpp:
Removed unnecessary #includes.
Al Riddoch <alriddoch@zepler.org>
2001-06-04 11:22:27 +00:00
|
|
|
|
2005-11-13 Al Riddoch <alriddoch@zepler.org>
* server/Admin.cpp, server/CommPeer.cpp, server/CommPeer.h,
server/CommPeerListener.cpp, server/Peer.cpp, server/Peer.h:
Re-work classes for peer connections to use integer IDs.
* server/Lobby.cpp, server/Lobby.h: Modify interface so its more
obvious that lobby only handles accounts, and adjust to have
integer ID.
* server/Connection.cpp, server/Connection.h,
server/TrustedConnection.cpp, server/TrustedConnection.h: Use
integer IDs, and modify to match new Lobby API changes.
* server/ServerRouting.cpp, server/ServerRouting.h, server/server.cpp:
Modify server to have integer ID, and handle ID for Lobby as well.
* server/CommListener.cpp, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommUnixListener.cpp:
Modify communication classes for normal clients to handle
integer IDs on the connection classes.
2005-11-13 23:28:02 +00:00
|
|
|
std::string server_name;
|
2007-12-04 19:18:17 +00:00
|
|
|
if (readConfigItem(instance, "servername", server_name) != 0) {
|
2008-11-17 01:24:15 +00:00
|
|
|
if (instance == CYPHESIS) {
|
2007-12-04 19:18:17 +00:00
|
|
|
server_name = get_hostname();
|
|
|
|
|
} else {
|
|
|
|
|
server_name = instance;
|
|
|
|
|
}
|
* server/server.cpp, server/ServerRouting.h, server/ServerRouting.cpp,
server/CommServer.h: Added support for server "name" which
defaults to the hostname of the server machine, but is
customisable in the config. This can be used in preference to
IP address when doing lookups with the metaserver.
* server/Lobby.h, server/ServerRouting.h, server/Account.h,
server/Account.cpp, rulesets/Stackable.h, rulesets/Stackable.cpp,
rulesets/Python_API.cpp, rulesets/Py_Object.cpp, rulesets/Plant.cpp,
rulesets/Pedestrian.cpp, rulesets/Entity.h, rulesets/Entity.cpp,
rulesets/Character.h, rulesets/Character.cpp, common/BaseEntity.h,
common/BaseEntity.cpp: Modied asObect() and addToObject()
methods to make them more efficient.
* modules/Location.h, modules/Location.cpp: Removed old obsolete
Message::Object based addToObject() method.
* rulesets/Thing.cpp: Optimised apperance/disappearance code.
Al Riddoch <alriddoch@zepler.org>
2001-07-16 17:52:23 +00:00
|
|
|
}
|
2006-05-11 23:33:58 +00:00
|
|
|
|
2007-12-05 01:23:52 +00:00
|
|
|
int nice = 1;
|
2007-12-04 19:18:17 +00:00
|
|
|
readConfigItem(instance, "nice", nice);
|
2014-01-27 22:00:21 +01:00
|
|
|
|
2015-04-10 22:00:56 +02:00
|
|
|
|
2018-04-25 13:16:33 +02:00
|
|
|
FileSystemObserver* file_system_observer = new FileSystemObserver(*io_service);
|
|
|
|
|
|
2018-04-26 19:28:20 +02:00
|
|
|
AssetsManager* assets_manager = new AssetsManager(*file_system_observer);
|
|
|
|
|
assets_manager->init();
|
|
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
std::vector<std::string> python_directories;
|
|
|
|
|
// Add the path to the non-ruleset specific code.
|
|
|
|
|
python_directories.push_back(share_directory + "/cyphesis/scripts");
|
|
|
|
|
python_directories.push_back(share_directory + "/cyphesis/rulesets/basic/scripts");
|
|
|
|
|
// Add the path to the ruleset specific code.
|
|
|
|
|
python_directories.push_back(share_directory + "/cyphesis/rulesets/" + ruleset_name + "/scripts");
|
|
|
|
|
|
2018-04-30 23:34:58 +02:00
|
|
|
// Start up the Python subsystem.
|
2018-10-31 21:38:35 +01:00
|
|
|
init_python_api({&CyPy_Server::init,
|
|
|
|
|
&CyPy_Rules::init,
|
|
|
|
|
&CyPy_Physics::init,
|
|
|
|
|
&CyPy_EntityFilter::init,
|
|
|
|
|
&CyPy_Atlas::init,
|
|
|
|
|
&CyPy_Common::init},
|
2018-12-16 23:20:33 +01:00
|
|
|
python_directories);
|
2018-05-10 01:15:35 +02:00
|
|
|
observe_python_directories(*io_service, *assets_manager);
|
2018-04-30 23:34:58 +02:00
|
|
|
|
2018-04-25 20:09:14 +02:00
|
|
|
Inheritance* inheritance = new Inheritance();
|
2005-09-26 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/inheritance.cpp,
common/inheritance.h, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Character.h, rulesets/Entity.cpp,
rulesets/Food.cpp, rulesets/Plant.cpp, rulesets/Stackable.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
server/Admin.cpp, server/Connection.cpp, server/server.cpp:
Remove the subscription mechanism as it is no longer necessary
now that operations have class numbers.
2005-09-26 01:56:21 +00:00
|
|
|
|
2017-08-13 17:16:02 +02:00
|
|
|
SystemTime time{};
|
2011-10-31 11:19:33 +01:00
|
|
|
time.update();
|
|
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
auto entityBuilder = new EntityBuilder();
|
|
|
|
|
auto arithmenticBuilder = new ArithmeticBuilder();
|
2003-03-07 00:22:12 +00:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
Ruleset* ruleset = new Ruleset(entityBuilder, *io_service);
|
2018-05-10 00:21:30 +02:00
|
|
|
ruleset->loadRules(ruleset_name);
|
2009-08-19 02:47:15 +01:00
|
|
|
|
2018-07-22 23:48:42 +02:00
|
|
|
Ref<LocatedEntity> baseEntity = new World(consts::rootWorldId, consts::rootWorldIntId);
|
|
|
|
|
baseEntity->setType(Inheritance::instance().getType("world"));
|
|
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
WorldRouter* world = new WorldRouter(time, baseEntity);
|
2018-01-19 21:35:48 +01:00
|
|
|
|
2018-10-31 21:38:35 +01:00
|
|
|
CyPy_Server::registerWorld(world);
|
2018-07-22 19:47:35 +02:00
|
|
|
|
2018-01-19 21:35:48 +01:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
auto possessionAuthenticator = new PossessionAuthenticator();
|
2010-07-29 22:53:44 +05:30
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
auto externalMindsManager = new ExternalMindsManager();
|
|
|
|
|
auto store = new StorageManager(*world);
|
2008-08-17 21:18:45 +00:00
|
|
|
|
2005-11-13 Al Riddoch <alriddoch@zepler.org>
* server/Admin.cpp, server/CommPeer.cpp, server/CommPeer.h,
server/CommPeerListener.cpp, server/Peer.cpp, server/Peer.h:
Re-work classes for peer connections to use integer IDs.
* server/Lobby.cpp, server/Lobby.h: Modify interface so its more
obvious that lobby only handles accounts, and adjust to have
integer ID.
* server/Connection.cpp, server/Connection.h,
server/TrustedConnection.cpp, server/TrustedConnection.h: Use
integer IDs, and modify to match new Lobby API changes.
* server/ServerRouting.cpp, server/ServerRouting.h, server/server.cpp:
Modify server to have integer ID, and handle ID for Lobby as well.
* server/CommListener.cpp, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommUnixListener.cpp:
Modify communication classes for normal clients to handle
integer IDs on the connection classes.
2005-11-13 23:28:02 +00:00
|
|
|
// This ID is currently generated every time, but should perhaps be
|
|
|
|
|
// persistent in future.
|
|
|
|
|
std::string server_id, lobby_id;
|
2006-05-07 00:10:10 +00:00
|
|
|
long int_id, lobby_int_id;
|
|
|
|
|
|
2014-01-27 22:00:21 +01:00
|
|
|
if (((int_id = newId(server_id)) < 0)
|
2018-12-16 23:20:33 +01:00
|
|
|
|| ((lobby_int_id = newId(lobby_id)) < 0)) {
|
2006-05-07 00:10:10 +00:00
|
|
|
log(CRITICAL, "Unable to get server IDs from Database");
|
|
|
|
|
return EXIT_DATABASE_ERROR;
|
|
|
|
|
}
|
2005-11-13 Al Riddoch <alriddoch@zepler.org>
* server/Admin.cpp, server/CommPeer.cpp, server/CommPeer.h,
server/CommPeerListener.cpp, server/Peer.cpp, server/Peer.h:
Re-work classes for peer connections to use integer IDs.
* server/Lobby.cpp, server/Lobby.h: Modify interface so its more
obvious that lobby only handles accounts, and adjust to have
integer ID.
* server/Connection.cpp, server/Connection.h,
server/TrustedConnection.cpp, server/TrustedConnection.h: Use
integer IDs, and modify to match new Lobby API changes.
* server/ServerRouting.cpp, server/ServerRouting.h, server/server.cpp:
Modify server to have integer ID, and handle ID for Lobby as well.
* server/CommListener.cpp, server/CommLocalClient.cpp,
server/CommLocalClient.h, server/CommRemoteClient.cpp,
server/CommRemoteClient.h, server/CommUnixListener.cpp:
Modify communication classes for normal clients to handle
integer IDs on the connection classes.
2005-11-13 23:28:02 +00:00
|
|
|
|
2012-02-06 20:52:39 +00:00
|
|
|
// Create the core server object, which stores central data,
|
|
|
|
|
// and track objects
|
2018-12-16 23:20:33 +01:00
|
|
|
ServerRouting* server = new ServerRouting(*world, ruleset_name,
|
|
|
|
|
server_name, server_id, int_id, lobby_id, lobby_int_id);
|
2002-11-23 Al Riddoch <alriddoch@zepler.org>
* Increment to devel version 0.3, and start breaking things.
* server/CommClient.cpp, server/CommClient.h, server/CommServer.cpp,
server/CommServer.h, server/server.cpp, server/CommListener.cpp,
server/CommListener.h, server/CommMetaClient.cpp,
server/CommMetaClient.h, server/CommSocket.cpp, server/CommSocket.h:
Refactor network code so metaserver and listen socket are no longer
special cases, opening up the way for a database connection handler.
2002-11-23 17:13:39 +00:00
|
|
|
|
2017-06-24 21:46:48 +02:00
|
|
|
std::function<void(CommAsioClient<ip::tcp>&)> tcpAtlasStarter = [&](CommAsioClient<ip::tcp>& client) {
|
|
|
|
|
std::string connection_id;
|
|
|
|
|
long c_iid = newId(connection_id);
|
|
|
|
|
//Turn off Nagle's algorithm to increase responsiveness.
|
|
|
|
|
client.getSocket().set_option(ip::tcp::no_delay(true));
|
2017-08-08 13:59:53 +02:00
|
|
|
//Listen to both ipv4 and ipv6
|
2017-08-13 17:16:02 +02:00
|
|
|
//client.getSocket().set_option(boost::asio::ip::v6_only(false));
|
2017-06-24 21:46:48 +02:00
|
|
|
client.startAccept(new Connection(client, *server, "", connection_id, c_iid));
|
|
|
|
|
};
|
2002-12-19 20:04:37 +00:00
|
|
|
|
2017-06-24 21:46:48 +02:00
|
|
|
std::list<CommAsioListener<ip::tcp, CommAsioClient<ip::tcp>>> tcp_atlas_clients;
|
2014-01-27 22:00:21 +01:00
|
|
|
|
2007-12-04 19:18:17 +00:00
|
|
|
if (client_port_num < 0) {
|
|
|
|
|
client_port_num = dynamic_port_start;
|
|
|
|
|
for (; client_port_num <= dynamic_port_end; client_port_num++) {
|
2014-01-27 22:00:21 +01:00
|
|
|
try {
|
2017-06-24 21:46:48 +02:00
|
|
|
tcp_atlas_clients.emplace_back(tcpAtlasStarter, server->getName(), *io_service,
|
2017-08-08 13:59:53 +02:00
|
|
|
ip::tcp::endpoint(ip::tcp::v6(), client_port_num));
|
2014-01-27 22:00:21 +01:00
|
|
|
} catch (const std::exception& e) {
|
2007-12-04 19:18:17 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-27 22:00:21 +01:00
|
|
|
if (client_port_num < dynamic_port_end) {
|
|
|
|
|
log(ERROR,
|
2018-12-16 23:20:33 +01:00
|
|
|
String::compose("Could not find free client listen "
|
|
|
|
|
"socket in range %1-%2. Init failed.",
|
|
|
|
|
dynamic_port_start, dynamic_port_end));
|
2014-01-27 22:00:21 +01:00
|
|
|
log(INFO,
|
2018-12-16 23:20:33 +01:00
|
|
|
String::compose("To allocate 8 more ports please run:"
|
|
|
|
|
"\n\n cyconfig "
|
|
|
|
|
"--cyphesis:dynamic_port_end=%1\n\n",
|
|
|
|
|
dynamic_port_end + 8));
|
2007-12-06 23:50:14 +00:00
|
|
|
return EXIT_PORT_ERROR;
|
2007-12-04 19:18:17 +00:00
|
|
|
}
|
2007-12-05 17:33:19 +00:00
|
|
|
log(INFO, String::compose("Auto configuring new instance \"%1\" "
|
2018-12-16 23:20:33 +01:00
|
|
|
"to use port %2.", instance, client_port_num));
|
2007-12-05 17:33:19 +00:00
|
|
|
global_conf->setItem(instance, "tcpport", client_port_num,
|
2018-12-16 23:20:33 +01:00
|
|
|
varconf::USER);
|
2007-12-06 02:46:32 +00:00
|
|
|
global_conf->setItem(CYPHESIS, "dynamic_port_start",
|
2018-12-16 23:20:33 +01:00
|
|
|
client_port_num + 1, varconf::USER);
|
2014-01-27 22:00:21 +01:00
|
|
|
} else {
|
|
|
|
|
try {
|
2017-08-08 13:59:53 +02:00
|
|
|
tcp_atlas_clients.emplace_back(tcpAtlasStarter, server->getName(), *io_service, ip::tcp::endpoint(ip::tcp::v6(), client_port_num));
|
2014-01-27 22:00:21 +01:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
|
log(ERROR, String::compose("Could not create client listen socket "
|
2018-12-16 23:20:33 +01:00
|
|
|
"on port %1. Init failed. The most common reason for this "
|
|
|
|
|
"is that you're already running an instance of Cyphesis.",
|
|
|
|
|
client_port_num));
|
2014-01-27 22:00:21 +01:00
|
|
|
return EXIT_SOCKET_ERROR;
|
|
|
|
|
}
|
2000-08-13 20:36:18 +00:00
|
|
|
}
|
2002-12-19 20:04:37 +00:00
|
|
|
|
2014-01-29 15:15:10 +01:00
|
|
|
remove(python_socket_name.c_str());
|
|
|
|
|
std::function<void(CommPythonClient&)> pythonStarter =
|
2018-12-16 23:20:33 +01:00
|
|
|
[&](CommPythonClient& client) {
|
|
|
|
|
client.startAccept();
|
|
|
|
|
};
|
2017-06-24 21:46:48 +02:00
|
|
|
auto pythonListener = new CommAsioListener<local::stream_protocol, CommPythonClient>(pythonStarter, server->getName(), *io_service,
|
|
|
|
|
local::stream_protocol::endpoint(python_socket_name));
|
2009-01-30 00:43:41 +00:00
|
|
|
|
2014-01-27 22:00:21 +01:00
|
|
|
remove(client_socket_name.c_str());
|
2017-06-24 21:46:48 +02:00
|
|
|
std::function<void(CommAsioClient<local::stream_protocol>&)> localStarter = [&](CommAsioClient<local::stream_protocol>& client) {
|
|
|
|
|
std::string connection_id;
|
|
|
|
|
long c_iid = newId(connection_id);
|
|
|
|
|
client.startAccept(new TrustedConnection(client, *server, "", connection_id, c_iid));
|
|
|
|
|
};
|
|
|
|
|
auto localListener = new CommAsioListener<local::stream_protocol, CommAsioClient<local::stream_protocol>>(localStarter, server->getName(), *io_service,
|
|
|
|
|
local::stream_protocol::endpoint(client_socket_name));
|
2014-01-27 22:00:21 +01:00
|
|
|
|
2014-01-29 15:15:10 +01:00
|
|
|
|
2015-04-08 19:15:00 +02:00
|
|
|
//Instantiate at startup
|
2018-08-04 01:12:45 +02:00
|
|
|
auto httpCache = new HttpCache();
|
2017-06-24 21:46:48 +02:00
|
|
|
std::function<void(CommHttpClient&)> httpStarter = [&](CommHttpClient& client) {
|
2017-08-08 13:59:53 +02:00
|
|
|
//Listen to both ipv4 and ipv6
|
2017-08-13 17:16:02 +02:00
|
|
|
//client.getSocket().set_option(boost::asio::ip::v6_only(false));
|
2017-06-24 21:46:48 +02:00
|
|
|
client.serveRequest();
|
|
|
|
|
};
|
2014-01-29 13:08:52 +01:00
|
|
|
|
2017-06-24 21:46:48 +02:00
|
|
|
auto httpListener = new CommAsioListener<ip::tcp, CommHttpClient>(httpStarter, server->getName(), *io_service,
|
2017-08-08 13:59:53 +02:00
|
|
|
ip::tcp::endpoint(ip::tcp::v6(), http_port_num));
|
2012-07-24 16:51:12 +01:00
|
|
|
|
2015-04-10 21:58:31 +02:00
|
|
|
log(INFO, compose("Http service. The following endpoints are available over port %1.", http_port_num));
|
|
|
|
|
log(INFO, " /config : shows server configuration");
|
|
|
|
|
log(INFO, " /monitors : various monitored values, suitable for time series systems");
|
|
|
|
|
log(INFO, " /monitors/numerics : only numerical values, suitable for time series system that only operates on numerical data");
|
2015-04-08 19:15:00 +02:00
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
CommMetaClient* cmc(nullptr);
|
2002-12-19 20:04:37 +00:00
|
|
|
if (useMetaserver) {
|
2014-02-04 20:57:09 +01:00
|
|
|
cmc = new CommMetaClient(*io_service);
|
2014-01-30 16:13:32 +01:00
|
|
|
if (cmc->setup(mserver) != 0) {
|
2003-08-23 20:40:39 +00:00
|
|
|
log(ERROR, "Error creating metaserver comm channel.");
|
|
|
|
|
delete cmc;
|
2014-01-30 16:13:32 +01:00
|
|
|
cmc = nullptr;
|
* tools/cydbload.cpp: Added parameter handling so any file can
be loaded into the database.
* tools/cycmd.cpp: Cleaned up usage and help functions.
* tools/cyisoload.cpp: Cleaned up usage(), and made sure build
completes okay if libraries are missing, and missing
functionality is reported to the user.
* server/server.cpp: Added config options that specifies that
the contents of the db should loaded on server startup. Cleaned
up some debug code.
* server/WorldTime.cpp, server/WorldRouter.cpp,
server/Connection.cpp, rulesets/Structure.h,
rulesets/Python_API.cpp, rulesets/Py_WorldTime.cpp,
rulesets/Movement.cpp, rulesets/Entity.cpp,
physics/Vector3D.h, common/persistance.cpp,
common/database.h, common/database.cpp: Removed output either
to debug mode, or removed altogether.
* common/BaseEntity.h, common/BaseEntity.cpp: Removed redundant header
includes.
* server/ServerRouting.cpp, common/persistance.h,
common/persistance.cpp: Modified admin account function names it
fit convention.
* module/Location.h: Fixed collision detection so that entities
with velocity set to 0 still get checked.
* rulesets/Entity.cpp, rulesets/Thing.cpp, rulesets/Character.cpp,
rulesets/BaseMind.cpp, rulesets/Creator.cpp,
rulesets/ExternalMind.cpp, rulesets/Food.cpp, rulesets/MemMap.cpp,
rulesets/Movement.cpp, rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Py_*.cpp, rulesets/World.cpp:
Removed unnecessary #includes.
Al Riddoch <alriddoch@zepler.org>
2001-06-04 11:22:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
2002-12-28 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, rulesets/Character.cpp,
rulesets/Food.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
Add arg to error method specifying where the error should go. Use
this arg to ensure that errors don't get broadcast.
* common/Database.cpp, common/Database.h, common/const.cpp,
server/Persistor.cpp, server/Restoration.cpp,
server/WorldRouter.cpp
Change id and loc column in entity tables to integer for
performance. Add id generator sequence to database
* common/Database.cpp, common/Database.h, server/Persistance.cpp,
server/Persistance.h: Remove old legacy world, mind and server
tables as they are no longer used.
* common/BaseEntity.cpp, common/Load.h, common/Save.h,
common/custom.cpp, common/op_switch.h, common/operations.cpp,
common/operations.h, common/types.h, rulesets/BaseMind.cpp,
rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
server/Admin.cpp, server/Admin.h, server/server.cpp,
tools/cycmd.cpp: Remove Load and Save ops.
* rulesets/Area.cpp, rulesets/Character.cpp, rulesets/Line.cpp,
rulesets/Plant.cpp: Fix != to |= when setting update flags.
* server/CommMetaClient.cpp, server/CommMetaClient.h,
server/CommServer.cpp, server/CommServer.h, server/server.cpp:
Add mechanism for sockets to be called whenever the server
is idle, so that they do period things. Use this mechanis,
to handle sending periodic packets to the metaserver, removing
special case code from CommServer.
2002-12-28 21:52:32 +00:00
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
CommMDNSPublisher* cmdns = nullptr;
|
2012-07-25 21:34:20 +01:00
|
|
|
#if defined(HAVE_AVAHI)
|
2004-11-11 14:26:21 +00:00
|
|
|
|
2014-02-04 20:57:09 +01:00
|
|
|
cmdns = new CommMDNSPublisher(*io_service, *server);
|
2014-01-31 13:36:03 +01:00
|
|
|
if (cmdns->setup() != 0) {
|
2005-12-07 02:43:08 +00:00
|
|
|
log(ERROR, "Unable to register service with MDNS daemon.");
|
2004-11-11 14:26:21 +00:00
|
|
|
delete cmdns;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-25 21:34:20 +01:00
|
|
|
#endif // defined(HAVE_AVAHI)
|
2007-12-05 17:33:19 +00:00
|
|
|
// Configuration is now complete, and verified as somewhat sane, so
|
|
|
|
|
// we save the updated user config.
|
|
|
|
|
|
2018-10-11 22:30:22 +02:00
|
|
|
run_user_scripts("cyphesis");
|
2017-06-24 21:46:48 +02:00
|
|
|
|
|
|
|
|
IdleConnector* storage_idle = nullptr;
|
|
|
|
|
|
2018-05-19 23:18:40 +02:00
|
|
|
log(INFO, "Restoring world from database...");
|
2017-06-24 21:46:48 +02:00
|
|
|
|
2018-07-22 23:48:42 +02:00
|
|
|
store->restoreWorld(baseEntity);
|
2018-05-19 23:18:40 +02:00
|
|
|
// Read the world entity if any from the database, or set it up.
|
|
|
|
|
// If it was there, make sure it did not get any of the wrong
|
|
|
|
|
// position or orientation data.
|
2018-07-22 23:48:42 +02:00
|
|
|
store->initWorld(baseEntity);
|
2017-06-24 21:46:48 +02:00
|
|
|
|
2018-05-19 23:18:40 +02:00
|
|
|
log(INFO, "Restored world.");
|
2017-06-24 21:46:48 +02:00
|
|
|
|
2018-05-19 23:18:40 +02:00
|
|
|
storage_idle = new IdleConnector(*io_service);
|
|
|
|
|
storage_idle->idling.connect(
|
|
|
|
|
sigc::mem_fun(store, &StorageManager::tick));
|
2017-06-24 21:46:48 +02:00
|
|
|
|
|
|
|
|
|
2007-12-05 17:33:19 +00:00
|
|
|
updateUserConfiguration();
|
|
|
|
|
|
2002-07-14 21:04:50 +00:00
|
|
|
log(INFO, "Running");
|
2006-01-11 02:36:16 +00:00
|
|
|
logEvent(START, "- - - Standalone server startup");
|
2002-10-03 10:51:59 +00:00
|
|
|
|
2002-12-19 20:04:37 +00:00
|
|
|
// Inform things that want to know that we are running.
|
2002-10-03 10:51:59 +00:00
|
|
|
running();
|
2002-12-19 20:04:37 +00:00
|
|
|
|
2006-05-02 14:06:35 +00:00
|
|
|
// Reduce our system priority to make it easier to debug a runaway
|
|
|
|
|
// server.
|
2006-05-11 23:33:58 +00:00
|
|
|
if (nice != 0) {
|
|
|
|
|
reduce_priority(nice);
|
|
|
|
|
}
|
2006-05-02 14:06:35 +00:00
|
|
|
|
2013-11-24 22:26:22 +01:00
|
|
|
//Check if the world is populated; if it's not we should perhaps import some entities into it.
|
|
|
|
|
//Note that we only check the top level; we don't perform a full hierarchical
|
|
|
|
|
//traversal. Mainly because we never need to.
|
|
|
|
|
auto autoImport = global_conf->getItem(CYPHESIS, "autoimport");
|
2018-04-25 13:16:33 +02:00
|
|
|
if (autoImport.is_string() && !autoImport.as_string().empty()) {
|
2013-11-24 22:26:22 +01:00
|
|
|
std::string importPath = autoImport.as_string();
|
|
|
|
|
std::ifstream file(importPath);
|
|
|
|
|
if (file.good()) {
|
|
|
|
|
file.close();
|
|
|
|
|
//We should only try to import if the world isn't populated.
|
|
|
|
|
bool isPopulated = false;
|
2018-07-22 23:48:42 +02:00
|
|
|
if (baseEntity->m_contains) {
|
2018-09-22 23:11:22 +02:00
|
|
|
for (const auto& entity : *baseEntity->m_contains) {
|
2013-11-24 22:26:22 +01:00
|
|
|
//if there's any entity that's not transient we consider it populated
|
|
|
|
|
if (!entity->hasAttr("transient")) {
|
|
|
|
|
isPopulated = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isPopulated) {
|
|
|
|
|
//Populate the server through separate process (mainly because it's easier as we've
|
|
|
|
|
//already written the importer tool; we might also do it in-process, but that would
|
|
|
|
|
//require some rewriting of code).
|
2013-11-24 23:10:04 +01:00
|
|
|
log(INFO,
|
2018-12-16 23:20:33 +01:00
|
|
|
compose("Trying to import world from %1.", importPath));
|
2013-11-24 23:46:27 +01:00
|
|
|
std::stringstream ss;
|
2015-05-28 21:22:11 +02:00
|
|
|
ss << bin_directory <<
|
2018-12-16 23:20:33 +01:00
|
|
|
"/cyimport --resume \"" << importPath + "\"";
|
2013-11-24 23:46:27 +01:00
|
|
|
std::string command = ss.str();
|
2014-01-27 22:00:21 +01:00
|
|
|
std::thread importer([=]() {
|
|
|
|
|
int result = std::system(command.c_str());
|
|
|
|
|
if (result == 0) {
|
|
|
|
|
log(INFO, "Imported world into empty server.");
|
|
|
|
|
} else {
|
|
|
|
|
log(INFO, "No world imported.");
|
|
|
|
|
}
|
|
|
|
|
});
|
2013-11-24 22:26:22 +01:00
|
|
|
importer.detach();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log(NOTICE,
|
2018-12-16 23:20:33 +01:00
|
|
|
compose("Not importing as \"%1\" could not be found",
|
|
|
|
|
importPath));
|
2013-11-24 22:26:22 +01:00
|
|
|
file.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-22 23:11:22 +02:00
|
|
|
auto softExitStart = [&]() {
|
|
|
|
|
size_t requestNumber = store->requestMinds(world->getEntities());
|
|
|
|
|
log(INFO, String::compose("Soft exit requested, persisting %1 minds.", requestNumber));
|
2015-05-23 23:21:09 +02:00
|
|
|
|
2018-09-22 23:11:22 +02:00
|
|
|
//Set a deadline for five seconds.
|
|
|
|
|
boost::posix_time::seconds duration(5);
|
|
|
|
|
log(NOTICE, String::compose("Deadline for mind persistence set to %1 seconds.", duration.ticks()));
|
2015-05-23 23:21:09 +02:00
|
|
|
|
2018-09-22 23:11:22 +02:00
|
|
|
return duration;
|
|
|
|
|
};
|
2015-05-23 23:21:09 +02:00
|
|
|
|
2014-02-01 20:35:26 +01:00
|
|
|
|
2018-12-16 23:20:33 +01:00
|
|
|
auto softExitPoll = [&]() {
|
2018-09-22 23:11:22 +02:00
|
|
|
if (store->numberOfOutstandingThoughtRequests() == 0) {
|
|
|
|
|
log(NOTICE, "All entity thoughts were persisted.");
|
|
|
|
|
return true;
|
2016-07-10 16:01:18 +02:00
|
|
|
}
|
2018-09-22 23:11:22 +02:00
|
|
|
return false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto softExitTimeout = [&]() {
|
|
|
|
|
log(WARNING, String::compose("Waiting for persisting thoughts timed out. This might "
|
|
|
|
|
"lead to lost entity thoughts. %1 thoughts outstanding.",
|
|
|
|
|
store->numberOfOutstandingThoughtRequests()));
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MainLoop::run(daemon_flag, *io_service, world->getOperationsHandler(), {softExitStart, softExitPoll, softExitTimeout});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Actually, there's no way for the world to know that it's shutting down,
|
|
|
|
|
//as the shutdown signal most probably comes from a sighandler. We need to
|
|
|
|
|
//tell it it's shutting down so it can do some housekeeping.
|
|
|
|
|
try {
|
|
|
|
|
exit_flag = false;
|
|
|
|
|
if (store->shutdown(exit_flag, world->getEntities()) != 0) {
|
2013-04-06 18:26:38 +02:00
|
|
|
//Ignore this error and carry on with shutting down.
|
2018-09-22 23:11:22 +02:00
|
|
|
log(ERROR, "Error when shutting down");
|
2013-04-06 18:26:38 +02:00
|
|
|
}
|
2018-09-22 23:11:22 +02:00
|
|
|
} catch (const std::exception& e) {
|
|
|
|
|
log(ERROR,
|
|
|
|
|
String::compose("Exception caught when shutting down: %1",
|
|
|
|
|
e.what()));
|
|
|
|
|
} catch (...) {
|
|
|
|
|
//Ignore this error and carry on with shutting down.
|
|
|
|
|
log(ERROR, "Exception caught when shutting down");
|
2013-04-06 18:26:38 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-22 23:11:22 +02:00
|
|
|
|
2018-05-19 23:52:16 +02:00
|
|
|
delete dbvacuumTask;
|
|
|
|
|
|
2018-04-26 19:28:20 +02:00
|
|
|
delete assets_manager;
|
|
|
|
|
|
2018-05-22 22:47:11 +02:00
|
|
|
delete file_system_observer;
|
|
|
|
|
|
2014-02-04 20:57:09 +01:00
|
|
|
delete cmdns;
|
|
|
|
|
|
2014-01-30 16:13:32 +01:00
|
|
|
if (cmc) {
|
|
|
|
|
cmc->metaserverTerminate();
|
|
|
|
|
delete cmc;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 23:22:17 +01:00
|
|
|
delete localListener;
|
|
|
|
|
delete httpListener;
|
2018-05-22 22:47:11 +02:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete httpCache;
|
2015-04-08 19:15:00 +02:00
|
|
|
|
2014-02-17 23:22:17 +01:00
|
|
|
delete pythonListener;
|
|
|
|
|
|
2014-02-04 20:57:09 +01:00
|
|
|
tcp_atlas_clients.clear();
|
|
|
|
|
|
2013-09-12 22:27:27 +02:00
|
|
|
delete storage_idle;
|
|
|
|
|
|
2016-07-10 16:01:18 +02:00
|
|
|
delete dbsocket;
|
|
|
|
|
|
2018-05-22 22:47:11 +02:00
|
|
|
//Run any outstanding tasks before shutting down service.
|
|
|
|
|
io_service->run();
|
|
|
|
|
|
2014-02-04 20:57:09 +01:00
|
|
|
delete io_service;
|
2011-10-02 16:56:29 +01:00
|
|
|
|
|
|
|
|
delete server;
|
|
|
|
|
|
|
|
|
|
delete store;
|
|
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete externalMindsManager;
|
|
|
|
|
|
|
|
|
|
delete possessionAuthenticator;
|
|
|
|
|
|
2011-10-02 16:56:29 +01:00
|
|
|
delete world;
|
2001-10-10 09:40:24 +00:00
|
|
|
|
2018-05-10 00:21:30 +02:00
|
|
|
delete ruleset;
|
2014-02-17 23:22:17 +01:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
entityBuilder->flushFactories();
|
|
|
|
|
delete entityBuilder;
|
2018-05-16 11:21:07 +02:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete arithmenticBuilder;
|
2018-05-16 11:21:07 +02:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete persistence;
|
2001-05-23 19:09:15 +00:00
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete database;
|
2001-05-23 19:09:15 +00:00
|
|
|
|
2018-04-25 20:09:14 +02:00
|
|
|
delete inheritance;
|
2001-11-24 13:23:17 +00:00
|
|
|
|
2013-08-22 10:47:08 +02:00
|
|
|
// Shutdown the Python interpreter. This frees lots of memory, and if
|
2001-11-10 15:20:58 +00:00
|
|
|
// the malloc heap is in any way corrupt, a segfault is likely to
|
2013-08-22 10:47:08 +02:00
|
|
|
// occur at this point. Previous occasions where pointers have been
|
2001-11-10 15:20:58 +00:00
|
|
|
// deleted twice elsewhere in the code, have resulted in a segfault
|
|
|
|
|
// at this point. AlRiddoch 10th November 2001
|
* aiclient/ClientConnection.cpp, aiclient/client.cpp,
client/ClientConnection.cpp, common/database.h, common/globals.cpp,
common/persistance.cpp, common/stringstream.h, server/CommClient.cpp,
server/CommServer.cpp, server/Persistance.cpp, tools/cyctrl.cpp,
tools/cyctrl.cpp, tools/cydbload.cpp, tools/cyisoload.cpp,
tools/cypasswd.cpp: Removed unused config.h.
* client/ObserverClient.cpp, common/const.h, tools/cycmd.cpp:
Use default password if the admin account cannot be fetched from
the database.
* client/Py_CreatorClient.cpp, common/BaseEntity.cpp,
common/BaseEntity.h, rulesets/Character.cpp, rulesets/Creator.cpp,
rulesets/Entity.cpp, rulesets/Entity.h, rulesets/EntityFactory.cpp,
rulesets/MemMap.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
rulesets/Py_World.cpp, rulesets/Thing.cpp, server/Account.cpp,
server/Admin.cpp, server/Connection.cpp, tools/cywatchdog.cpp:
Make many of the member variables of Entity protected, and add
the required accessors. Changed the name of the id attribute
to m_id.
* common/BaseWorld.h, common/database.cpp, common/persistance.cpp:
Removed unused includes.
* common/Chop.h, common/Cut.h, common/Eat.h, common/Fire.h,
common/Generic.h, common/Load.h, common/Nourish.h, common/Save.h,
common/Setup.h, common/Tick.h: Moved definition of virtual
functions into cpp file, to reduce wasted code.
* common/Makefile.am: Create cyphesis library, which can be used by
other applications to access cyphesis databases.
* common/config.h, common/database.h, server/Persistance.cpp,
tools/cydbload.cpp, tools/cyisoload.cpp, tools/cypasswd.cpp:
Remove conditional compilation of db code. db3 is now required.
* server/WorldRouter.h: Fixed getNewId() so it take const string.
* server/server.cpp: Removed python shutdown, so it does not
mess up the db if it causes a segfault.
Al Riddoch <alriddoch@zepler.org>
2001-10-17 14:09:42 +00:00
|
|
|
shutdown_python_api();
|
|
|
|
|
|
2001-06-23 14:23:25 +00:00
|
|
|
delete global_conf;
|
|
|
|
|
|
2018-08-04 01:12:45 +02:00
|
|
|
delete monitors;
|
2015-04-06 21:47:55 +02:00
|
|
|
|
2002-07-14 21:04:50 +00:00
|
|
|
log(INFO, "Clean shutdown complete.");
|
2006-01-11 02:36:16 +00:00
|
|
|
logEvent(STOP, "- - - Standalone server shutdown");
|
2001-03-15 11:41:34 +00:00
|
|
|
return 0;
|
2000-08-13 20:36:18 +00:00
|
|
|
}
|