Coder Social home page Coder Social logo

Comments (8)

nmathewson avatar nmathewson commented on September 24, 2024

I don't think that's possible with the way that most underlying socket APIs work: the functions that would notify you of errors are the same ones that try to do reading and writing.

If you know of some portable way to detect errors without doing reads/writes, then we can try to figure something out.

from libevent.

davidsteinsland avatar davidsteinsland commented on September 24, 2024

So basically I have no choice other than reading directly from the buffers? How will that work if the socket in question is SSL?

from libevent.

JohnOhl avatar JohnOhl commented on September 24, 2024

Libevent can handle all the heavy lifting /w managing SSL based sockets; see http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html for a few OpenSSL examples. After setting up the bufferevent you'd simply write to the output buffer just as you would for a normal bufferevent socket.

from libevent.

errzey avatar errzey commented on September 24, 2024

have my own layer around sockets

Is it a layer around libevent?

from libevent.

errzey avatar errzey commented on September 24, 2024

Oh crap, I forgot I already researched this topic a long time ago.

Potential new flags for turning off read but still get errors.

epoll:

 EPOLLRDHUP works without EPOLLIN

kqueue:

EV_SET(&event, infd, EVFILT_READ, EV_ADD|EV_EOF, NOTE_LOWAT, INTMAX_MAX, NULL);

That looks like a hack, but it waits for INTMAX_MAX bytes before triggering the event, but still triggers EV_EOF

Would be interesting to look into a (kqueue and epoll) specific flag like "EV_READ_ERROR".

bufferevent_disable(EV_READ);
bufferevent_enable(EV_READ_ERROR);

from libevent.

azat avatar azat commented on September 24, 2024

from libevent.

errzey avatar errzey commented on September 24, 2024

Some backends will not support this

Like when I said

a (kqueue and epoll) specific flag

Also whats this I hear all about `the various flags specific to an event backend?

There will be all why-this-does-not-work questions,

We always get those; Even for things that do work - just document it and refer them to the libevent-book link.

but does it worth it?

No workarounds for backends that do not support it. Period.

The ability to have read disabled and still get socket errors would help every proxy developer in the world (53242423423.32432E) to be exact.

Joking aside, yes, this is definitely worth it (I've wanted this for a long time, never knew how to do it, then I realized I did, while browsing my documents folder).

from libevent.

errzey avatar errzey commented on September 24, 2024

Replacing and closing this ticket with #345

from libevent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.