Changeset 1153
- Timestamp:
- 12/04/07 00:55:53 (1 year ago)
- Files:
-
- trunk/source/org/kolaka/freecast/transport/cas/ConnectionAssistantServiceSkeleton.java (modified) (4 diffs)
- trunk/source/org/kolaka/freecast/transport/cas/ConnectionAssistantServiceStub.java (modified) (4 diffs)
- trunk/source/org/kolaka/freecast/transport/cas/ProtocolCodec.java (modified) (4 diffs)
- trunk/source/org/kolaka/freecast/transport/cas/ProtocolMessage.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/source/org/kolaka/freecast/transport/cas/ConnectionAssistantServiceSkeleton.java
r405 r1153 2 2 * FreeCast - streaming over Internet 3 3 * 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 5 5 * and contributors (their names can be found in the CONTRIBUTORS file). 6 6 * … … 30 30 import org.apache.mina.common.IoHandlerAdapter; 31 31 import org.apache.mina.common.IoSession; 32 import org.apache.mina.common.IdleStatus; 32 33 import org.kolaka.freecast.transport.cas.ConnectionAssistantService.ConnectionHandler; 33 34 import org.kolaka.freecast.transport.cas.ConnectionAssistantService.Session; … … 46 47 session.getFilterChain().addLast("codec", 47 48 ConnectionProtocolCodecFactory.FILTER); 49 session.setIdleTime(IdleStatus.BOTH_IDLE, 120); 48 50 } 49 51 … … 56 58 57 59 public void sessionClosed(IoSession session) throws Exception { 60 LogFactory.getLog(getClass()).info("sessionClosed"); 61 58 62 Session serviceSession = (Session) session.getAttachment(); 59 63 serviceSession.close(); 60 64 } 65 66 public void sessionIdle(IoSession session, IdleStatus status) throws Exception { 67 LogFactory.getLog(getClass()).info("sessionIdle"); 68 session.close(); 69 } 61 70 62 71 public void messageReceived(IoSession session, Object object) trunk/source/org/kolaka/freecast/transport/cas/ConnectionAssistantServiceStub.java
r636 r1153 2 2 * FreeCast - streaming over Internet 3 3 * 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 5 5 * and contributors (their names can be found in the CONTRIBUTORS file). 6 6 * … … 36 36 import org.apache.mina.common.IoHandlerAdapter; 37 37 import org.apache.mina.common.IoSession; 38 import org.apache.mina.common.IdleStatus; 38 39 import org.kolaka.freecast.transport.cas.ProtocolMessage.ConnectionRequest; 39 40 … … 90 91 session.getFilterChain().addLast("codec", 91 92 ConnectionProtocolCodecFactory.FILTER); 92 93 session.setIdleTime(IdleStatus.BOTH_IDLE, 60); 93 94 } 94 95 … … 98 99 processConnectionRequest(request.getPendingConnection()); 99 100 } 101 102 public void sessionIdle(IoSession session, IdleStatus status) throws Exception { 103 protocolSession.write(new ProtocolMessage.Ping()); 104 } 100 105 101 106 public void exceptionCaught(IoSession session, Throwable t) trunk/source/org/kolaka/freecast/transport/cas/ProtocolCodec.java
r405 r1153 2 2 * FreeCast - streaming over Internet 3 3 * 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 5 5 * and contributors (their names can be found in the CONTRIBUTORS file). 6 6 * … … 39 39 import org.kolaka.freecast.transport.cas.ProtocolMessage.Registration; 40 40 import org.kolaka.freecast.transport.cas.ProtocolMessage.Type; 41 import org.kolaka.freecast.transport.cas.ProtocolMessage.Ping; 41 42 42 43 public class ProtocolCodec implements ProtocolEncoder, ProtocolDecoder { … … 63 64 PendingConnection connection = decodeConnection(buffer); 64 65 message = new ProtocolMessage.ConnectionRequest(connection); 66 } else if (type.equals(ProtocolMessage.Ping.TYPE)) { 67 message = new ProtocolMessage.Ping(); 65 68 } else { 66 69 throw new ProtocolDecoderException("Unsupported message type: " … … 86 89 ProtocolMessage.ConnectionMessage connectionMessage = (ConnectionMessage) message; 87 90 encodeConnection(buffer, connectionMessage.getPendingConnection()); 91 } else if (message instanceof Ping) { 92 88 93 } else { 89 94 throw new ProtocolEncoderException("Unsupported message type: " trunk/source/org/kolaka/freecast/transport/cas/ProtocolMessage.java
r405 r1153 2 2 * FreeCast - streaming over Internet 3 3 * 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 4 * This code was developped by Alban Peignier (http://people.tryphon.org/~alban/) 5 5 * and contributors (their names can be found in the CONTRIBUTORS file). 6 6 * … … 44 44 45 45 public static final Type CONNECTION_REQUEST = new Type("request", 2); 46 47 public static final Type PING = new Type("ping", 3); 46 48 47 49 Type(String name, int value) { … … 119 121 } 120 122 123 public static class Ping extends ProtocolMessage { 124 125 public static final Type TYPE = Type.PING; 126 127 public Ping() { 128 super(); 129 } 130 131 public Type getType() { 132 return TYPE; 133 } 134 135 } 136 121 137 public abstract Type getType(); 122 138
