[Libevent-users] Deprecated functions and their replacements

2013-03-27 Thread Grega Kres
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.

Another one is evhttp_connection_new which is on the list as well, as
you can't specify an event base with it. But what is the replacement
for that one? I could use evhttp_connection_set_base, but that one is
marked as deprecated as well, albeit with an interesting "comment"
attached.

So is there a way around evhttp_connection_new and
evhttp_connection_set_base, or should I keep using them for now?

BTW, I'm using 2.0.21.

Thanks
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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

2013-03-27 Thread Mark Ellzey
On Tue, Mar 26, 2013 at 03:32:17PM -0700, 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 
> should present no real problem from a synchronization perspective. In fact, 
> the code works flawlessly when using ordinary bufferevents (not ssl 
> bufferevents).
> 

Have you enabled OpenSSL locking? OpenSSL uses a myriad of global
variables and you have to initalize a set of mutexes and set lock/unlock
callbacks via ssl. See
https://github.com/ellzey/libevhtp/blob/master/evhtp.c#L3160 as an
example.
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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 
> should present no real problem from a synchronization perspective. In fact, 
> the code works flawlessly when using ordinary bufferevents (not ssl 
> bufferevents).
>
> Are there any known issues with writing to a single openssl bufferevent from 
> multiple threads concurrently? Should I have the expectation of this working, 
> presuming my code is written correctly? I believe I have initialized libevent 
> and openssl correctly for multithreaded execution.
>

This could also be related to the deadlock issue under discussion in
the thread on this mailing list  with subject "Deadlock when calling
bufferevent_free from an other thread" -- have a look at the archives
for more info on the status of that one.

(Wow, I should really answer that thread RSN.)

-- 
Nick
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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

2013-03-27 Thread John
Mark,

Yes, I have enabled OpenSSL locking, including setting up dynamic locking. I 
have verified the locks are "running" by watching the various lock callbacks 
occuring. I "stole" the locking code from the book "Network Security with 
OpenSSL", by Viega/Messier/Chandra.

Thanks,
-John


- Original Message -
From: Mark Ellzey 
To: libevent-us...@freehaven.net
Cc: 
Sent: Wednesday, March 27, 2013 7:23 AM
Subject: Re: [Libevent-users] Simple question about multithreading SSL 
bufferevents.

On Tue, Mar 26, 2013 at 03:32:17PM -0700, 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 
> should present no real problem from a synchronization perspective. In fact, 
> the code works flawlessly when using ordinary bufferevents (not ssl 
> bufferevents).
> 

Have you enabled OpenSSL locking? OpenSSL uses a myriad of global
variables and you have to initalize a set of mutexes and set lock/unlock
callbacks via ssl. See
https://github.com/ellzey/libevhtp/blob/master/evhtp.c#L3160 as an
example.
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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.
>
> Another one is evhttp_connection_new which is on the list as well, as
> you can't specify an event base with it. But what is the replacement
> for that one? I could use evhttp_connection_set_base, but that one is
> marked as deprecated as well, albeit with an interesting "comment"
> attached.
>
> So is there a way around evhttp_connection_new and
> evhttp_connection_set_base, or should I keep using them for now?

evhttp_connection_base_new or evhttp_connection_baes_bufferevent_new
would appear  to be the ones to use.
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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

2013-03-27 Thread Mark Ellzey
On Tue, Mar 26, 2013 at 03:32:17PM -0700, John wrote:
> I would be happy to share my test code- but it is ~300ish lines due to 
> (primarily) openssl and thread initialization.

Please make a gist or a patebin.
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.


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

2013-03-27 Thread John
You can see the test code at

http://pastebin.com/0136vEbe


-John



- Original Message -
From: Mark Ellzey 
To: libevent-us...@freehaven.net
Cc: 
Sent: Wednesday, March 27, 2013 11:20 AM
Subject: Re: [Libevent-users] Simple question about multithreading SSL 
bufferevents.

On Tue, Mar 26, 2013 at 03:32:17PM -0700, John wrote:
> I would be happy to share my test code- but it is ~300ish lines due to 
> (primarily) openssl and thread initialization.

Please make a gist or a patebin.
***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-users    in the body.

***
To unsubscribe, send an e-mail to majord...@freehaven.net with
unsubscribe libevent-usersin the body.