Skip to content

Commit

Permalink
Fixed up an issue with closing a netconnection.
Browse files Browse the repository at this point in the history
There was an issue where a close on a netconnection wouldn't process completely thus leaving the netconnection in an open state.
  • Loading branch information
Jake Hilton committed Mar 12, 2015
1 parent e1085bc commit e35bf1d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Binary file modified bin/netconnectionsmart.swc
Binary file not shown.
12 changes: 6 additions & 6 deletions src/com/gearsandcogs/utils/NetConnectionSmart.as
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION: 1.9.0
VERSION: 1.9.2
DATE: 09/26/2014
ACTIONSCRIPT VERSION: 3.0
DESCRIPTION:
Expand Down Expand Up @@ -118,6 +118,7 @@ package com.gearsandcogs.utils
import flash.net.Responder;
import flash.utils.ByteArray;
import flash.utils.Timer;
import flash.utils.setTimeout;

public class NetConnectionSmart extends EventDispatcher
{
Expand Down Expand Up @@ -147,7 +148,7 @@ package com.gearsandcogs.utils
public static const RTMFP:String = "rtmfp";
public static const RTMP:String = "rtmp";
public static const RTMPT:String = "rtmpt";
public static const VERSION:String = "NetConnectionSmart v 1.9.1";
public static const VERSION:String = "NetConnectionSmart v 1.9.2";

/**
* Boolean to determine if a unique alphanumeric string should be passed at the end of the param set to the media server
Expand Down Expand Up @@ -545,11 +546,10 @@ package com.gearsandcogs.utils
if(debug)
log("Closing down NetConnection: " + pc.label);

//cleanup listeners
pc.removeEventListener(PortConnection.STATUS_UPDATE, checkNetStatus);
pc.close();

//cleanup listener
pc.deactivateHandlers();
//add some delay so we can run this in response to a NetStatus Event
setTimeout(pc.close, 0);
}

private function closeExtraNc():void {
Expand Down
5 changes: 5 additions & 0 deletions src/com/gearsandcogs/utils/PortConnection.as
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ package com.gearsandcogs.utils
trace("PortConnection: " + msg);
}

override public function close():void {
super.close();
deactivateHandlers();
}

override public function connect(command:String, ...rest):void {
//start a timer here so we can watch this so if it doesn't connect in time we can kill it
if(!_timeoutTimer) {
Expand Down

0 comments on commit e35bf1d

Please sign in to comment.