RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.net.session.Session Class Reference

Represents a session between a user and the server. More...

Inheritance diagram for com.runehive.net.session.Session:

Public Member Functions

final void close ()
 The method to close this session.
Channel getChannel ()
 Gets the underlying Channel for this Session.
String getHost ()
 Gets the users host address.
void handleClientPacket (Object o)
 The method that is called when the client sends packets to the server.
 Session (Channel channel)
 Creates a new Session.

Protected Member Functions

void onClose (ChannelFuture future)
 The method called after a session has been closed.

Protected Attributes

final Channel channel
 The channel attached to this session.
final String host
 The users host address.

Detailed Description

Represents a session between a user and the server.

Author
nshusa

Definition at line 14 of file Session.java.

Constructor & Destructor Documentation

◆ Session()

com.runehive.net.session.Session.Session ( Channel channel)

Creates a new Session.

Parameters
channelThe channel that is attached to this session.

Definition at line 32 of file Session.java.

32 {
33 this.channel = channel;
34 this.host = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
35 }

References channel.

Member Function Documentation

◆ close()

final void com.runehive.net.session.Session.close ( )

The method to close this session.

Definition at line 40 of file Session.java.

40 {
41 onClose(channel.close());
42 }

References channel, and onClose().

Here is the call graph for this function:

◆ getChannel()

Channel com.runehive.net.session.Session.getChannel ( )

Gets the underlying Channel for this Session.

Returns
The underlying channel.

Definition at line 69 of file Session.java.

69 {
70 return channel;
71 }

References channel.

Referenced by getHost().

Here is the caller graph for this function:

◆ getHost()

String com.runehive.net.session.Session.getHost ( )

Gets the users host address.

Definition at line 76 of file Session.java.

76 {
77 final Channel channel = getChannel();
78 if (channel != null && channel.hasAttr(Config.SOURCE_ADDRESS)) {
79 return channel.attr(Config.SOURCE_ADDRESS).get();
80 }
81 return host;
82 }

References channel, getChannel(), host, and com.runehive.Config.SOURCE_ADDRESS.

Here is the call graph for this function:

◆ handleClientPacket()

void com.runehive.net.session.Session.handleClientPacket ( Object o)

The method that is called when the client sends packets to the server.

Parameters
oThe vague object packet.

Reimplemented in com.runehive.net.session.GameSession, and com.runehive.net.session.LoginSession.

Definition at line 60 of file Session.java.

60 {
61
62 }

◆ onClose()

void com.runehive.net.session.Session.onClose ( ChannelFuture future)
protected

The method called after a session has been closed.

Parameters
futureThe result of the session being closed.

Reimplemented in com.runehive.net.session.GameSession.

Definition at line 50 of file Session.java.

50 {
51
52 }

Referenced by close().

Here is the caller graph for this function:

Member Data Documentation

◆ channel

◆ host

final String com.runehive.net.session.Session.host
protected

The users host address.

Definition at line 24 of file Session.java.

Referenced by getHost().


The documentation for this class was generated from the following file: