fixed packet write batch

This commit is contained in:
agapple
2019-03-28 21:52:51 +08:00
parent f63ce4ffe6
commit d715ff64b4

View File

@@ -1,5 +1,6 @@
package com.alibaba.otter.canal.parse.driver.mysql.utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import com.alibaba.otter.canal.parse.driver.mysql.packets.HeaderPacket;
@@ -28,7 +29,11 @@ public abstract class PacketManager {
}
public static void writePkg(SocketChannel ch, byte[]... srcs) throws IOException {
ch.write(srcs);
ByteArrayOutputStream out = new ByteArrayOutputStream();
for (byte[] src : srcs) {
out.write(src);
}
ch.write(out.toByteArray());
}
public static void writeBody(SocketChannel ch, byte[] body) throws IOException {