Skip to content

Commit 026802d

Browse files
committed
Added reset method for extension called by the draft
When the draft should reset, also the used extension should be reset
1 parent c0cc4ef commit 026802d

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

‎src/main/java/org/java_websocket/drafts/Draft_6455.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,15 @@ public List<Framedata> translateFrame( ByteBuffer buffer ) throws InvalidDataExc
322322
}
323323
}
324324

325+
@Override
326+
publicvoidreset(){
327+
super.reset();
328+
if (extension != null){
329+
extension.reset();
330+
}
331+
extension = null;
332+
}
333+
325334
/**
326335
* Generate a date for for the date-header
327336
*

‎src/main/java/org/java_websocket/extensions/DefaultExtension.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ public IExtension copyInstance(){
7979
returnnewDefaultExtension();
8080
}
8181

82+
publicvoidreset(){
83+
//Nothing to do here. No internal stats.
84+
}
85+
8286
@Override
8387
publicStringtoString(){
8488
returngetClass().getSimpleName();

‎src/main/java/org/java_websocket/extensions/IExtension.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public interface IExtension{
9999
*/
100100
IExtensioncopyInstance();
101101

102+
/**
103+
* Cleaning up internal stats when the draft gets reset.
104+
*/
105+
voidreset();
106+
102107
/**
103108
* Return a string which should contain the class name as well as additional information about the current configurations for this extension (DEBUG purposes)
104109
*

0 commit comments

Comments
(0)