简体   繁体   English

QSSLSocket 刷新崩溃

[英]QSSLSocket flush crashes

qint64 sent = socket->write (data, size);
socket->flush ();

This works fine with a QTcpSocket , but eventually crashes within a memcpy inside a QSSLSocket private event (flush).这适用于QTcpSocket ,但最终会在QSSLSocket私有事件(刷新)内的 memcpy 中崩溃。 I know I should add more context, but that's a lot.我知道我应该添加更多上下文,但这很多。 Omitting socket->flush () here makes everything work perfectly incl.在这里省略socket->flush ()使一切工作完美,包括。 all SSL handshake etc, so I wonder if anybody has come across this?所有 SSL 握手等,所以我想知道是否有人遇到过这个? It takes a while and a few kilobytes or so of data sent before it happens.在它发生之前需要一段时间和几千字节左右的数据发送。 Maybe it's bad practice to flush after write anyway, so...just curious :-)无论如何写后刷新可能是不好的做法,所以......只是好奇:-)

I have faced same issue and same as you was using flush after every write and sometimes " Tag mismatch " got in the way.我遇到了同样的问题,就像你在每次写入后使用刷新一样,有时“ Tag mismatch ”会妨碍你。 Solved problem:解决的问题:

Remove flush usage after every write. And problem will be gone.问题就会消失。 QSSLSockets lib automatically flushes write buffer behind scenes, and it is more optimal than doing manual flush after each buffer data write :) QSSLSockets lib 在后台自动刷新写入缓冲区,并且比在每次写入缓冲区数据后手动刷新更优化:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM