[Beepcore-java-commits] CVS: beepcore-java/src/org/beepcore/beep/transport/tcp TCPSession.java,1.26,
Status: Beta
Brought to you by:
huston
From: Huston F. <hu...@us...> - 2003-03-08 16:39:21
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp In directory sc8-pr-cvs1:/tmp/cvs-serv7897/transport/tcp Modified Files: TCPSession.java TCPSessionCreator.java Log Message: David Blacka's servername patch applied Index: TCPSession.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** TCPSession.java 5 Oct 2002 15:32:45 -0000 1.26 --- TCPSession.java 8 Mar 2003 16:39:18 -0000 1.27 *************** *** 115,122 **** private TCPSession(Socket sock, ProfileRegistry registry, int firstChannel, SessionCredential localCred, SessionCredential peerCred, ! SessionTuningProperties tuning) throws BEEPException { ! super(registry, firstChannel, localCred, peerCred, tuning); socket = sock; --- 115,122 ---- private TCPSession(Socket sock, ProfileRegistry registry, int firstChannel, SessionCredential localCred, SessionCredential peerCred, ! SessionTuningProperties tuning, String servername) throws BEEPException { ! super(registry, firstChannel, localCred, peerCred, tuning, servername); socket = sock; *************** *** 143,146 **** --- 143,147 ---- * @param sock * @param registry + * @param servername * * @throws BEEPException *************** *** 148,156 **** */ public static TCPSession createInitiator(Socket sock, ! ProfileRegistry registry) throws BEEPException { return new TCPSession(sock, (ProfileRegistry) registry.clone(), ! CHANNEL_START_ODD, null, null, null); } --- 149,175 ---- */ public static TCPSession createInitiator(Socket sock, ! ProfileRegistry registry, ! String servername) throws BEEPException { return new TCPSession(sock, (ProfileRegistry) registry.clone(), ! CHANNEL_START_ODD, null, null, null, servername); ! } ! /** ! * Creates a TCPSession for a Socket that was created by ! * initiating a connection. ! * ! * ! * @param sock ! * @param registry ! * ! * @throws BEEPException ! * ! */ ! public static TCPSession createInitiator(Socket sock, ! ProfileRegistry registry) ! throws BEEPException ! { ! return createInitiator(sock, registry, null); } *************** *** 171,175 **** { return new TCPSession(sock, (ProfileRegistry) registry.clone(), ! CHANNEL_START_EVEN, null, null, null); } --- 190,194 ---- { return new TCPSession(sock, (ProfileRegistry) registry.clone(), ! CHANNEL_START_EVEN, null, null, null, null); } *************** *** 333,340 **** if (isInitiator()) { return new TCPSession(s, reg, CHANNEL_START_ODD, ! localCred, peerCred, tuning); } else { return new TCPSession(s, reg, CHANNEL_START_EVEN, ! localCred, peerCred, tuning); } } --- 352,359 ---- if (isInitiator()) { return new TCPSession(s, reg, CHANNEL_START_ODD, ! localCred, peerCred, tuning, null); } else { return new TCPSession(s, reg, CHANNEL_START_EVEN, ! localCred, peerCred, tuning, null); } } Index: TCPSessionCreator.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSessionCreator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** TCPSessionCreator.java 8 Nov 2001 05:26:29 -0000 1.5 --- TCPSessionCreator.java 8 Mar 2003 16:39:18 -0000 1.6 *************** *** 87,90 **** --- 87,91 ---- * @param port * @param registry + * @param servername * * @throws BEEPException *************** *** 92,101 **** */ public static TCPSession initiate(InetAddress host, int port, ! ProfileRegistry registry) throws BEEPException { try { return TCPSession.createInitiator(new Socket(host, port), ! registry); } catch (IOException x) { throw new BEEPException(x.getMessage()); --- 93,103 ---- */ public static TCPSession initiate(InetAddress host, int port, ! ProfileRegistry registry, ! String servername) throws BEEPException { try { return TCPSession.createInitiator(new Socket(host, port), ! registry, servername); } catch (IOException x) { throw new BEEPException(x.getMessage()); *************** *** 109,112 **** --- 111,132 ---- * @param host * @param port + * @param registry + * + * @throws BEEPException + * + */ + public static TCPSession initiate(InetAddress host, int port, + ProfileRegistry registry) + throws BEEPException + { + return initiate(host, port, registry, null); + } + + /** + * Method initiate + * + * + * @param host + * @param port * @param profiles * @param ccls *************** *** 143,146 **** --- 163,179 ---- try { return initiate(InetAddress.getByName(host), port, registry); + } catch (UnknownHostException x) { + throw new BEEPException("Unable to connect, unkown host"); + } + } + + public static TCPSession initiate(String host, int port, + ProfileRegistry registry, + String servername) + throws BEEPException + { + try { + return initiate(InetAddress.getByName(host), port, registry, + servername); } catch (UnknownHostException x) { throw new BEEPException("Unable to connect, unkown host"); |