Fix #257: Windows 7: SIPE crashes after a minute
commit3893f9589a0440d89f0c9519f5b46b2e6d947a37
authorStefan Becker <chemobejk@gmail.com>
Sat, 28 Jun 2014 17:16:14 +0000 (28 20:16 +0300)
committerStefan Becker <chemobejk@gmail.com>
Sat, 28 Jun 2014 17:16:14 +0000 (28 20:16 +0300)
tree25b2596f5d1f7b45833bd1bc12226ffc6f39faba
parent528db6a9b4015f6653c4b6681f43d764b8bbc8a3
Fix #257: Windows 7: SIPE crashes after a minute

When trying to simulate the same situation, i.e. all EWS autodiscover
attempts fail with a DNS error, I noticed a slight difference between my
debug logs and the debug logs provided by the reporters.

I can only explain this difference if g_hash_table_remove() calls the
value destroy callback *before* removing the hash table entry. In our
case the destroy callback triggers the EWS HTTP callback which
immediately generates another HTTP request. In one situation that new
HTTP request has the same host:port key as the just "removed" entry and
the SIPE HTTP stack tries to re-establish the connection which is
actually already invalid.

Circumvent this race condition by using g_hash_table_steal() and calling
the value destroy callback by hand.
src/core/sipe-http-transport.c