fixes #167
This commit is contained in:
parent
62193b2596
commit
27c378e5b6
@ -1,7 +1,7 @@
|
|||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
use self::side::Side;
|
use self::side::Side;
|
||||||
use bytes::{BufMut, Bytes};
|
use bytes::{BufMut, Bytes, BytesMut};
|
||||||
use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
use futures_util::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||||
use quinn::{
|
use quinn::{
|
||||||
Connection as QuinnConnection, ConnectionError, RecvStream, SendDatagramError, SendStream,
|
Connection as QuinnConnection, ConnectionError, RecvStream, SendDatagramError, SendStream,
|
||||||
@ -67,7 +67,7 @@ impl<Side> Connection<Side> {
|
|||||||
let model = self.model.send_packet(assoc_id, addr, max_pkt_size);
|
let model = self.model.send_packet(assoc_id, addr, max_pkt_size);
|
||||||
|
|
||||||
for (header, frag) in model.into_fragments(pkt) {
|
for (header, frag) in model.into_fragments(pkt) {
|
||||||
let mut buf = vec![0; header.len() + frag.len()];
|
let mut buf = BytesMut::with_capacity(header.len() + frag.len());
|
||||||
header.write(&mut buf);
|
header.write(&mut buf);
|
||||||
buf.put_slice(frag);
|
buf.put_slice(frag);
|
||||||
self.conn.send_datagram(Bytes::from(buf))?;
|
self.conn.send_datagram(Bytes::from(buf))?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user