This required cleaning up a bunch of other things:
Expose functions to disconnect and flush sockets generally
Make a new base class for objects that link a socket to the server
* server/CommClient.cpp, server/CommClient.h,
server/CommHttpClient.cpp, server/CommHttpClient.h:
Convert two stream classes to use the stream base class.
* server/CommPeer.h, server/CommPeer.cpp: Re-factor CommPeer to
only be used for initiating peer connections.
* server/Admin.cpp: Use the modified CommPeer constructor.
* server/CommClient.h, server/CommClient.cpp: Make the connection
a pointer rather than a reference, and pass it in during setup.
* server/CommClientFactory.h, server/CommClientFactory.cpp: Re-factor
the commclient factory to take connection type as a template param,
and create the client and connection objects separately.
* server/server.cpp: Use the modified CommClientFactory parameter.
* server/Makefile.am: Remove the different kinds of client class
from the build.
* common/Identified.cpp, common/Identified.h, rulesets/Character.h,
rulesets/LocatedEntity.h, server/Account.h, server/Admin.cpp,
server/CommClient.cpp, server/CommClient.h, server/Connection.cpp,
server/Connection.h, server/ExternalMind.h,
server/ExternalProperty.cpp, server/ExternalProperty.h,
server/Lobby.h, server/Master.h, server/Peer.h,
server/ServerRouting.h, server/SlaveClientConnection.h:
Rename IdentifiedRouter to Router as it's the base class
for pretty much all routers.
* client/BaseClient.cpp, common/BaseEntity.cpp, common/BaseEntity.h,
common/Identified.cpp, common/Identified.h, common/Makefile.am,
common/OOGThing.cpp, common/OOGThing.h, common/OperationRouter.cpp,
common/OperationRouter.h, rulesets/Character.h, rulesets/Entity.h,
rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h,
server/Account.cpp, server/Account.h, server/Admin.cpp,
server/CommClient.cpp, server/CommClient.h, server/Connection.cpp,
server/Connection.h, server/ExternalMind.cpp, server/ExternalMind.h,
server/ExternalProperty.cpp, server/ExternalProperty.h,
server/Lobby.cpp, server/Lobby.h, server/Master.cpp, server/Master.h,
server/Peer.cpp, server/Peer.h, server/ServerRouting.cpp,
server/ServerRouting.h, server/SlaveClientConnection.cpp,
server/SlaveClientConnection.h: Factor out the more pointless base
classes, in favor of simple interface. Move destroyed signal to
Entity, which is the only place it is needed.
* common/Identified.cpp, common/Identified.h: Add a new base class
which combines Identified with OperationRouter.
* server/CommClient.cpp, server/CommClient.h: Modify CommClient to
refer to it's operation routing object purely by the OperationRouter
interface.
* server/Connection.cpp, server/Connection.h,
server/TrustedConnection.cpp: Re-factor connection routers so
they no longer inherit from BaseEntity, and instead inherit
cleanly from the minimum required interfaces.
* common/log.cpp, common/log.h: Switch to taking a C++ string reference
rather than a char *, as it is not really an optimisation, and it
makes the code simpler to read and write.
* client/BaseClient.cpp, client/ClientConnection.cpp,
common/AtlasFileLoader.cpp, common/BaseEntity.cpp,
common/Database.cpp, common/globals.cpp, common/id.cpp,
common/inheritance.cpp, common/log.cpp, common/log.h,
rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Pedestrian.cpp,
rulesets/Py_Object.cpp, rulesets/Py_RootEntity.cpp,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Python_API.cpp, rulesets/Thing.cpp, server/Account.cpp,
server/Admin.cpp, server/ArithmeticFactory.cpp,
server/CommClient.cpp, server/CommListener.cpp,
server/CommMDNSPublisher.cpp, server/CommServer.cpp,
server/Connection.cpp, server/EntityFactory.cpp,
server/Persistance.cpp, server/Restoration.cpp,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/WorldRouter.cpp, server/server.cpp: Convert over to using
new API correctly.
* data/mason.xml: Add biomass and transient to fircone, making its
script obsolete:
* client/ClientConnection.cpp, server/CommClient.cpp: Clarify the
error messages about non operation objects on the wire, and
use the same messages in the client.
* server/Connection.cpp, server/CommClient.cpp, server/Account.cpp:
Only set refnos on ops if the client has set a serial number.
* rulesets/Character.cpp: Simplify handling the transfer of
operations from client to in-game. Don't give new operations
serial numbers at this point.
* server/CommClient.h, server/CommClient.cpp: Check stream has not
failed before sending ops, to ensure that failed sockets are
cleared promptly. Check fail() in addition to eof() to ensure
that failed connections are detected when reading.
* server/Idle.h, server/Idle.cpp: Rename reference to CommServer
so there is no ambiguity in classes which inherit from Idle
and CommSocket.
* server/CommServer.h, server/CommServer.cpp: Store the current
time, and a flag indicating if the server is currently handling
client traffic. Modify idle handlers so they are only
called if the server is not busy with internal traffic, or traffic
from clients. Check for errors returned by epoll().
* server/CommUnixListener.cpp, server/CommListener.cpp,
server/CommClient.h, server/CommClient.cpp: Make CommClient an
idler, and use it to track clients which connect but don't
negotiate, disconnecting them after a timeout.
* server/Account.cpp, server/Admin.cpp, server/CommClient.cpp,
server/Connection.cpp: Don't set refno on unicast OOG ops,
instead set them at the interface with the client in one
place.
* server/WorldRouter.cpp: Modify setting refno on IG ops so its
now only set on unicast responses.
* rulesets/Creator.cpp: Set refno on responses direct ops from creator
clients more manually.
* common/BaseEntity.cpp: Only set refno on unicast error ops.
* common/refno.h: Disable as this file is no longer used.
* rulesets/Thing.cpp: Remove obsolete commented out code.
* server/Account.cpp, server/Connection.cpp:
Add a note about serialno/refno handling when code sends ops
directly to the client.
* server/CommClient.cpp, server/CommClient.h: Clean up some debug
code, and method names.
* server/Lobby.cpp: Fix a case where a private message would fail
silently if account had logged on recenlty but was no longer.
* server/Admin.cpp: Make sure setup is called on peer connection.
* server/CommClient.h, server/CommClient.cpp: Adapt code so it
can be used for both establishing and accepting connections.
* server/Connection.cpp: Re-order initialisations in constructor
to eliminate warnings.
* server/CommListener.cpp, server/CommListener.h: Add a virtual
create method, so it can be overriden to make different kinds
of listener.
* server/Peer.cpp, server/Peer.h: New class representing connections
to peer servers.
* server/CommPeer.cpp, server/CommPeer.h: New socket class handling
sockets used to connect to peer servers.
* server/CommPeerListener.cpp, server/CommPeerListener.h: New
listener using new virtual interface in CommListener to accept
peer connections.
* server/CommClient.cpp, server/CommClient.h: Add a new constructor
for creating Atlas socket objects which are not yet open. Makes
this class suitable for establishing as well as accepting
connections. Take out call to Connection::destroy.
* server/CommRemoteClient.h: Fix error in header guards.
* server/Connection.cpp, server/Connection.h: Remove
obsolete destroy() method. Make CommClient member public.
* server/server.cpp: Add new listener for peer connections.
* common/types.h: Add enumeration for new connect operation.
* server/Admin.cpp, server/Admin.h: Add new handler for connect
operations, used by admin client to build peer connections.
* tools/cycmd.cpp: Add new command "connect" for sending
connect ops to server.
* common/utility.cpp: Add a FIXME note about more correctly
converting a message to an op.
* server/CommClient.h, server/CommClient.cpp: Call new shutdown()
method in skstream instead of close when disconnecting or
timing out, so that the socket is still valid. Otherwise
there is no reliable way to detect that the socket is no longer
connected.
* server/CommClient.h, server/CommClient.cpp, server/Account.cpp,
server/Connection.h, server/Connection.cpp: Rename close() to
disconect() to more accuratly reflect its function.
* server/CommServer.h, server/CommServer.cpp: Add an implementation
based on epoll which is used if available. Much more efficient
and scalable.
* tools/cycmd.cpp: Fix a couple of memory leaks.
* common/BaseEntity.cpp, common/BaseEntity.h,
rulesets/Character.cpp, rulesets/Creator.cpp,
server/CommClient.cpp, server/ExternalMind.cpp,
server/ExternalMind.h, client/CharacterClient.cpp,
client/CommClient.cpp: Remove the message method from BaseEntity
and everything that inherits from it - its redundant.
* tests/Charactertest.cpp, tests/Creatortest.cpp,
tests/EntityExerciser.h: Sort out the tests so they no longer use
message, and try and get the character class tests working a bit
better.
* server/WorldRouter.cpp, server/CommClient.cpp:
Clean up some error output, making sure it goes to the right place.
* common/FormattedXMLWriter.cpp, common/FormattedXMLWriter.h:
Use ostream as we are only writing, not reading. Improve comments.
* tools/cycmd.cpp: Add new command to enable and disable server
monitoring.
* server/WorldRouter.cpp, common/BaseWorld.h: Add facility to
notify using a SigC signal each type an op is dispatched.
* server/CommClient.h, server/CommClient.cpp: Fix typo in
overridden method which meant it didn't work.
* server/Admin.h, server/Admin.cpp: Add handler for Monitor operation
which turns on and off sending all IG ops to the admin client.
* rulesets/Python_API.cpp, common/types.h, common/Generic.h,
common/BaseEntity.h: Fix Generic op so it can be used, and
clean up its use. Add an enumeration for monitor ops.