Skip to content

Commit e35bf1d

Browse files
author
Jake Hilton
committed
Fixed up an issue with closing a netconnection.
There was an issue where a close on a netconnection wouldn't process completely thus leaving the netconnection in an open state.
1 parent e1085bc commit e35bf1d

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

bin/netconnectionsmart.swc

56 Bytes
Binary file not shown.

src/com/gearsandcogs/utils/NetConnectionSmart.as

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
You should have received a copy of the GNU General Public License
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
18-
VERSION: 1.9.0
18+
VERSION: 1.9.2
1919
DATE: 09/26/2014
2020
ACTIONSCRIPT VERSION: 3.0
2121
DESCRIPTION:
@@ -118,6 +118,7 @@ package com.gearsandcogs.utils
118118
import flash.net.Responder;
119119
import flash.utils.ByteArray;
120120
import flash.utils.Timer;
121+
import flash.utils.setTimeout;
121122

122123
public class NetConnectionSmart extends EventDispatcher
123124
{
@@ -147,7 +148,7 @@ package com.gearsandcogs.utils
147148
public static const RTMFP:String = "rtmfp";
148149
public static const RTMP:String = "rtmp";
149150
public static const RTMPT:String = "rtmpt";
150-
public static const VERSION:String = "NetConnectionSmart v 1.9.1";
151+
public static const VERSION:String = "NetConnectionSmart v 1.9.2";
151152

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

549+
//cleanup listeners
548550
pc.removeEventListener(PortConnection.STATUS_UPDATE, checkNetStatus);
549-
pc.close();
550-
551-
//cleanup listener
552-
pc.deactivateHandlers();
551+
//add some delay so we can run this in response to a NetStatus Event
552+
setTimeout(pc.close, 0);
553553
}
554554

555555
private function closeExtraNc():void {

src/com/gearsandcogs/utils/PortConnection.as

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ package com.gearsandcogs.utils
6363
trace("PortConnection: " + msg);
6464
}
6565

66+
override public function close():void {
67+
super.close();
68+
deactivateHandlers();
69+
}
70+
6671
override public function connect(command:String, ...rest):void {
6772
//start a timer here so we can watch this so if it doesn't connect in time we can kill it
6873
if(!_timeoutTimer) {

0 commit comments

Comments
 (0)