Is it running in the normal security context or a signed app?



________________________________
 From: Will Holcomb <[email protected]>
To: P2P Hackers <[email protected]> 
Sent: Saturday, September 22, 2012 1:02 PM
Subject: [p2p-hackers] porting the clj-telehash chat demo to rhino
 

The clojure telehash project includes a chat application as one of the samples. 
I have been attempting to port it to run in the browser as a rhino script 
executing in a java applet.

The application never finds any other switches (counterpartySwitchForEndFound 
is never called). I'm hoping that maybe someone here can tell me what I'm 
missing.

var InterestingEndsHolderImpl = 
Packages.telehash.switchimpl.api.InterestingEndsHolderImpl
var ApplicationPortImpl = Packages.telehash.switchimpl.api.ApplicationPortImpl

var interestingEndsHolder = new InterestingEndsHolderImpl()
var applicationPort = new ApplicationPortImpl()

var SwitchListener = Packages.telehash.api.SwitchListener
var TelexListener = Packages.telehash.api.TelexListener

applicationPort.addSwitchListener( new SwitchListener( {
    counterpartySwitchForEndFound : function( hash, counterpartySwitch ) {
    print( "counterpartySwitchForEndFound: " + hash )
        if( ! applicationPort.hash( self ).equals( hash ) ) {
            interestingEndsHolder.put( hash, counterpartySwitch )

            if( counterpartySwitch.isConnected() ) {
                print( "Switch Connected: " + counterpartySwitch.getIP() + ":" 
+ counterpartySwitch.getPort() )
            }

            var telexListenerScope = counterpartySwitch.addTelexListener( new 
TelexListener( {
                receivedTelex : function( telex ) {
                    print( 'Recieved telex:' )
                    if( telex.containsKey( 'simplechat' ) ) {
                        var chat_telex = telex.get( 'simplechat' )
                        print( contactName + ": " + chat_telex.get( 'msg' 
).toString() )
                    }
                }
            } ) )
        }
    }
} ) )

applicationPort.startSwitch()

print( "Adding Own End: " + applicationPort.hash( username ) )
applicationPort.addOwnEnd( applicationPort.hash( username ) )

print( "Adding Other End: " + applicationPort.hash( contactName ) )
applicationPort.addOtherEnd( applicationPort.hash( contactName ) )


You can run this code by checking out the git repo and running: java -classpath 
/usr/share/java/js.jar:/usr/share/java/jline.jar:lib/telehash/jar 
org.mozilla.javascript.tools.shell.Main test/clj-telehash/rhino

Currently it outputs:

Adding Own End: 3e3e5802bd4cad8e29e144b515307d8204a3202a
Adding Other End: da6645f6e22bf5f75974dc7eed5fcd6160d6b51e
"Starting other threads ..."

I've run wireshark and there is definitely traffic. Any help would be much 
appreciated.


-Will
_______________________________________________
p2p-hackers mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/p2p-hackers
_______________________________________________
p2p-hackers mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/p2p-hackers

Reply via email to