Closed monken closed 2 years ago
Thank you, Moritz!
I ran into an issue when sending messages larger than 4096 bytes, though. The file long.txt is just 4400 bytes of random text:
cat long.txt | openssl s_client -dtls1_2 -quiet -connect 127.0.0.1:52000
A question about your use case: Are you planning to send messages this large over IP networks? This will result into IP fragmentation and packages will get lost, once your system has to pass a NAT middlebox.
On the NodeJS side, I receive only a single message with the first 4096 bytes. I'm no C expert but it seems like you are only reading the first 4096 bytes off the stream at https://github.com/jue89/node-openssl-dtls/blob/8c5a070997d93367a22dbe159d0c716610da5b2d/src/session.cc#L189. Might this be the cause of the issue?
Yes, right! This buffer was an assumption the single datagrams never will get that large 😃
But reading over this code, it's worth to be improved. It copies the datagram twice (once in the read call and once in the memcpy call).
I'm going to improve the situation when I find some time. I'll expect that to happen during the next weeks.
Thank you for reporting this limitation!
Yes, I think you are correct about the fragmentation issue. I was expecting DTLS to take care of that but it seems like it doesn't :)
Thanks for your help!
DTLS is fragmenting only during the handshake. (The mtu
option adjusts the max. package size ...)
After the connection has been established its up to the application or network layer to ensure that packages fit into the path's MTU.
I pushed an update to branch develop
. I think the problem with the hard coded buffer size should have been gone.
@monken Were you able to test the develop
branch?
@jue89 yes I did. Sorry for the late response. It's working for me now. I'm also staying below the pMTU now so thanks for pointing me in that direction.
Hey, thanks for this amazing library. First dtls server implementation that just works.
I ran into an issue when sending messages larger than 4096 bytes, though. The file long.txt is just 4400 bytes of random text:
On the NodeJS side, I receive only a single message with the first 4096 bytes. I'm no C expert but it seems like you are only reading the first 4096 bytes off the stream at https://github.com/jue89/node-openssl-dtls/blob/8c5a070997d93367a22dbe159d0c716610da5b2d/src/session.cc#L189. Might this be the cause of the issue?
Viele Grüße!