[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Replaced tabs with spaces



commit c4093a2b4ab730ddc53163009c0f409dcee41dab
Author: ellitron <jdellit@xxxxxxxxxxxx>
Date:   Tue May 24 19:51:41 2011 -0700

    Replaced tabs with spaces
---
 com/rtmfpcat/rtmfp/RTMFPSocket.as |  231 +++++++++++++++++++------------------
 1 files changed, 116 insertions(+), 115 deletions(-)

diff --git a/com/rtmfpcat/rtmfp/RTMFPSocket.as b/com/rtmfpcat/rtmfp/RTMFPSocket.as
index bb00994..2d634f0 100644
--- a/com/rtmfpcat/rtmfp/RTMFPSocket.as
+++ b/com/rtmfpcat/rtmfp/RTMFPSocket.as
@@ -27,205 +27,206 @@ package rtmfp
     import rtmfp.events.RTMFPSocketEvent;
 
     [Event(name="connectSuccess", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="connectFail", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="publishStart", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="peerConnected", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="peeringSuccess", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="peeringFail", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
-  	[Event(name="peerDisconnected", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="connectFail", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="publishStart", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="peerConnected", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="peeringSuccess", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="peeringFail", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
+    [Event(name="peerDisconnected", type="com.jscat.rtmfp.events.RTMFPSocketEvent")]
     public class RTMFPSocket extends EventDispatcher
     {
         /* The name of the "media" to pass between peers */
         private static const DATA:String = "data";
-		    private static const DEFAULT_CIRRUS_ADDRESS:String = "rtmfp://p2p.rtmfp.net";
-		    private static const DEFAULT_CIRRUS_KEY:String = RTMFP::CIRRUS_KEY;
-		    private static const DEFAULT_CONNECT_TIMEOUT:uint = 4000;
-		
+        private static const DEFAULT_CIRRUS_ADDRESS:String = "rtmfp://p2p.rtmfp.net";
+        private static const DEFAULT_CIRRUS_KEY:String = RTMFP::CIRRUS_KEY;
+        private static const DEFAULT_CONNECT_TIMEOUT:uint = 4000;
+    
         /* Connection to the Cirrus rendezvous service */
         private var connection:NetConnection;
-		
-		    /* ID of the peer to connect to */
-		    private var peerID:String;
-		
-		    /* Data streams to be established with peer */
-		    private var sendStream:NetStream;
-		    private var recvStream:NetStream;
-		    
-		    /* Timeouts */
-		    private var connectionTimeout:int;
-		    private var peerConnectTimeout:uint;
+    
+        /* ID of the peer to connect to */
+        private var peerID:String;
+    
+        /* Data streams to be established with peer */
+        private var sendStream:NetStream;
+        private var recvStream:NetStream;
+        
+        /* Timeouts */
+        private var connectionTimeout:int;
+        private var peerConnectTimeout:uint;
 
         public function RTMFPSocket(){}
         
         public function connect(addr:String = DEFAULT_CIRRUS_ADDRESS, key:String = DEFAULT_CIRRUS_KEY):void
         {
-          connection = new NetConnection();
-			    connection.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEvent);
-			    connection.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorEvent);
-			    connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorEvent);
-          connection.connect(addr + "/" + key);
-			    connectionTimeout = setInterval(fail, DEFAULT_CONNECT_TIMEOUT);
+            connection = new NetConnection();
+            connection.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEvent);
+            connection.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorEvent);
+            connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorEvent);
+            connection.connect(addr + "/" + key);
+            connectionTimeout = setInterval(fail, DEFAULT_CONNECT_TIMEOUT);
         }
 
         public function close():void
         {
-          connection.close();
+            connection.close();
         }
 
         public function get id():String
         {
-          if (connection != null && connection.connected) {
-            return connection.nearID;
-          }
+            if (connection != null && connection.connected) {
+                return connection.nearID;
+            }
           
-          return null;
+            return null;
         }
         
         public function get connected():Boolean
         {
-          return (connection != null && connection.connected);
+            return (connection != null && connection.connected);
         }
         
         public function readBytes(bytes:ByteArray):void
         {
-          recvStream.client.bytes.readBytes(bytes);
+            recvStream.client.bytes.readBytes(bytes);
         }
 
         public function writeBytes(bytes:ByteArray):void
         {
-          sendStream.send("dataAvailable", bytes);
+            sendStream.send("dataAvailable", bytes);
         }
         
         public function get peer():String
         {
-          return this.peerID;
+            return this.peerID;
         }
 
         public function set peer(peerID:String):void
         {
-          if (peerID == null || peerID.length == 0) {
-            throw new Error("Peer ID is null/empty.")
-    			} else if (peerID == connection.nearID) {
-    				throw new Error("Peer ID cannot be the same as our ID.");
-    			} else if (this.peerID == peerID) {
-    			  throw new Error("Already connected to peer " + peerID + ".");
-    			} else if (this.recvStream != null) {
-            throw new Error("Cannot connect to a second peer.");
-          }
+            if (peerID == null || peerID.length == 0) {
+                throw new Error("Peer ID is null/empty.")
+            } else if (peerID == connection.nearID) {
+                throw new Error("Peer ID cannot be the same as our ID.");
+            } else if (this.peerID == peerID) {
+                throw new Error("Already connected to peer " + peerID + ".");
+            } else if (this.recvStream != null) {
+                throw new Error("Cannot connect to a second peer.");
+            }
           
-          this.peerID = peerID;
+            this.peerID = peerID;
 
-    			recvStream = new NetStream(connection, peerID);
-    			var client:RTMFPSocketClient = new RTMFPSocketClient();
-    			client.addEventListener(ProgressEvent.SOCKET_DATA, onDataAvailable, false, 0, true);
-    			client.addEventListener(RTMFPSocketClient.PEER_CONNECT_ACKNOWLEDGED, onPeerConnectAcknowledged, false, 0, true);
-    			recvStream.client = client;
-    			recvStream.addEventListener(NetStatusEvent.NET_STATUS, onRecvStreamEvent);
-    			recvStream.play(DATA);
-    			setTimeout(onPeerConnectTimeout, peerConnectTimeout, recvStream);
+            recvStream = new NetStream(connection, peerID);
+            var client:RTMFPSocketClient = new RTMFPSocketClient();
+            client.addEventListener(ProgressEvent.SOCKET_DATA, onDataAvailable, false, 0, true);
+            client.addEventListener(RTMFPSocketClient.PEER_CONNECT_ACKNOWLEDGED, onPeerConnectAcknowledged, false, 0, true);
+            recvStream.client = client;
+            recvStream.addEventListener(NetStatusEvent.NET_STATUS, onRecvStreamEvent);
+            recvStream.play(DATA);
+            setTimeout(onPeerConnectTimeout, peerConnectTimeout, recvStream);
         }
         
         private function startPublishStream():void
         {
-          sendStream = new NetStream(connection, NetStream.DIRECT_CONNECTIONS);
-    			sendStream.addEventListener(NetStatusEvent.NET_STATUS, onSendStreamEvent);
-    			var o:Object = new Object();
-    			o.onPeerConnect = onPeerConnect;
-    			sendStream.client = o;
-    			sendStream.publish(DATA);
+            sendStream = new NetStream(connection, NetStream.DIRECT_CONNECTIONS);
+            sendStream.addEventListener(NetStatusEvent.NET_STATUS, onSendStreamEvent);
+            var o:Object = new Object();
+            o.onPeerConnect = onPeerConnect;
+            sendStream.client = o;
+            sendStream.publish(DATA);
         }
         
         private function fail():void
         {
-          clearInterval(connectionTimeout);
-    			dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.CONNECT_FAIL));
+            clearInterval(connectionTimeout);
+            dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.CONNECT_FAIL));
         }
         
         private function onDataAvailable(event:ProgressEvent):void
         {
-          dispatchEvent(event);
+            dispatchEvent(event);
         }
         
         private function onIOErrorEvent(event:IOErrorEvent):void
         {
-          fail();
+            fail();
         }
         
         private function onNetStatusEvent(event:NetStatusEvent):void
         {
-          switch (event.info.code) {
-      			case "NetConnection.Connect.Success" :
-      				clearInterval(connectionTimeout);
-      				startPublishStream();
-      				dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.CONNECT_SUCCESS));
-      				break;
-      			case "NetStream.Connect.Success" :
-      				break;
-      			case "NetStream.Publish.BadName" :
-      			  fail();
-      				break;
-      			case "NetStream.Connect.Closed" :
-      			  // we've disconnected from the peer
-      			  // can reset to accept another
-      			  // clear the publish stream and re-publish another
-      			  dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEER_DISCONNECTED, recvStream));
-      				break;
-      		} 
+            switch (event.info.code) {
+                case "NetConnection.Connect.Success" :
+                    clearInterval(connectionTimeout);
+                    startPublishStream();
+                    dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.CONNECT_SUCCESS));
+                    break;
+                case "NetStream.Connect.Success" :
+                    break;
+                case "NetStream.Publish.BadName" :
+                    fail();
+                    break;
+                case "NetStream.Connect.Closed" :
+                    // we've disconnected from the peer
+                    // can reset to accept another
+                    // clear the publish stream and re-publish another
+                    dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEER_DISCONNECTED, recvStream));
+                    break;
+            } 
         }
         
         private function onPeerConnect(peer:NetStream):Boolean
         {
-          // establish a bidirectional stream with the peer
-          if (peerID == null) {
-            this.peer = peer.farID;
-          }
+            // establish a bidirectional stream with the peer
+            if (peerID == null) {
+                this.peer = peer.farID;
+            }
           
-          // disallow additional peers connecting to us
-          if (peer.farID != peerID) return false;
+            // disallow additional peers connecting to us
+            if (peer.farID != peerID) return false;
           
-          peer.send("setPeerConnectAcknowledged");
-          dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEER_CONNECTED, peer));
+            peer.send("setPeerConnectAcknowledged");
+            dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEER_CONNECTED, peer));
           
