-
Notifications
You must be signed in to change notification settings - Fork 4
User Class
For each User:
- What actual server are they connected to? (this is the server that is talking to us on their behalf)
- Which server we are connected to that lets us get to that server. (the above server might be multiple servers away, we need to know which outgoing link to send messages out on in order to reach the above server and said user)
In class User:
connected_server -> string (name/address of their server)
server_link -> Which server to access to reach that user.
I feel like server_link should either represent a connected server or else somehow refer to "local server" in order to let us know this is a user connected directly to us.
server_link might not be the right approach to take for this separation so more thought might be required. It's largely determined on how commands will be handled that might affect local users and remote users as well. Sometimes a command will need to be sent to a specific connected client and other times a server... which makes me think this might just be user.link representing either a client or a server to receive their commands.
We should also give each connection a unique ID (perhaps an MD5 sum on their thread or socket object/memory address which should always be unique?) There are already plans to assign timestamps to both nicknames and channels. I need to read up on the TS5 and TS6 protocols to see what needs to be done to be compliant with these protocols.
Include a last_activity variable that gets updated whenever a message is received from that client. Update it to the current time.
Later when determining if needing to PING test if user.last_activity + limit > NOW() and if so send PING.
A separate thread will go through Server.users array to check each last_activity (>300 seconds for example) and ping appropriately. If no ping response is returned, the socket is closed.