Skip to content

Commit 0c804c4

Browse files
committed
* Fix stack overflow error
1 parent 7c3b223 commit 0c804c4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/org/java_websocket/SSLSocketChannel2.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ protected void consumeDelegatedTasks() {
179179
}
180180

181181
protected void createBuffers( SSLSession session ) {
182-
int appBufferMax = session.getApplicationBufferSize();
183182
int netBufferMax = session.getPacketBufferSize();
183+
int appBufferMax = Math.max(session.getApplicationBufferSize(), netBufferMax);
184184

185185
if( inData == null ) {
186186
inData = ByteBuffer.allocate( appBufferMax );
@@ -209,9 +209,9 @@ public int write( ByteBuffer src ) throws IOException {
209209
return 0;
210210
}
211211
// assert ( bufferallocations > 1 ); //see #190
212-
if( bufferallocations <= 1 ) {
213-
createBuffers( sslEngine.getSession() );
214-
}
212+
//if( bufferallocations <= 1 ) {
213+
// createBuffers( sslEngine.getSession() );
214+
//}
215215
int num = socketChannel.write( wrap( src ) );
216216
return num;
217217

@@ -239,9 +239,9 @@ public int read( ByteBuffer dst ) throws IOException {
239239
}
240240
}
241241
// assert ( bufferallocations > 1 ); //see #190
242-
if( bufferallocations <= 1 ) {
243-
createBuffers( sslEngine.getSession() );
244-
}
242+
//if( bufferallocations <= 1 ) {
243+
// createBuffers( sslEngine.getSession() );
244+
//}
245245
/* 1. When "dst" is smaller than "inData" readRemaining will fill "dst" with data decoded in a previous read call.
246246
* 2. When "inCrypt" contains more data than "inData" has remaining space, unwrap has to be called on more time(readRemaining)
247247
*/

0 commit comments

Comments
 (0)