[Libevent-users] ANN: Libevent 2.1.3-alpha is released!

2013-05-01 Thread Nick Mathewson
Announcing Libevent 2.1.3-alpha === Libevent 2.1.3-alpha is released! This is the third release in the Libevent 2.1 series. As the "alpha" should tell you, this is not a stable release: you should not run it unless you're willing to debug together. If you want a stabl

Re: [Libevent-users] questions about bufferevent callbacks in multithreaded code

2013-05-01 Thread Nick Mathewson
On Wed, May 1, 2013 at 12:07 PM, Sashan Govender wrote: > Hi > > I need to clarify my understanding of how bufferevent objects work with > mulithreaded code. If a bufferevent triggers a callback (read or write) does > it hold a lock until that callback completes? Ordinarily, yes. You can override

Re: [Libevent-users] Bufferevent filter with greedy sender

2013-04-27 Thread Nick Mathewson
On Sat, Apr 27, 2013 at 1:52 PM, kgardenia42 wrote: > Hi, > > I have a bufferevent_filter to parse some protocol data from the "src" > evbuffer and unwrap it into the "dst" evbuffer. > > This all works fine. The problem I have, however, is that when there > is a greedy sender sending a lot of dat

Re: [Libevent-users] Simple question about multithreading SSL bufferevents.

2013-04-25 Thread Nick Mathewson
On Thu, Apr 25, 2013 at 5:23 PM, John wrote: > Nick, > > I have made my code capable of running multiple sets of single-threaded SSL > bufferevent+event_base (i.e. works with current libevent 2.0) as well as able > to run fully multithreaded (breaks with current libevent 2.0) I will be happy >

Re: [Libevent-users] Simple question about multithreading SSL bufferevents.

2013-04-25 Thread Nick Mathewson
On Tue, Mar 26, 2013 at 6:32 PM, John wrote: > Hello all, > > I am having significant issues with (near immediate) deadlock when trying to > send data out a single openssl bufferevent from two separate threads. FWIW, I can confirm that my current "21_deadlock_fix" branch makes your example code

Re: [Libevent-users] Could not use event_base_foreach_event

2013-04-25 Thread Nick Mathewson
On Thu, Apr 25, 2013 at 1:24 AM, Pritesh Acharya wrote: > I got symbol not found error on event_base_foreach_event. > Has it been dropped? No, but it's only in Libevent 2.1, not in Libevent 2.0. It sounds like maybe you're building with headers from Libevent 2.1, but linking against libevent 2.0

Re: [Libevent-users] libevent & SCTP

2013-04-25 Thread Nick Mathewson
On Thu, Apr 25, 2013 at 5:22 AM, Alexander Drozdov wrote: > Hello! > > Are there any plans or ideas to add extra support of SCTP protocol to > libevent? Hi! I'd like to add a UDP-based bufferevent-like thing at some point; I believe there's a thread about that from a little while back. Adding a

Re: [Libevent-users] Enable/disable write callback for UDP

2013-04-20 Thread Nick Mathewson
On Sat, Apr 20, 2013 at 3:36 PM, Jan Danielsson wrote: > Hello, > >I'm doing this (roughly): > >--- >udp_sock = create_udo4_any_socket(""); >evutil_make_socket_nonblocking(udp_sock); >udp_event = event_new(base, udp_sock, EV_READ|EV_WRITE|EV_PERSIST, > pro

Re: [Libevent-users] evbuffer_find versus evbuffer_search

2013-04-10 Thread Nick Mathewson
On Wed, Apr 10, 2013 at 11:12 PM, Sashan Govender wrote: > Hi > > I'm porting some code from libevent 1.4 to 2.0 and in the 1.4 version some > of the code is using evbuffer_find find a pointer to the start of a sequence > then calculating a pointer difference from it: > > u_char* end = evbuffe

Re: [Libevent-users] RFC: strategy for deadlock avoidance and safe finalization in Libevent 2.1

2013-04-10 Thread Nick Mathewson
On Wed, Apr 10, 2013 at 3:51 AM, Alexander Drozdov wrote: > The idea is good, but why to not just register finalizer callback on > event initialization? A data pointer is passed to event_assign() or > event_new() > so we can pass finalizer along with the data. Hi, Alexander! Thanks for the feedba

Re: [Libevent-users] Event callback from evbuffer_add_printf

2013-04-09 Thread Nick Mathewson
On Wed, Apr 3, 2013 at 4:26 AM, Sebastian Sjöberg wrote: > Hello, > > Is it possible that evbuffer_add_printf triggers an event callback on a > bufferevent before returning? Yes. When deferred callbacks aren't enabled on an event, then it's possible that when you queue data, that data can be fl

[Libevent-users] RFC: strategy for deadlock avoidance and safe finalization in Libevent 2.1

2013-04-09 Thread Nick Mathewson
Libevent 2.1.x may introduce an optional new "finalize" model to avoid some delays and deadlocks in multithreaded applications. Here I'll discuss why the solution is necessary, how it works, and how to use it. The APIs are not yet set in stone; anything could change. Feedback wo

Re: [Libevent-users] Simple question about multithreading SSL bufferevents.