-          return true;
+            return true;
         }
         
         private function onPeerConnectAcknowledged(event:Event):void
         {
-    			dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEERING_SUCCESS, recvStream));
+            dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEERING_SUCCESS, recvStream));
         }
         
         private function onPeerConnectTimeout(peer:NetStream):void
         {
-          if (!recvStream.client) return;
-    			if (!RTMFPSocketClient(recvStream.client).peerConnectAcknowledged) {
-    				dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEERING_FAIL, recvStream));
-    			}
+            if (!recvStream.client) return;
+            if (!RTMFPSocketClient(recvStream.client).peerConnectAcknowledged) {
+                dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PEERING_FAIL, recvStream));
+            }
         }
         
         private function onSecurityErrorEvent(event:SecurityErrorEvent):void
         {
-          fail();
+            fail();
         }
         
         private function onSendStreamEvent(event:NetStatusEvent):void
         {
-    			switch (event.info.code) {
-    				case ("NetStream.Publish.Start") :
-    				  dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PUBLISH_START));
-    				  break;
-    				case ("NetStream.Play.Reset") :
-    				case ("NetStream.Play.Start") :
-    					break;
-    			}
-    		}
-    		private function onRecvStreamEvent(event:NetStatusEvent):void
-    		{
-    			switch (event.info.code) {
-    				case ("NetStream.Publish.Start") :
-    				case ("NetStream.Play.Reset") :
-    				case ("NetStream.Play.Start") :
-    					break;
-    			}
-    		}
+            switch (event.info.code) {
+                case ("NetStream.Publish.Start") :
+                    dispatchEvent(new RTMFPSocketEvent(RTMFPSocketEvent.PUBLISH_START));
+                    break;
+                case ("NetStream.Play.Reset") :
+                case ("NetStream.Play.Start") :
+                    break;
+            }
+        }
+
+        private function onRecvStreamEvent(event:NetStatusEvent):void
+        {
+            switch (event.info.code) {
+                case ("NetStream.Publish.Start") :
+                case ("NetStream.Play.Reset") :
+                case ("NetStream.Play.Start") :
+                    break;
+            }
+        }
     }
 }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits