Skip to content

Commit

Permalink
third attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
MammatusPlatypus committed Jun 27, 2016
1 parent 9b24521 commit 79c111a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void close() {

if (event.isFinal()) {
//If the count is 1 then all of the data is in bufferRef, else all of the data but the last bit is in bufferRef.
final Buffer finalBuffer = count[0] > 1 ? bufferRef[0].slice().appendBuffer(event.binaryData()) :
final Buffer finalBuffer = count[0] > 1 ? createNewBuffer(bufferRef[0], event.binaryData()) :
bufferRef[0];
if (event.isBinary()) {
((NetSocketBase) webSocket).setBinary();
Expand All @@ -207,6 +207,13 @@ public void close() {
return webSocket;
}

private Buffer createNewBuffer(Buffer buffer1, Buffer buffer2) {
Buffer buffer = Buffer.buffer();
buffer.appendBuffer(buffer1);
buffer.appendBuffer(buffer2);
return buffer;
}

private MultiMap<String, String> paramMap(ServerWebSocket vertxServerWebSocket) {
String query = vertxServerWebSocket.query();
MultiMap<String, String> paramMap = MultiMap.empty();
Expand Down

0 comments on commit 79c111a

Please sign in to comment.