2013-03-28 Thread Nick Mathewson
On Wed, Mar 27, 2013 at 5:06 PM, John wrote: > You can see the test code at > > http://pastebin.com/0136vEbe > Yup, that's a deadlock. Reproducible too. Thanks! The main thread got stuck in #0 0x0030c8c0de4d in __lll_lock_wait () from /lib64/libpthread.so.0 #1 0x0030c8c09cc1 in _L_lo

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-03-28 Thread Nick Mathewson
On Thu, Mar 7, 2013 at 7:59 PM, Patrick Pelletier wrote: > On 03/07/2013 08:51 AM, Nick Mathewson wrote: >> >> Thanks! Is there no way to do this *without* importing a big pile of code >> from curl? That seems kinda extreme. > > > We could go back to Catalin's o

Re: [Libevent-users] Deprecated functions and their replacements

2013-03-27 Thread Nick Mathewson
On Wed, Mar 27, 2013 at 6:45 AM, Grega Kres wrote: > Hello, > > just a few quick questions about some deprecated functions. According > to this list: > http://www.wangafu.net/~nickm/libevent-2.1/doxygen/html/deprecated.html > event_init is deprecated and event_base_new should be used. That's OK.

Re: [Libevent-users] Simple question about multithreading SSL bufferevents.

2013-03-27 Thread Nick Mathewson
On Tue, Mar 26, 2013 at 6:32 PM, John wrote: > Hello all, > > I am having significant issues with (near immediate) deadlock when trying to > send data out a single openssl bufferevent from two separate threads. The > individual threads themselves send complete messages with each write. This > s

Re: [Libevent-users] bufferevent read high watermark and missing error/event callback

2013-03-26 Thread Nick Mathewson
On Tue, Mar 26, 2013 at 10:31 PM, Mina Naguib wrote: > > Hi > > I've run into an issue and I'm wondering if it's expected behavior or not. > > If a bufferevent with a configured read-high-watermark actually reaches the > watermark, the TCP disconnect on the underlying socket is not reported. I'v

Re: [Libevent-users] help about an error message

2013-03-26 Thread Nick Mathewson
On Tue, Mar 26, 2013 at 10:41 AM, sven falempin wrote: > Never saw > i was used to libevent 1 > when i switch to 2 My guess is that you're setting up these events before constructing an event_base or calling event_init. That might have worked with libevent 1, but in libevent 2, you need to make s

Re: [Libevent-users] remove some bytes from the end of the evbuffer

2013-03-15 Thread Nick Mathewson
On Thu, Mar 14, 2013 at 11:44 PM, 谷天仁 wrote: > I now use libevent to develop a network program, which used a evbuffer > buffer function. > The currently evbuff only evbuffer_drain and evbuffer_remove, are > removed from the head of the buffer data. > I need a very important functions: remove some

Re: [Libevent-users] WaitForMultipleObjects backend?

2013-03-13 Thread Nick Mathewson
On Wed, Mar 13, 2013 at 9:01 PM, Patrick Pelletier wrote: > I was perusing whatsnew-2.0.txt and saw: > > Libevent 2.1 may add a multithreaded WaitForMultipleEvents-based > backend for better performance with many inactive sockets and better > integration with Windows events. > > Although tha

Re: [Libevent-users] Creating a repeater/forwarder

2013-03-09 Thread Nick Mathewson
On Sat, Mar 9, 2013 at 5:20 PM, Oliver Smith wrote: > I'm trying to create a fairly low overhead repeater process which will > accept N connections (where N is going to be relatively small, in the area > of 5-12) connections from other processes and which will forward incoming > packets from one c

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-03-07 Thread Nick Mathewson
On Wed, Mar 6, 2013 at 11:48 PM, Patrick Pelletier wrote: > On 02/27/2013 10:22 PM, Patrick Pelletier wrote: >> >> But now, without further ado, here is my branch which takes Catalin's >> original https-client.c, fixes a few small issues (or things which I >> considered issues in my opinion), and

Re: [Libevent-users] random crashed by [err] event_queue_remove:not on queue 8

2013-02-26 Thread Nick Mathewson
On Sun, Feb 24, 2013 at 8:46 AM, Tony Qin wrote: > Is it allowed to create two loops in one process but within different thread? Yes, but they must have different event_base structures. Also, you need to enable threading support by calling the appropriate event_enable_*_threading() function

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-02-21 Thread Nick Mathewson
On Wed, Feb 20, 2013 at 10:26 PM, Jardel Weyrich wrote: > On Wed, Feb 20, 2013 at 9:03 PM, Nick Mathewson wrote: >> >> On Wed, Feb 20, 2013 at 12:42 PM, Catalin Patulea >> wrote: >> > On Tue, Feb 19, 2013 at 9:40 PM, Jardel Weyrich >> > wrote: >

Re: [Libevent-users] random crashed by [err] event_queue_remove:not on queue 8

2013-02-21 Thread Nick Mathewson
On Wed, Feb 20, 2013 at 1:41 AM, Tony Qin wrote: >> Debug mode and debug logs are different things; if you can't store the >> debug logs, you can still enable debugging mode without turning on >> debug logs. >> > > how to enable debug mode without turning on debug log? > > only set the following l

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-02-20 Thread Nick Mathewson
On Wed, Feb 20, 2013 at 12:42 PM, Catalin Patulea wrote: > On Tue, Feb 19, 2013 at 9:40 PM, Jardel Weyrich wrote: >> 2) Call SSL_CTX_load_verify_locations passing the path of the CA >> certificates installed by the aforementioned package - generally >> /etc/ssl/certs/ca-certificates.crt > Nick, d

Re: [Libevent-users] Re: [PATCH] http: on connection reset, detach the closed fd from the bufferevent

2013-02-19 Thread Nick Mathewson
On Tue, Feb 19, 2013 at 11:57 AM, Catalin Patulea wrote: > On Tue, Feb 19, 2013 at 11:49 AM, Nick Mathewson wrote: >> Could you be more specific about the good results, and how to >> reproduce them? Or how to reproduce/observe the undesired behavior? >> It would al

Re: [Libevent-users] use windows threads leak

2013-02-19 Thread Nick Mathewson
On Tue, Feb 19, 2013 at 1:23 PM, Brett Harrison wrote: > I am using 2.0.21-stable on windows. When shutting down the server I get 3 > memory leaks (see below). > > Is there a clean function I should be calling when using windows threads? In Libevent 2.1, there is libevent_global_shutdown(). In

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-02-19 Thread Nick Mathewson
On Tue, Feb 19, 2013 at 3:05 PM, Nick Mathewson wrote: > On Tue, Feb 19, 2013 at 12:22 PM, Catalin Patulea wrote: >> >> Signed-off-by: Catalin Patulea >> --- >> .gitignore| 1 + >> sample/https-client.c | 207 >> ++

Re: [Libevent-users] [PATCH] Add sample/https-client.c, an example of stacking evhttp as a client on top of bufferevent_ssl.

2013-02-19 Thread Nick Mathewson
On Tue, Feb 19, 2013 at 12:22 PM, Catalin Patulea wrote: > > Signed-off-by: Catalin Patulea > --- > .gitignore| 1 + > sample/https-client.c | 207 > ++ > sample/include.am | 5 ++ > 3 files changed, 213 insertions(+) > create

Re: [Libevent-users] Re: [PATCH] http: on connection reset, detach the closed fd from the bufferevent

2013-02-19 Thread Nick Mathewson
On Tue, Feb 19, 2013 at 11:35 AM, Catalin Patulea wrote: > [-cc: my personal email, added by mistake] > > Ping. We've been seeing good results with this. Could you be more specific about the good results, and how to reproduce them? Or how to reproduce/observe the undesired behavior? It would als

Re: [Libevent-users] random crashed by [err] event_queue_remove:not on queue 8

2013-02-19 Thread Nick Mathewson
On Mon, Feb 18, 2013 at 9:41 PM, Tony Qin wrote: > humm when I enable the debug mode in libevent, it will dump > GB-level log and not easy to check specific event. Also, the crash > does not always happen in any time running. Debug mode and debug logs are different things; if you can't store

Re: [Libevent-users] Deep recursive call of bufferevent write callback when openssl is in use

2013-02-18 Thread Nick Mathewson
On Mon, Feb 18, 2013 at 8:58 PM, JiaQiang Xu wrote: > 2013/2/19 Nick Mathewson : >> On Mon, Feb 18, 2013 at 9:01 AM, JiaQiang Xu wrote: >>> Hi, >>> >>> I'm using libevent to write an http server for transferring files. I >>> use open

Re: [Libevent-users] Deep recursive call of bufferevent write callback when openssl is in use

2013-02-18 Thread Nick Mathewson
On Mon, Feb 18, 2013 at 9:01 AM, JiaQiang Xu wrote: > Hi, > > I'm using libevent to write an http server for transferring files. I > use openssl for https. Have you tried looking at the BEV_OPT_DEFER_CALLBACKS option? Its main role it to prevent infinite chains of recursive callbacks like this.

Re: [Libevent-users] random crashed by [err] event_queue_remove:not on queue 8

2013-02-18 Thread Nick Mathewson
On Sun, Feb 17, 2013 at 10:09 PM, Tony Qin wrote: > Hi all, > > I uses the libevent-2.0.19-stable in my rpc server to send data from > client-end to server-end. However, my server is always "exist" by > libevent (by event_errx()). > > Checked log and fond the follow message: > > event_queue_remove

Re: [Libevent-users] evhttp client and IPv6

