mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Transmits now block when the buffer fills
This commit is contained in:
@@ -177,7 +177,7 @@ bool PCAP::IsHandleValid(neodevice_handle_t handle) {
|
||||
return (netifIndex < knownInterfaces.size());
|
||||
}
|
||||
|
||||
PCAP::PCAP(device_errorhandler_t err, neodevice_t& forDevice) : device(forDevice), err(err) {
|
||||
PCAP::PCAP(const device_errorhandler_t& err, neodevice_t& forDevice) : ICommunication(err), device(forDevice) {
|
||||
if(IsHandleValid(device.handle)) {
|
||||
interface = knownInterfaces[(device.handle >> 24) & 0xFF];
|
||||
interface.fp = nullptr; // We're going to open our own connection to the interface. This should already be nullptr but just in case.
|
||||
@@ -287,6 +287,7 @@ void PCAP::writeTask() {
|
||||
auto bs = sendPacket.getBytestream();
|
||||
if(!closing)
|
||||
pcap.sendpacket(interface.fp, bs.data(), (int)bs.size());
|
||||
onWrite();
|
||||
// TODO Handle packet send errors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,6 +389,8 @@ void VCP::writeTask() {
|
||||
bytesWritten = 0;
|
||||
if(WriteFile(handle, writeOp.bytes.data(), (DWORD)writeOp.bytes.size(), nullptr, &overlappedWrite))
|
||||
continue;
|
||||
|
||||
onWrite();
|
||||
|
||||
auto winerr = GetLastError();
|
||||
if(winerr == ERROR_IO_PENDING) {
|
||||
|
||||
Reference in New Issue
Block a user