Rewritten to use the Java NIO library rather than the Berkeley NBIO
library. 100% pure baby! At least for the moment. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1958 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
//
|
||||
// $Id: NetEventHandler.java,v 1.5 2002/11/05 02:17:56 mdb Exp $
|
||||
// $Id: NetEventHandler.java,v 1.6 2002/11/18 18:53:10 mdb Exp $
|
||||
|
||||
package com.threerings.presents.server.net;
|
||||
|
||||
import ninja2.core.io_core.nbio.Selectable;
|
||||
|
||||
/**
|
||||
* When a network event arrives on a particular <code>Selectable</code>,
|
||||
* the connection manager calls the net event handler associated with that
|
||||
* selectable to process the event. There are only a few handlers (and
|
||||
* probably only ever will be): the one that accepts new connections, the
|
||||
* one that deals with a connection while the client is authenticating and
|
||||
* the one that processes messages from authenticated connections.
|
||||
* Providing this interface prevents us from having to do a bunch of
|
||||
* When a network event occurs, the connection manager calls the net event
|
||||
* handler associated with that channel to process the event. There are
|
||||
* only a few handlers (and probably only ever will be): the one that
|
||||
* accepts new connections, the one that deals with a connection while the
|
||||
* client is authenticating and the one that processes messages from
|
||||
* authenticated connections.
|
||||
*
|
||||
* <p> Utilising this interface prevents us from having to do a bunch of
|
||||
* inefficient and ugly comparisons; instead we can simply call through an
|
||||
* interface method to the proper code.
|
||||
*/
|
||||
public interface NetEventHandler
|
||||
{
|
||||
/**
|
||||
* Called when a network event has occurred on the supplied source.
|
||||
* The <code>events</code> parameter indicates which event or events
|
||||
* have occurred.
|
||||
* Called when a network event has occurred on this handler's source.
|
||||
*
|
||||
* @return the number of bytes read from the network as a result of
|
||||
* handling this event.
|
||||
*/
|
||||
public int handleEvent (long when, Selectable source, short events);
|
||||
public int handleEvent (long when);
|
||||
|
||||
/**
|
||||
* Called to ensure that this selectable has not been idle for longer
|
||||
* Called to ensure that this channel has not been idle for longer
|
||||
* than is possible in happily operating circumstances.
|
||||
*
|
||||
* @return true if the handler is idle (in which case it will be
|
||||
* closed shortly), false if it is not.
|
||||
*/
|
||||
public void checkIdle (long now);
|
||||
public boolean checkIdle (long now);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user