2013-02-18 Thread Nick Mathewson
On Thu, Feb 14, 2013 at 7:28 PM, Patrick Pelletier wrote: [...] > > I've been similarly frustrated with the lack of evhttp client examples, > especially ones that properly show how to do error handling, IPv6, and > https. I've created a repo (because it's just a little too big to feel > comforta

Re: [Libevent-users] winsock error strings: evutil_socket_error_to_string versus FormatMessage

2013-02-14 Thread Nick Mathewson
On Thu, Feb 7, 2013 at 8:38 PM, Patrick Pelletier wrote: > I noticed the following comment in evutil_socket_error_to_string in > evutil.c: > > /* Is there really no built-in function to do this? */ > > The answer is yes, the built-in function FormatMessage will do this for you. > I'm happy to

Re: [Libevent-users] evrpc_status structure.

2013-02-04 Thread Nick Mathewson
On Sun, Feb 3, 2013 at 10:58 AM, fabien pichot wrote: > Hello, > > I didn't lurk that ML that much, so I'm not really sure about the way to send > patches. But anyway, attached is a patch that makes the error codes public and > add two functions to get the error and the http request from the evrpc

Re: [Libevent-users] event shutdown/cleanup

2013-01-30 Thread Nick Mathewson
On Wed, Jan 30, 2013 at 7:38 PM, John Dunn wrote: > I have a socket server which allocates memory for each connection. If there's > an error on the socket it's easy for me to delete any memory associated with > the connection. I also need to shutdown the eventbase from another thread > which n

Re: [Libevent-users] Minimal configuration

2013-01-30 Thread Nick Mathewson
On Wed, Jan 30, 2013 at 7:53 PM, Ralph Castain wrote: > Hi folks > > We're trying to support a system that has a really minimal OS on it - e.g., > no sockets or TCP/IP stack. Looking at libevent, and particularly at > evutil.c, we don't see a way to --disable-sockets. > > Has anyone looked at co

Re: [Libevent-users] evrpc_status structure.

2013-01-21 Thread Nick Mathewson
On Mon, Jan 21, 2013 at 9:28 PM, fabien pichot wrote: > Hello, > > I'm currently working on a prototype of decentralized VPN, and I'm > using libevent for anything related to network. > > Recently, I decided to write RPC to communicate between my nodes. And > after a quick hovering on evrpc/evhttp

Re: Re : [Libevent-users] libevent client tries to reconnect to a lost server

2013-01-14 Thread Nick Mathewson
On Mon, Jan 14, 2013 at 5:52 PM, wrote: > It serms that this is not the way it should be done. The whole buffer event > should be removed and created again, until the server starts to respond. > Unfortunately this method causes a segmentation fault. I had no idea of how > such a simple problem

Re: [Libevent-users] some error about evsig_init in winxp.

2013-01-14 Thread Nick Mathewson
On Mon, Jan 14, 2013 at 9:48 AM, simon zhang wrote: > I compile the code as DLL in winxp with libevent.The compiler is msvc90.But > It have some error as the following: > > evsig_init:socketpair:Successful WSAStartup not yet performed > [WSANOTINITIALISED] On windows, you need to invoke WSAStartu

Re: [Libevent-users] Can the pipe be used in event_new function as file descriptor(evutil_socket_t) in windows?

2013-01-09 Thread Nick Mathewson
On Wed, Jan 9, 2013 at 2:09 PM, simon zhang wrote: > I wanted some linux code work in the windows.This is a multi thread > program.I hope that the parent thread and child thread to pass data through > the pipe. > But no file descriptor in windows.The CreatePipe function can creat a pipe > with rea

Re: [Libevent-users] Does libevent support HANDLE processing on Win32 Platform?

2012-12-20 Thread Nick Mathewson
On Wed, Dec 19, 2012 at 8:29 PM, zhengfish wrote: > Hi, All, > > Does libevent support HANDLE processing on Win32 Platform? > If there is a HANDLE variable created by the CreateFile API, > > How can I user libevent/event_assign() to monitor it? Libevent doesn't handle HANDLEs. To handle HANDLE ha

Re: [Libevent-users] multithreading problem

2012-12-16 Thread Nick Mathewson
On Sun, Dec 16, 2012 at 10:52 AM, Björn K. wrote: > Hello, > > I'm trying to write a simple https server which utilizes multiple cpu cores. > I call evthread_use_pthreads() and create several pthreads I can't tell without looking at the rest of the program, but are you sharing one event_base amon

Re: [Libevent-users] UDP Support

2012-12-12 Thread Nick Mathewson
On Wed, Dec 12, 2012 at 1:56 PM, Scott Dorr wrote: > UDP works fine in libevent. I have several UDP based applications that run > solely over UDP. > > You might have to run edge triggered to support UDP. I know I had to move to > edge triggered, though I can't recall if that was for UDP, or for

Re: [Libevent-users] evhttp and TLS hostname validation

2012-12-09 Thread Nick Mathewson
On Sat, Dec 8, 2012 at 6:03 AM, Patrick Pelletier wrote: > However, it's not clear to me how to work the validation function > (validate_hostname) into evhttp's control flow. It seems that I would need > to call validate_hostname after the TLS handshake occurs, but before evhttp > starts transfe

Re: [Libevent-users] event base assert locked segmentation fault

2012-12-07 Thread Nick Mathewson
On Fri, Dec 7, 2012 at 3:20 PM, Vargas, Christina wrote: > > Has anyone seen a backtrace like this before? We have an application designed > to handle SMPP traffic over TCP, but I am not permitted to disclose source > code. It is using libevent-2.0.12, but not setting the base event (old style

Re: [Libevent-users] Q: Will listener FD receive regular EV_READ callbacks?

2012-12-06 Thread Nick Mathewson
On Thu, Dec 6, 2012 at 6:51 AM, Mark Ellzey wrote: > On Wed, Dec 05, 2012 at 10:52:37PM +, Alexander Kolbasov wrote: >> The libevent documentation mentions connection listeners that provide >> callback events for listener file descriptors. >> My question is - if we register EV_READ callback o

Re: [Libevent-users] http request errors

2012-11-27 Thread Nick Mathewson
On Tue, Nov 27, 2012 at 4:48 PM, Ben Short wrote: > Hi, > > Is it possible to get socket errors from within the http request callback? I > need to find out if the requested timed out or the connection was refused > etc. Libevent 2.1.2-alpha added a patch to try to make errno (or EVUTIL_SOCKET_ERR

Re: [Libevent-users] Cross-event base interactions

2012-11-21 Thread Nick Mathewson
On Tue, Nov 20, 2012 at 5:55 PM, Ralph Castain wrote: > Hi folks > > We have a case where we are running two parallel threads, each looping on > their own event base (we have the libevent thread support enabled). Even > though the two bases are running in separate threads, however, we see an >

[Libevent-users] ANN: Libevent 2.1.2-alpha is released!

2012-11-19 Thread Nick Mathewson
Announcing Libevent-2.1.2-alpha === Libevent 2.1.2-alpha is released! This is the second release in the Libevent 2.1 series. As the "alpha" should tell you, this is not a stable release: you should not run it unless you're willing to debug together. If you want a stab

[Libevent-users] ANN: Libevent-2.0.21-stable is released

2012-11-19 Thread Nick Mathewson
Hello, everyone! Announcing Libevent 2.0.21-stable = Libevent 2.0.21-stable is now tagged and released. The package is available from the website at http://libevent.org/ . There are GPG signatures there too; you should probably verify them, to make sure you get t

Re: [Libevent-users] evhttp client error handling

2012-11-19 Thread Nick Mathewson
On Thu, Nov 15, 2012 at 2:32 AM, Patrick Pelletier wrote: [...] > Not sure what the proper solution is for this, though. I'm not enough of > a sockets expert. Although I'm curious why we need to create the socket > before we've looked up the name. If we looked up the name first, then we > could

Re: [Libevent-users] Beginners' question: multi-threaded HTTP service

2012-11-16 Thread Nick Mathewson
On Fri, Nov 16, 2012 at 5:49 AM, Pander wrote: > Hi all, > > I am new to libevent and am wondering what to choose for a > multi-threated minimal and fast HTTP service that will run custom C code > for the POST requests it will get. > > Both libevent/http and lighttpd are candidates for my service

Re: [Libevent-users] build libevent2 in windows without thread support

2012-11-15 Thread Nick Mathewson
On Thu, Nov 15, 2012 at 9:01 PM, JiangHao wrote: > i only use select in windows,and don't care about thread.so i want to > build libevent2 without thread support,then I edit the event-config.h,add > #define _EVENT_DISABLE_THREAD_SUPPORT,and > use nmake to build libevent2. > is that ok?do i missin

Re: [Libevent-users] Segmentation fault 2.1.1-alpha

2012-11-11 Thread Nick Mathewson
On Sun, Nov 11, 2012 at 2:58 PM, Bruno Avila wrote: > Hi, > > I had the following in my program after 24 hours runinng: > Hm. This looks like it might be one of the issues fixed in Libevent since 2.1.1-alpha was released. The 2.0.x releases have been coming out fairly regularly, but I've been l

Re: [Libevent-users] Using event_active() for partial reading with bufferevents

2012-11-08 Thread Nick Mathewson
Hello again! On Tue, Nov 6, 2012 at 4:12 PM, Himanshu S wrote: > > On Tue, Nov 6, 2012 at 7:37 AM, Nick Mathewson wrote: > > Right now the best way to do what you have in mind is to consider *why* >> you only want to read partial data and then read again after the next event

Re: [Libevent-users] evbuffer_readln(LF) equivalent in 1.4

2012-11-08 Thread Nick Mathewson
On Tue, Nov 6, 2012 at 11:28 PM, Tay Ray Chuan wrote: > Hi, > > I'm calling evbuffer_readln(..., EVBUFFER_EOL_LF), but I have to > support 1.4 as well. Is there an equivalent invocation? > evbuffer_readline()? > I'm a little confused; looking at 1.4.14b, it appears that EVBUFFER_EOL_LF is in the

Re: [Libevent-users] Using event_active() for partial reading with bufferevents

2012-11-06 Thread Nick Mathewson
On Tue, Nov 6, 2012 at 12:29 AM, Himanshu S wrote: > Hi, >I am using bufferevent_* APIs for my application to read/write data to > TCP stream. When the data arrives, the read callback happens, I want to > read partial data (at times), and then be able to post an event back so > that the event

Re: [Libevent-users] Use of bufferevent_disable

2012-11-01 Thread Nick Mathewson
You shouldn't be getting error conditions in this case. Remember, bufferevents are implemented using the underlying operating system's networking API, which typically will not alert you to errors except during a read, write, connect, or other similar network operation. If reading and writing are

Re: [Libevent-users] IOCP: evconnlistener_free doesn't close listening socket

2012-10-26 Thread Nick Mathewson
On Thu, Oct 25, 2012 at 3:23 PM, Juan Pablo Fernandez wrote: > Of course. > > Unit tests run fine too. > > /Juan Great. I've merged this to 2.0 and 2.1. Thanks! -- Nick *** To unsubscribe, send an e-mail to majord...@freehaven

Re: [Libevent-users] DLL on Windows

2012-10-25 Thread Nick Mathewson
On Thu, Oct 25, 2012 at 3:01 PM, Jan Danielsson wrote: > Hello, > >I figured out one can run "nmake -f makefile.nmake" to get static > libraries which may or may not work (according to the makefile). I've had reports that they work, but I'd really like some windows person with more build expe

Re: [Libevent-users] Memory management

2012-10-25 Thread Nick Mathewson
On Thu, Oct 25, 2012 at 2:21 PM, Bruno Avila wrote: > Hi all. > > I have a few questions about the memory management of libevent. > > 1) I replaced the memory functions of libvevent using > event_set_mem_functions() with my own functions and I added a counter for > malloc, realloc and free (Yes, I

Re: [Libevent-users] IOCP: evconnlistener_free doesn't close listening socket

2012-10-25 Thread Nick Mathewson
On Thu, Oct 25, 2012 at 2:15 PM, Juan Pablo Fernandez wrote: > Ok. > > How about this: > > --- listener.c 2012-07-26 16:24:04.0 +0200 > +++ listener.c.fix 2012-10-25 15:05:24.809285000 +0200 > @@ -741,6 +741,9 @@ > } > LeaveCriticalSection(&as->lock);

Re: [Libevent-users] IOCP: evconnlistener_free doesn't close listening socket

2012-10-24 Thread Nick Mathewson
On Tue, Oct 23, 2012 at 3:34 PM, Juan Pablo Fernandez wrote: > IOCP event base and listener created with LEV_OPT_CLOSE_ON_FREE. > Shouldn't iocp_listener_disable_impl check for LEV_OPT_CLOSE_ON_FREE? I think so! Is this something you could write a patch for? yrs, -- Nick **

Re: [Libevent-users] Timer Optimization Needed ?

2012-10-04 Thread Nick Mathewson
On Wed, Oct 3, 2012 at 1:13 AM, Parvez Shaikh wrote: [...] > I would like to know whether in such a scenario I should make use of the > "Timer Optimizations" suggested in the libevent documentation. Please note > that the data associated with each "work" would be different. So the > callback in t

Re: [Libevent-users] How to implement 2.1.x the function --event_base_loop(base *, EVLOOP_NO_EXIT_ON_EMPTY) use 2.0.x

2012-09-27 Thread Nick Mathewson
On Thu, Sep 27, 2012 at 1:41 AM, rqslt wrote: > Hi, all! > I want event_base_loop(2.0.x) can "Do not exit the loop because we have > no pending events", be similar to use EVLOOP_NO_EXIT_ON_EMPTY(2.1.x). > Who can tell me how to do ? As a workaround, just make a timeout very far in the fut

Re: [Libevent-users] in libevent-2.1.1-alpha cannot find the function event_base_loopcontinue

2012-09-21 Thread Nick Mathewson
On Thu, Aug 16, 2012 at 1:15 PM, rqslt wrote: > Hi, everyone: > Today i try the libevent-2.1.1-alpha , i download the source in the > libevent homepage(libevent.org). I discover the version have many > convenient funcition from the > document(http://www.wangafu.net/~nickm/libevent-2.1/doxygen/html

Re: [Libevent-users] pthread_cond_timedwait realtime clock race

2012-09-20 Thread Nick Mathewson
On Sep 20, 2012 1:47 PM, "David Goulet" wrote: > > I was thinking that maybe we could simply set the monotonic clock > source, if available, by default in the evthread_posix_cond_alloc(). Seems plausible to me -- either at alloc time or wait time, whichever works better. (Remember to use the mas

Re: [Libevent-users] pthread_cond_timedwait realtime clock race

2012-09-18 Thread Nick Mathewson
On Tue, Sep 18, 2012 at 4:14 PM, David Goulet wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > Hi everyone, > > I'm David from the LTTng project (http://lttng.org). I'm sharing here > an issue we ran into. The solution could benefit the libevent project. Hi, and thanks for the heads

Re: [Libevent-users] Two event base in multi threaded application vs one event base?

2012-09-12 Thread Nick Mathewson
On Fri, Sep 7, 2012 at 12:00 PM, Parvez Shaikh wrote: > Hi experts, > > While setting socket FD in event loop, should FD be set non-blocking (using > fcntl)? Almost certainly. You can also use evutil_make_socket_nonblocking(), which is a little more portable. > Further I am confused about how t

Re: [Libevent-users] Fwd: Possible memleaks reported in Debian bug#679217

2012-09-12 Thread Nick Mathewson
On Mon, Sep 10, 2012 at 11:08 AM, Leo Antunes wrote: Thanks again; just merged these patches. yrs, -- Nick *** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-usersin the body.

Re: [Libevent-users] Timerout procedure can't enter twice

2012-09-11 Thread Nick Mathewson
On Tue, Sep 11, 2012 at 5:54 PM, Michael wrote: > Hi , > > I'm using libevent to create timer procedure. > > The attached program will call the timeout function at the first time. > > But it won't call the timeout function after I rewrite the timer. > > Attached please find the test code. > > Is t

Re: [Libevent-users] Program halt after add event

2012-09-11 Thread Nick Mathewson
On Tue, Sep 11, 2012 at 1:28 PM, Michael wrote: > Hi, > > Thanks! > > Attached please find the test code(3 files): > > start.c will create 2 threads: restart1 and restart2, which will create 1 > timer each. > > time1.c for restart1 and > > time2.c for restart2. > > while compile and execute th

[Libevent-users] Re: BOUNCE libevent-us...@freehaven.net: Non-member submission from [Chernyshev Vyacheslav ]

2012-09-11 Thread Nick Mathewson
> From: Chernyshev Vyacheslav > Content-Type: text/plain; charset=windows-1251 > Content-Transfer-Encoding: quoted-printable > Subject: Recommended way of notifying all active sessions > Message-Id: <42f18941-b6e5-4218-80c6-0b8bd9eb4...@ro.ru> > Date: Fri, 10 Aug 2012 04:46:34 +0400 > To: libevent

Re: [Libevent-users] Program halt after add event

2012-09-11 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 6:24 PM, Michael wrote: > Hi, > > I want use libevent as timer management tool in our program. Our program is > multi-thread , and each thread will use some timer. > > I can enter into the call back function after I called the following > functions: event_assign(), event_

Fwd: [Libevent-users] Possible memleaks reported in Debian bug#679217

2012-09-10 Thread Nick Mathewson
Whoops. Should have sent this to the mailing list. Also, Leo, where did you get the idea that the @monkey.org address is the current mailing list? Is there a dead link somewhere? -- Forwarded message -- From: Nick Mathewson Date: Sun, Sep 9, 2012 at 5:00 PM Subject: Re

Re: [Libevent-users] bufferevent with custom IO

2012-09-10 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 5:30 PM, Joachim Bauch wrote: > -Ursprüngliche Nachricht- > Von: Nick Mathewson > [...] >> Sounds like a big but fun project. You might want to look at >> bufferevent_sock.c first; bufferevent_openssl.c has to jump through a >> lot of

Re: [Libevent-users] CPU spinning

2012-09-07 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 3:19 PM, Venkatesh Solaiyappan wrote: > Hello: > > In one of our system, CPU hogs in one of the thread whose stack trace to > the following: > Wondering if it is a known issue?? Pls advise. > > > > #0 0x7fe60a5ef4c0 in ?? () from /usr/lib64/libevent-2.0.so.5 > > #1 0x

Re: [Libevent-users] Re: [Levent-commits] [Libevent/master 3/4] Add doxygen for event_base_dump_events

2012-09-07 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 6:58 PM, Roman Puls wrote: [...] > event-dump-lock.patch for the latter > event-foreach-fully.patch for the first topic (public API). However, I > generally changed the signature of the callback to const (struct > event_base|event). Thanks, Roman! I just merged the heavy-

Re: [Libevent-users] Free buffer of a http request

2012-09-06 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 1:13 PM, Bruno Avila wrote: > Hi, > > Once I make an evhttp request (e.g. GET) and read the content from the > evbuffer, which buffers of struct evhttp_request should I free? Or is done > transparently by libevent? When the request is freed, its buffers should get freed too

Re: [Libevent-users] Re: [Levent-commits] [Libevent/master 3/4] Add doxygen for event_base_dump_events

2012-09-06 Thread Nick Mathewson
On Thu, Sep 6, 2012 at 8:40 AM, Roman Puls wrote: > Hi Nick, > > excellent - it would be even greater to specify a callback procedure > receiving the struct event tokens (I currently write language bindings for > tcl, and it would be great to generate the textual representation myself) Hm. This w

Re: [Libevent-users] bufferevent with custom IO

2012-09-05 Thread Nick Mathewson
On Wed, Sep 5, 2012 at 5:14 AM, Joachim Bauch wrote: > Hi, > > I'm looking for a way to implement a bufferevent that uses a custom API > to read/write data to the network - similar to what the SSL bufferevent > does with the OpenSSL BIO. > > Any hints on what would be the best way to implement thi

[Libevent-users] Please have a look at a bufferevent_openssl patch

2012-09-04 Thread Nick Mathewson
Hi, all! Joachim Bauch has a pull request at https://github.com/nmathewson/Libevent/pull/63 for another bugfix to SSL bufferevents. It's a simple change, but I'd appreciate it if people who use SSL bufferevents -- especially people who have encountered, diagnosed, tracked down, or fixed SSL buffe

Re: [Libevent-users] Method to get the fd associated with a http evcon object

2012-08-31 Thread Nick Mathewson
On Fri, Aug 31, 2012 at 3:54 PM, Alap Kumar Sinha wrote: > Hi, > > Is there a way to get the file descriptor associated with the evcon object > of a request (evhttp_request)? > evhttp_connection_get_bufferevent + bufferevent_getfd is intended to work. yrs, -- Nick **

Re: [Libevent-users] a question of evbuffer_pullup

2012-08-24 Thread Nick Mathewson
On Thu, Aug 23, 2012 at 2:35 PM, simon zhang wrote: > I don't understand “must first ensure that the front of the buffer > really is contiguous”. > > I can get 100 bytes from evbuffer by evbuffer_pullup() or evbuffer_remove(). > evbuffer_pullup():get some contiguous data. > evbuffer_remove():get s

[Libevent-users] [ANN] Libevent 2.0.20-stable is released

2012-08-24 Thread Nick Mathewson
Hello, everyone! Announcing Libevent 2.0.20-stable = Libevent 2.0.20-stable is now tagged and released. The package is available from the *shiny new website* at http://libevent.org/ . There are GPG signatures there too; you should probably verify them, to make su

Re: [Libevent-users] bufferevent_openssl: readcb not always called for last partial read

2012-08-23 Thread Nick Mathewson
On Wed, Aug 22, 2012 at 1:04 PM, Hochhaus, Andrew wrote: > Thanks. > > On Wed, Aug 22, 2012 at 11:33 AM, Nick Mathewson wrote: >> Hm. Looking at how the output is used, I think that the tristate >> output format is probably a mistake. It wants to return both "did I &

Re: [Libevent-users] bufferevent_openssl: readcb not always called for last partial read

2012-08-22 Thread Nick Mathewson
On Tue, Aug 21, 2012 at 11:02 PM, Hochhaus, Andrew wrote: > Hello, > > In libevent-2.0.19-stable, do_read can return 0 (stalled) when some > progress has been made reading. This can occur, for example, when > space[0].iov_len > 0 and the 2nd read attempt returns > SSL_ERROR_WANT_READ. Then conside

[Libevent-users] Re: ANN: Appnexus is sponsoring Libevent in 2012

2012-08-21 Thread Nick Mathewson
On Tue, Aug 21, 2012 at 1:40 PM, Nick Mathewson wrote: > Some of these I could do myself; some I can't. I would be shocked to > see all of them get done in 0.2.4, or even half of them. Whoops! I have crossed the streams. My day job's alpha series is "0.2.4.x". Abo

[Libevent-users] Re: ANN: Appnexus is sponsoring Libevent in 2012

2012-08-21 Thread Nick Mathewson
On Fri, Aug 17, 2012 at 10:18 PM, Nick Mathewson wrote: > On Wed, May 30, 2012 at 11:58 PM, Nick Mathewson wrote: > [...] >>I'm thinking of offering a $500-$1000 or so apiece for a few >> tasks that have been annoying the community for a while, and which &g

Re: [Libevent-users] Error in evthread_pthread.c

2012-08-20 Thread Nick Mathewson
On Mon, Aug 20, 2012 at 5:29 PM, Chernyshev Vyacheslav wrote: > Hello. > > My application had a very confusing crash today, it failed at assertion deep > inside pthreads library. Here is an exact output: > > > tpp.c:63: __pthread_tpp_change_priority: Assertion `new_prio == -1 || > (new_prio >= __

[Libevent-users] Re: ANN: Appnexus is sponsoring Libevent in 2012

2012-08-17 Thread Nick Mathewson
On Wed, May 30, 2012 at 11:58 PM, Nick Mathewson wrote: [...] >I'm thinking of offering a $500-$1000 or so apiece for a few > tasks that have been annoying the community for a while, and which > require either time or expertise that I don't have. I've got a f

Re: [Libevent-users] Recommended way of notifying all active sessions

2012-08-10 Thread Nick Mathewson
On Fri, Aug 10, 2012 at 11:42 AM, Chernyshev Vyacheslav wrote: > Hello. I bet that this question was already asked a couple of times, but… > What is the right way to execute some action for all currently registered > descriptors? Let imagine that I have a lot of active client sessions that > mu

Re: [Libevent-users] Deadlock when calling bufferevent_free from an other thread

2012-08-09 Thread Nick Mathewson
On Wed, Aug 8, 2012 at 11:43 PM, Dave Hart wrote: > One solution that comes to mind is to add a (for example) > event_del_nowait(), or event_del_nonblocking() which requires the > event in question be allocated dynamically via libevent, and therefore > can safely use the dead list approach of queu

Re: [Libevent-users] Deadlock when calling bufferevent_free from an other thread

2012-08-08 Thread Nick Mathewson
On Wed, Aug 8, 2012 at 6:44 PM, Adrian Chadd wrote: > On 8 August 2012 15:30, Nick Mathewson wrote: > >> Specifically, let me follow up with what I need: I need people with >> good programming taste to read and understand that message, and let me >> know whether you&#

Re: [Libevent-users] my app crashed, maybe a bug in libevent

2012-08-08 Thread Nick Mathewson
On Wed, Aug 1, 2012 at 3:41 AM, huyinyx wrote: > in buffer.c : > > for (chain = buf->first; >remaining >= chain->off; >chain = next) { >next = chain->next; >remaining -= chain->off; >if (chain == *buf->last_with_datap) { > buf->last_with_datap = &buf->first; >}

Re: [Libevent-users] Deadlock when calling bufferevent_free from an other thread

2012-08-08 Thread Nick Mathewson
On Wed, Aug 8, 2012 at 2:52 PM, Nick Mathewson wrote: > On Mon, Aug 6, 2012 at 2:42 PM, Matthieu Nottale > wrote: >> Hi. >> >> I'm experiencing a deadlock on 2.0.19 while calling bufferevent_free frome >> thread A, while thread B is in event_base_dispatch

  1   2   3   4   5   6   >