Yedidya Feldblum [Tue, 24 Nov 2015 02:45:15 +0000 (18:45 -0800)]
Fix Build: folly/test/ThreadLocalTest
Summary: [Folly] Fix Build: `folly/test/ThreadLocalTest`.
The problem is that the to the shared lib used in the test is hardcoded. It's a relative path, so that's nice, but it has too many assumptions about where the build system deposits test binaries.
Instead, let the code simply look for the shared lib in the same directory as the test binary. This makes fewer assumptions on the build system.
Reviewed By: andriigrynenko
Differential Revision:
D2689047
fb-gh-sync-id:
648da079b7af5bc9893709d009e577347dd4a463
Haijun Zhu [Mon, 23 Nov 2015 22:25:47 +0000 (14:25 -0800)]
Fix HHWheelTimerTest.AtMostEveryN
Summary: If it takes too long to finish it is probably heavily loaded. Skip if
so.
Reviewed By: mmcduff
Differential Revision:
D2687346
fb-gh-sync-id:
282cac7e4df361f714de1089f11b098af79b1512
Chad Parry [Mon, 23 Nov 2015 20:00:54 +0000 (12:00 -0800)]
Simplify an exception handler
Summary: It looks like there is no reason to catch a `std::exception` and then `dynamic_cast` to a derived exception. We can just catch the derived exception directly.
whatcouldgowrong4
Reviewed By: yfeldblum
Differential Revision:
D2677284
fb-gh-sync-id:
0149e4d4aecc96257376d410f592620205441f66
Michael Oliver [Mon, 23 Nov 2015 19:50:20 +0000 (11:50 -0800)]
Benchmark std::to_string vs. folly::to<std::string>
Summary: We wanted to compare the benefits of using folly::to<std::string> directly, and decided this benchmarking might as well be contributed back to folly. Here are the results:
```
============================================================================
folly/test/ConvTest.cpp relative time/iter iters/s
============================================================================
...
----------------------------------------------------------------------------
u64ToStringClibMeasure(1) 157.88ns 6.33M
u64ToStringFollyMeasure(1) 212.52% 74.29ns 13.46M
----------------------------------------------------------------------------
u64ToStringClibMeasure(12) 158.14ns 6.32M
u64ToStringFollyMeasure(12) 212.55% 74.40ns 13.44M
----------------------------------------------------------------------------
u64ToStringClibMeasure(123) 152.26ns 6.57M
u64ToStringFollyMeasure(123) 210.95% 72.18ns 13.85M
----------------------------------------------------------------------------
u64ToStringClibMeasure(1234) 152.40ns 6.56M
u64ToStringFollyMeasure(1234) 204.82% 74.41ns 13.44M
----------------------------------------------------------------------------
u64ToStringClibMeasure(12345) 156.01ns 6.41M
u64ToStringFollyMeasure(12345) 208.90% 74.68ns 13.39M
----------------------------------------------------------------------------
u64ToStringClibMeasure(123456) 178.21ns 5.61M
u64ToStringFollyMeasure(123456) 238.77% 74.63ns 13.40M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
1234567) 161.38ns 6.20M
u64ToStringFollyMeasure(
1234567) 203.09% 79.46ns 12.58M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
12345678) 159.01ns 6.29M
u64ToStringFollyMeasure(
12345678) 192.42% 82.64ns 12.10M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
123456789) 169.07ns 5.91M
u64ToStringFollyMeasure(
123456789) 203.70% 83.00ns 12.05M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
1234567890) 166.56ns 6.00M
u64ToStringFollyMeasure(
1234567890) 187.21% 88.97ns 11.24M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
12345678901) 176.22ns 5.67M
u64ToStringFollyMeasure(
12345678901) 197.57% 89.20ns 11.21M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
123456789012) 174.74ns 5.72M
u64ToStringFollyMeasure(
123456789012) 182.52% 95.74ns 10.45M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
1234567890123) 178.47ns 5.60M
u64ToStringFollyMeasure(
1234567890123) 186.81% 95.54ns 10.47M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
12345678901234) 187.33ns 5.34M
u64ToStringFollyMeasure(
12345678901234) 184.05% 101.78ns 9.82M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
123456789012345) 198.16ns 5.05M
u64ToStringFollyMeasure(
123456789012345) 182.48% 108.59ns 9.21M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
1234567890123456) 182.56ns 5.48M
u64ToStringFollyMeasure(
1234567890123456) 164.19% 111.19ns 8.99M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
12345678901234567) 186.80ns 5.35M
u64ToStringFollyMeasure(
12345678901234567) 162.33% 115.07ns 8.69M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
123456789012345678) 195.08ns 5.13M
u64ToStringFollyMeasure(
123456789012345678) 165.51% 117.87ns 8.48M
----------------------------------------------------------------------------
u64ToStringClibMeasure(
1234567890123456789) 200.27ns 4.99M
u64ToStringFollyMeasure(
1234567890123456789) 164.62% 121.65ns 8.22M
----------------------------------------------------------------------------
u64ToStringClibMeasure(12345678901234567890U) 203.18ns 4.92M
u64ToStringFollyMeasure(12345678901234567890U) 162.38% 125.13ns 7.99M
----------------------------------------------------------------------------
...
============================================================================
```
Reviewed By: yfeldblum
Differential Revision:
D2680998
fb-gh-sync-id:
179fbd756c714c92b7230d3750af024865ecbb0a
Sara Golemon [Mon, 23 Nov 2015 19:40:18 +0000 (11:40 -0800)]
Add missing header files to folly-automake
Summary: Closes https://github.com/facebook/folly/issues/304
Reviewed By: yfeldblum
Differential Revision:
D2685289
fb-gh-sync-id:
563697fb01ee358472b9080058848d2b557ba466
Sara Golemon [Mon, 23 Nov 2015 19:39:26 +0000 (11:39 -0800)]
Fix minor typo in folly/Conv.h
Summary: 'flating point' => 'floating point'
Closes https://github.com/facebook/folly/issues/241
Reviewed By: yfeldblum
Differential Revision:
D2685280
fb-gh-sync-id:
2e9c2b5419d0c631af4a32c5ab6b7366033ca34c
Andrii Grynenko [Sat, 21 Nov 2015 05:25:11 +0000 (21:25 -0800)]
Fix folly/ThreadLocal with clang after PthreadKeyUnregister change
Summary: Make PthreadKeyUnregister a global singleton for all StaticMeta instances.
Reviewed By: luciang
Differential Revision:
D2678401
fb-gh-sync-id:
c0d58b483fa6f096b29aeb7df71897a75ea8c892
Lucian Grijincu [Fri, 20 Nov 2015 20:03:52 +0000 (12:03 -0800)]
Revert "Fix folly::ThreadLocal to work in a shared library"
Summary: This reverts commit
9d355f96c4fe073c889f28070d5952fa4eb007a0.
build-break
Reviewed By: sctaylor
Differential Revision:
D2680784
fb-gh-sync-id:
a2df233bcd3721ffbfcd6fd71ea3cabbebebd4c4
Haijun Zhu [Fri, 20 Nov 2015 18:20:54 +0000 (10:20 -0800)]
get back AsyncServerSocket's setMaxNumMessagesInQueue
Summary:
D2613681 codemod'ed a thrift server api but it also renamed that api
in AsyncServerSocket, which is a mistake. Fix that in AsyncServerSocket, and
all other places that calls this api.
Reviewed By: alandau, JoelMarcey
Differential Revision:
D2677837
fb-gh-sync-id:
0d91f1a623229e99be59ca9dcd27f1330a9a1b64
Anirudh Ramachandran [Fri, 20 Nov 2015 16:35:40 +0000 (08:35 -0800)]
Remove unnecessary resetClientHelloParsing callback in AsyncSSLSocket
Summary: Remove unnecessary resetClientHelloParsing callback which causes problems wiht
Openssl 1.0.2
Reviewed By: knekritz
Differential Revision:
D2664730
fb-gh-sync-id:
d1b55ae493b4c92627ad41e7bf85f1e1a777bd2b
Alexander Shaposhnikov [Fri, 20 Nov 2015 04:12:41 +0000 (20:12 -0800)]
Remove busy wait and support multiple wait
Summary: Remove busy wait from Future::wait.
If future.wait(timeout) has succeded we should
return a ready future, otherwise we should return a future
for the final result (not necessarily ready).
Reviewed By: yfeldblum
Differential Revision:
D2646860
fb-gh-sync-id:
62671d09073ad86e84df8c9257e961d2a8c2a339
Delyan Kratunov [Fri, 20 Nov 2015 00:25:09 +0000 (16:25 -0800)]
Expose move result from LockFreeRingBuffer::Cursor
Summary: Without feedback that a `moveForward` or `moveBackward` did nothing, a user
cannot implement this idiom safely:
```
while(rb.tryRead(entry, cursor)) {
doSomething(entry);
cursor.moveBackward();
}
```
In the case where the ring buffer has not overflowed and slot 0 is still
available, the reader will get stuck at it (read it continuously) until
the buffer overflows.
This diff allows the above example to become:
```
while(rb.tryRead(entry, cursor)) {
doSomething(etnry);
if (!cursor.moveBackward()) {
break;
}
}
```
Reviewed By: bryceredd
Differential Revision:
D2674975
fb-gh-sync-id:
a0c5857daf186ef19e203f90acc2145590f85c3b
Giuseppe Ottaviano [Thu, 19 Nov 2015 19:39:27 +0000 (11:39 -0800)]
Fix usingJEMalloc with Clang
Summary: Clang is too clever and in some contexts optimizes away the `malloc`, but we rely on a side-effect. Declaring the variable as static forces it to call `malloc`. We could free the pointer relying on the fact that the lambda is guaranteed to be called only once, but I feel more comfortable just leaking it (LSan won't complain).
Reviewed By: philippv
Differential Revision:
D2674769
fb-gh-sync-id:
1153a3ca226c6b7aa64c453bd61b036dcbf3ffcc
Anton Likhtarov [Thu, 19 Nov 2015 19:32:26 +0000 (11:32 -0800)]
Fix invalid DCHECK
Summary: There's a race between insert() and erase(): as soon as insert()
releases the lock (swaps kLockedKey_ with the actual key), an erase() might
jump in and invalidate the key.
As far as I can tell, this bug existed since the beginning.
Reviewed By: nbronson
Differential Revision:
D2673099
fb-gh-sync-id:
4721893d2ad4836e11acc0fb4ecb0dd7b2b69be1
Andrii Grynenko [Thu, 19 Nov 2015 19:30:20 +0000 (11:30 -0800)]
Fix folly::ThreadLocal to work in a shared library
Reviewed By: bmaurer
Differential Revision:
D2667499
fb-gh-sync-id:
463f86752240bd88761910de934ba25d6e62fafe
Kyle Nekritz [Wed, 18 Nov 2015 18:20:14 +0000 (10:20 -0800)]
Add getUnderlyingTransport to AsyncTransportWrapper.
Summary: Inspired by getSocketFromTransport from proxygen.
Reviewed By: siyengar
Differential Revision:
D2663937
fb-gh-sync-id:
f076215907cd06d6da3de033c57eec8a6a6ce320
Tom Jackson [Tue, 17 Nov 2015 19:01:28 +0000 (11:01 -0800)]
UTF8StringPiece, wrapping boost::u8_to_u32
Summary: For handling UTF8 strings better.
Reviewed By: yfeldblum
Differential Revision:
D1956771
fb-gh-sync-id:
e074f9f2c9b472f5e619fef25d8e17296847773c
Yedidya Feldblum [Mon, 16 Nov 2015 10:07:19 +0000 (02:07 -0800)]
Simplify some checks by using __CLANG_PREREQ
Summary: [Folly] Simplify some checks by using `__CLANG_PREREQ`.
Reviewed By: meyering
Differential Revision:
D2657979
fb-gh-sync-id:
80ff56bbab0e78465d71315b729ad14a09706ed5
Yedidya Feldblum [Sun, 15 Nov 2015 19:52:43 +0000 (11:52 -0800)]
Simplify some checks by using __CLANG_PREREQ
Summary: [Folly] Simplify some checks by using `__CLANG_PREREQ`.
Reviewed By: meyering
Differential Revision:
D2656842
fb-gh-sync-id:
e762fba423fb7cc08907d10dc10f8f46d93a9fe4
Andrii Grynenko [Fri, 13 Nov 2015 21:47:27 +0000 (13:47 -0800)]
Make collect work for types with no default constructors
Summary: This doesn't make the code less efficient, because RVO can't be used for CollectVariadicContext. Thus moving existing tuple vs constructing new tuple by moving all values from other tuple (where each value is wrapped in folly::Optional) should be pretty much the same.
Reviewed By: hannesr
Differential Revision:
D2650293
fb-gh-sync-id:
648a358bf093a0bb9d058a997af9bf59014ad77c
Yang Chi [Thu, 12 Nov 2015 23:34:45 +0000 (15:34 -0800)]
Allow a AsyncSocket to be corked the whole time
Summary: Add a new method to cork a socket in a persistent manner, instead of the current on-off manner. This is default to false. The liger part of turning this on will be in a separate diff.
I thought about whether I need to turn cork off based on some criteria to alleviate the perf degradation. The obvious things I can think off is just amount of data written as a threshold, or a timeout. But TCP is doing this already for us, unless we want the data threshold to be less than MSS, or we want the timeout to be less than 200ms. THoughts?
Reviewed By: shikong
Differential Revision:
D2639260
fb-gh-sync-id:
2821f669c9f72d5ac4c33195bb192fc4110ffe9d
Giuseppe Ottaviano [Thu, 12 Nov 2015 16:37:48 +0000 (08:37 -0800)]
Make Malloc.h self-contained
Reviewed By: philippv
Differential Revision:
D2643313
fb-gh-sync-id:
10b9f735725ce47fab4bbfaa5972b3863357365f
Giuseppe Ottaviano [Thu, 12 Nov 2015 16:37:14 +0000 (08:37 -0800)]
Disable assertions in FBString when used as std::string
Reviewed By: Gownta
Differential Revision:
D2643850
fb-gh-sync-id:
2c4bb844ea2006215b0637cb1ba08c636faefe05
Chad Parry [Thu, 12 Nov 2015 00:02:35 +0000 (16:02 -0800)]
Restore the definition of HHWheelTimer::UniquePtr
Summary: Changing the definition of `HHWheelTimer::UniquePtr` wasn't safe, because some clients were using that type outside of the `HHWheelTimer::newTimer` helper. I'm changing that part back. We'll still be able to proceed with my other codemod to `HHWheelTimer`, but we'll always have two different smart pointer types to manage: `UniquePtr` and `IntrusivePtr`.
Reviewed By: djwatson
Differential Revision:
D2644721
fb-gh-sync-id:
14685be62355f09d39c4139ef7186d60b5f48dcd
Stepan Palamarchuk [Wed, 11 Nov 2015 22:22:01 +0000 (14:22 -0800)]
Make Optional nothrow_default_constructible
Summary: It never throws.
Reviewed By: pavlo-fb
Differential Revision:
D2640886
fb-gh-sync-id:
cd643f8847f4bf5619415731484f91fb07116784
Yang Chi [Wed, 11 Nov 2015 21:32:04 +0000 (13:32 -0800)]
Add a buffer callback to AsyncSocket
Summary: This is probably easier than
D2612490. The idea is just to add a callback to write, writev and writeChain in AsyncSocket, so upper layer can know when data starts to buffer up
Reviewed By: mzlee
Differential Revision:
D2623385
fb-gh-sync-id:
98d32ca83871aaa4f6c75a769b5f1bf0b5d62c3e
Chad Parry [Wed, 11 Nov 2015 19:29:28 +0000 (11:29 -0800)]
Improve the DelayedDestruction smart pointer
Summary: There have been several ASAN bugs cropping up because the lifetime of an `HHWheelTimer` is not being manager properly. I think that people are too comfortable passing around a raw `HHWheelTimer*` even when it is difficult to prove correctness. The recommended solution used to be to create a `DestructorGuard` every time it was needed. There is enough friction there that not everyone is doing that like they should. We should make resource management easier---as easy as using raw pointers, in fact.
I've fixed the broken copy semantics of `DestructorGuard` and added the operators that allow it to be used as a smart pointer. I added the `IntrusivePtr` helper that can manage an arbitrary derived class of `DelayedDestructionBase`. Now, clients can all safely pass around an `IntrusivePtr` everywhere they used to use a raw pointer. They will get automatic resource management for free.
If you are not convinced that `DestructorGuard` should be changed, then note that the existing behavior is dangerously buggy. Consider the following innocent code that accidentally uses the implicitly-defined copy constructor:
auto d = DestructorGuard(p);
This results in undefined behavior, because `p` can be accessed after it is destroyed! The bug happens because the default copy constructor copies the raw pointer but doesn't increment the count.
In a separate diff, I'll change all clients who pass around a raw `HHWheelTimer*` to use an `IntrusivePtr<HHWheelTimer>` instead. Then we can even entertain a long-term plan of switching from intrusive pointers to the standard `shared_ptr`.
Reviewed By: djwatson
Differential Revision:
D2627941
fb-gh-sync-id:
58a934d64540d0bbab334adc4f23d31d507692da
Shaft Wu [Wed, 11 Nov 2015 04:40:17 +0000 (20:40 -0800)]
UNSYNCHRONIZED does NOT unlock the mutex
Summary: My colleague tuomaspelkonen discovered a weird UNSYNCHRONIZED issue a few weeks ago and we ever since stopped using it. Now I finally have some time to root cause it. It turns out UNSYNCHRONIZED unlock the mutex then lock the mutex again, because it copy constructs LockedPtr for overriding the name within the scope, and copy construct locks the mutex again. A one character fix here is to take a reference of LockedPtr instead of copy construct it. However since this is my first time look at the code here, please advise if this is horribly wrong or propose better fix. Also added a test to reproduce the issue without the fix as well as verify the fix.
Reviewed By: yfeldblum
Differential Revision:
D2633028
fb-gh-sync-id:
a9e8d39b08d4d1265979f8bdaae83619566d10a0
Alexander Shaposhnikov [Wed, 11 Nov 2015 03:11:56 +0000 (19:11 -0800)]
Revert my change (which broke down the cont build)
Summary: hg backout -r
c9f7b5f3185a
Revert my change (which broke down the cont build t9048692)
Reviewed By: djwatson
Differential Revision:
D2640797
fb-gh-sync-id:
51f196ac5a3560fde4dc8fe7bb6ef278d74136e5
Alexander Shaposhnikov [Tue, 10 Nov 2015 23:42:18 +0000 (15:42 -0800)]
Remove busy wait
Summary: Wait uses baton & callback running baton.post
when the original future is ready. However wrapping baton.post
with a funciton call (preparing a new value) adds the following race: baton.wait wakes up
before that function has call actually finished.
The explanation is the following: to prepare the value of the new future it's necessary
1. baton.post() 2. set the value (move constructor, memory operations, ...)
and this code is executed in a separate thread.
The main idea of this fix is to avoid creating a new future
(whose value is calculated using that 2-step procedure)
and set a callback instead. This callback will be executed when the future is ready and actually
it either will be the last step of promise.setValue or it will run immediately if the future
we are waiting for already contains a value.
Reviewed By: fugalh
Differential Revision:
D2636409
fb-gh-sync-id:
df3e9bbcc56a5fac5834ffecc63f1bcb94ace02c
Shijin Kong [Tue, 10 Nov 2015 23:06:52 +0000 (15:06 -0800)]
change log error back to check when pipe read fail in notification queue
Summary: Revert
D2632752
Reviewed By: afrind
Differential Revision:
D2638974
fb-gh-sync-id:
43d8135421510db7840a99f3c197119a0fd26c09
Steve O'Brien [Tue, 10 Nov 2015 14:28:14 +0000 (06:28 -0800)]
FBString: fix constructors so it compiles with newer Clang's
Summary: Using Clang 3.7, this minimal test program:
#include <folly/FBString.h>
struct S { folly::basic_fbstring<char> x; };
int main(int argc, char *argv[]) {
S s {};
return 0;
}
... breaks with the following error output:
FBStringTest.cpp:5:8: error: chosen constructor is explicit in copy-initialization
S s {};
^
./folly/FBString.h:1009:12: note: constructor declared here
explicit basic_fbstring(const A& = A()) noexcept {
^
FBStringTest.cpp:3:40: note: in implicit initialization of field 'x' with omitted initializer
struct S { folly::basic_fbstring<char> x; };
... because this `basic_fbstring` is used in a struct and the struct is being default-constructed.
This patch splits the (nevertheless-correct) one-default-arg constructor into two, to deconfuse clang and have it select the correct constructor to avoid this issue.
Reviewed By: matbd
Differential Revision:
D2632953
fb-gh-sync-id:
2c75ae85732678c31543f5cccc73d58317982f07
Shijin Kong [Mon, 9 Nov 2015 21:09:58 +0000 (13:09 -0800)]
change CHECK to LOG(ERROR) when pipe read error on NotificationQueue
Summary: The check was originally added to track down cpu pinning issue. In reality the check did get triggered, so change to soft error to calm the crazy nag bot. what's wrong with you.
We need to see the soft error log to find out what the error is.
Reviewed By: mzlee
Differential Revision:
D2632752
fb-gh-sync-id:
87c11b186f97f0eb4a6c5ac13a1117b280198673
Alexey Spiridonov [Mon, 9 Nov 2015 19:16:11 +0000 (11:16 -0800)]
Add a tag type for in-place construction
Summary: Without this tag type, it's impossible to use `Synchronized` with types like:
```
struct A {
A(int, const char*);
A(const A&) = delete;
A& operator=(const A&) = delete;
A(A&&) = delete;
A& operator=(A&&) = delete;
};
```
In-place construction solves this problem. Usage:
```
Synchronized a(construct_in_place, 5, "c");
```
Reviewed By: nbronson
Differential Revision:
D2610071
fb-gh-sync-id:
251fe8f8f6a2d7484dda64cf04dcacb998145230
Chad Parry [Mon, 9 Nov 2015 18:39:22 +0000 (10:39 -0800)]
Make sure there are no outstanding timers in the destructor
Summary: This is the solution for our `HHWheelTimer` crashes, as suggested in
D2617966#25.
djwatson also mentioned that maybe there should be some logging in the destructor if there are outstanding callbacks. I couldn't think of anything that would add to the `assert` that already exists in `destroy`. I'm open to suggestions though.
Reviewed By: djwatson
Differential Revision:
D2628154
fb-gh-sync-id:
f3db6e9384517c9bf3cbb60af8c1e711703a07fa
Igor Sugak [Sun, 8 Nov 2015 08:32:52 +0000 (00:32 -0800)]
folly/portability: add clang version check
Summary: Define `__CLANG_PREREQ` macro to check version of clang.
Reviewed By: yfeldblum
Differential Revision:
D2630325
fb-gh-sync-id:
3d666e554e8ddfc2c1fecd439aaf93f015829025
Chad Parry [Fri, 6 Nov 2015 19:52:10 +0000 (11:52 -0800)]
Callbacks should ref the HHWheelTimer
Summary: Callbacks sometimes outlive the `HHWheelTimer` that they reference. Then the `Callback` tries to reference the dead `HHWheelTimer` and it could either misbehave or crash. This was caught reliably by ASAN tests.
Since `HHWheelTimer` already supports intrusive ref counting, the solution is to acquire a reference within the `Callback`.
Reviewed By: djwatson
Differential Revision:
D2617966
fb-gh-sync-id:
02be9ffc5851c269d5933288a17ad394b33ac2dd
Jon Maltiel Swenson [Fri, 6 Nov 2015 02:54:38 +0000 (18:54 -0800)]
Cancel timeout only if not run
Summary: Do not cancel TimeoutHandler timeout if the timeout has already run.
Reviewed By: spalamarchuk
Differential Revision:
D2622280
fb-gh-sync-id:
27d83b44ab225e2859695f4e5f21cef934824a35
Haijun Zhu [Thu, 5 Nov 2015 18:36:46 +0000 (10:36 -0800)]
codemod setMaxNumMessagesInQueue to setMaxNumPendingConnectionsPerWorker
Summary: This name's meaning is very obscure, this method actually sets the
queue size of each acceptor and if all acceptor's queues are full the
connection will be dropped. Change it to a more meaningful name.
Reviewed By: alandau
Differential Revision:
D2613681
fb-gh-sync-id:
baa374cdf0a87c460df3dd5687e3d755b55f4b4f
Jon Maltiel Swenson [Thu, 5 Nov 2015 15:24:16 +0000 (07:24 -0800)]
Activate server timeout after write success
Summary: Start server timeout after socket write succeeds in mcrouter. Add neceessary Fibers logic to enable this behavior.
Reviewed By: pavlo-fb
Differential Revision:
D2613344
fb-gh-sync-id:
1bc0fbe8b325a3e91cd010f89104b83ebf183679
Viswanath Sivakumar [Thu, 5 Nov 2015 11:48:26 +0000 (03:48 -0800)]
Set interrupt handler correctly on SharedPromise
Summary: If SharedPromise::getFuture() is invoked after a call to setInterruptHandler,
then the interrupt handler isn't set on the newly created promise. This diff
fixes that.
Reviewed By: yfeldblum
Differential Revision:
D2610289
fb-gh-sync-id:
bf8fce9e881b83ccac17d13c6788ec2afd0b0153
Subodh Iyengar [Wed, 4 Nov 2015 05:38:07 +0000 (21:38 -0800)]
Add ability to get application protocol from AsyncTransportWrapper
Summary: Allows AsyncTransportWrapper's to supply the underlying application
protocol being used, for example using NPN for SSL or some other
generic protocol indication mechanism.
Reviewed By: ranjeeth
Differential Revision:
D2614179
fb-gh-sync-id:
2079782bb7d44f898fb14c7df15077209b022424
Zhen (Growth) Li [Wed, 4 Nov 2015 01:31:55 +0000 (17:31 -0800)]
switch the IndexType and Allocator in AtomicUnorderedInsertMap template
Summary: Our use case need to have the IndexType Configurable, but in this diff
D2583752, lint error shows
Code from folly::detail is logically private, please avoid use outside of folly.
In order to fix this lint error, I switch the IndexType and Allocator in the AtomicUnorderedInsertMap template.
Reviewed By: nbronson
Differential Revision:
D2610921
fb-gh-sync-id:
ae81b41e7c8c971f26c61b8c67dabeadff379584
Subodh Iyengar [Wed, 4 Nov 2015 01:19:40 +0000 (17:19 -0800)]
Allow underlying transport to be accessible from AsyncTransportWrapper
Summary: Allow underlying transport to be accessible from AsyncTransportWrapper.
There are some code paths where we need access to the real transport from
the AsyncTransportWrapper. This allows us to retrieve the underlying transport
and have clients like HTTPSession use it.
Reviewed By: afrind
Differential Revision:
D2609200
fb-gh-sync-id:
2b317d1825a005bb64468f83c64bc3f1c9bdfe2c
Louis Brandy [Wed, 4 Nov 2015 01:13:54 +0000 (17:13 -0800)]
make folly slightly more c++-modules friendly
Summary: .. by including what you use.
These are a handful of headers that are depended on via viral inclusion. Include them directly.
Reviewed By: yfeldblum
Differential Revision:
D2601172
fb-gh-sync-id:
215e87263325d085fbcb651f83f429f47d14fc1b
Louis Brandy [Tue, 3 Nov 2015 20:30:27 +0000 (12:30 -0800)]
qualify std::move in StringKeyedTest
Summary: Prefer `std::move` to `move` for clarity's sake.
Reviewed By: yfeldblum
Differential Revision:
D2601138
fb-gh-sync-id:
64a9e58a83da9c8416a0be5c45a292c6b1342664
Anton Likhtarov [Tue, 3 Nov 2015 18:45:21 +0000 (10:45 -0800)]
Disallow nullptr literal in StringPiece constructor
Summary: This disallows implicitly constructing a StringPiece from a literal nullptr at compile time
(without this change, nullptr would cause a segfault in strlen()).
Reviewed By: meyering, andriigrynenko
Differential Revision:
D2603597
fb-gh-sync-id:
cafbc45945bacc72a7c89310b99aa62d19a3ff9f
Andrew Gallagher [Sat, 31 Oct 2015 21:42:53 +0000 (14:42 -0700)]
Fix multi-line comment warnings
Summary: Fix warnings triggered by `-Wcomment`.
Reviewed By: ajtulloch
Differential Revision:
D2603992
fb-gh-sync-id:
aae721f7c236d7d8b8bff2c077a481fc2affcf71
Delyan Kratunov [Fri, 30 Oct 2015 21:59:54 +0000 (14:59 -0700)]
Add writeAndGetCursor to LockFreeRingBuffer
Summary: New API - write an entry and advance a cursor to the just-written slot.
Reviewed By: ritzau, yfeldblum
Differential Revision:
D2599388
fb-gh-sync-id:
f3ebfae97de0341f01ffc80ab10221313d02087c
Jon Maltiel Swenson [Fri, 30 Oct 2015 00:16:08 +0000 (17:16 -0700)]
Periodically reclaim unnecessary fibers from free pool
Summary: Reclaim unnecessary fibers from the free pool periodically. Turn this behavior
on in mcrouter/proxy.cpp
Reviewed By: pavlo-fb
Differential Revision:
D2584825
fb-gh-sync-id:
eabc58eefe6fd38972c9e23ca3cbe79eb8316a3e
Justin Gibbs [Thu, 29 Oct 2015 21:35:22 +0000 (14:35 -0700)]
Prefer template aliases to classes in IntrusiveList
Summary: Convert helper classes to using statements now that GCC has caught up
with c++11.
Reviewed By: simpkins
Differential Revision:
D2561364
fb-gh-sync-id:
712591549aba9450d159468dc3b26a987ffe9b82
Andrii Grynenko [Thu, 29 Oct 2015 21:33:02 +0000 (14:33 -0700)]
Remove DFATAL from folly::Singleton::try_get()
Summary: try_get() API is confusing right now, because it returns nullptr in release, but crashes in debug build. Users end up handling nullptr returns, yet their code crashes in debug builds for no reason. See https://www.facebook.com/groups/fbthrift/permalink/
1222120054481561/ for an example.
If we want to keep the crashing API we should probably name it differently and make it crash both in debug and release.
Reviewed By: dhruvbird
Differential Revision:
D2587818
fb-gh-sync-id:
5834bfa08eb5d9bc6db1c5edf4a048a5b1d3212c
Xiaofan Yang [Thu, 29 Oct 2015 19:27:58 +0000 (12:27 -0700)]
add config to allow using quadratic probing
Summary: In my use case, 1.5 billion keys with loadFactor 0.8, the linear probing performs really bad.
Reviewed By: nbronson
Differential Revision:
D2579243
fb-gh-sync-id:
5081356de55f770823a4afad55bf7e2114b4e313
Pavlo Kushnir [Thu, 29 Oct 2015 00:15:19 +0000 (17:15 -0700)]
Do not set startWork_ in EventBase if time measurement is disabled
Summary: startWork_ is used only if enableTimeMeasurement is set. It gives ~0.5% performance win for mcrouter.
Reviewed By: yfeldblum
Differential Revision:
D2590176
fb-gh-sync-id:
07f2189ebdec751cd0d91d191d8f595780d2808a
Blake Matheny [Wed, 28 Oct 2015 18:07:40 +0000 (11:07 -0700)]
Suppress -Wshadow for SYNCHRONIZED
Summary: SYNCHRONIZED warns with -Wshadow due to `for (auto&
FB_ARG_1(__VA_ARGS__) =`. This diff just suppresses that warning.
Reviewed By: djwatson
Differential Revision:
D2587348
fb-gh-sync-id:
3a2e39fb6ce28da014950ca94e4b62ea80deb65f
Beny Luo [Wed, 28 Oct 2015 00:41:18 +0000 (17:41 -0700)]
Fix clang issue on NotificationQueue::size
Summary: The implicit conversion loses integer precision: 'size_type' (aka 'unsigned
long') to 'int'.
Reviewed By: mzlee
Differential Revision:
D2585883
fb-gh-sync-id:
1fc7c84b66c8f19cc36b798dd198730764e19b28
Shaft Wu [Tue, 27 Oct 2015 04:14:10 +0000 (21:14 -0700)]
Track callback life cycle for HHWheelTimer and EventBase
Summary: Further race is presented in HHWheelTimer and EventBase, since changing them to track callback life cycle is more involving, I am hacking around it to prove the concept. With the *fix*, no reproduce of the segmentation fault anymore.
This is for proving the concept, code will be cleaned up if we agree this is reasonable direction to pursue.
Reviewed By: fugalh
Differential Revision:
D2577715
fb-gh-sync-id:
e0bb0317268e6f02a54fc70454e63959fba70c10
Jun Li [Tue, 27 Oct 2015 00:40:17 +0000 (17:40 -0700)]
Expose pending messages in queue stats in AsyncServerSocket
Summary: Expose pending messages in accept queue in AsyncServerSocket.
Set default accept message queue size to 1024.
Reviewed By: djwatson
Differential Revision:
D2525161
fb-gh-sync-id:
a69ea0ee77729e4a8300bde3e3c07840f2d5d3cb
Lucian Grijincu [Mon, 26 Oct 2015 22:50:26 +0000 (15:50 -0700)]
folly: hash: specialize hash_combine_generic by size_t size
Reviewed By: yangliu
Differential Revision:
D2578043
fb-gh-sync-id:
cec8f21219655a495b99d0b6b99f0925615bc068
Florent Thoumie [Mon, 26 Oct 2015 21:53:03 +0000 (14:53 -0700)]
Add new toBinary() function to IPAddress.
Summary: This is pretty much the reverse operation from the fromBinary() constructor.
Reviewed By: yfeldblum
Differential Revision:
D2578680
fb-gh-sync-id:
d8c4e53fe8bc0f5373ebb0b4f7ee498659c1b003
Yedidya Feldblum [Mon, 26 Oct 2015 19:09:38 +0000 (12:09 -0700)]
Style nits for folly/test/FingerprintBenchmark.cpp
Summary: [Folly] Style nits for `folly/test/FingerprintBenchmark.cpp`.
Reviewed By: Gownta
Differential Revision:
D2579463
fb-gh-sync-id:
135bc3ef43708cb024f78c59672811159d2163e0
Mohammad Husain [Mon, 26 Oct 2015 18:56:02 +0000 (11:56 -0700)]
Rename two callback function names of ConnectionEventCallback
Summary: Renaming `EnqueuedForAccept` and `DequeuedByAccept` to
`EnqueuedForAcceptor` and `DequeuedByAcceptor` respectively to make it clear
that the connection is queued for the Acceptor not to call `accept` on.
Reviewed By: yfeldblum
Differential Revision:
D2554578
fb-gh-sync-id:
072a9ff122658827d1e89f2bef79ad565dad7974
Shijin Kong [Mon, 26 Oct 2015 17:15:45 +0000 (10:15 -0700)]
return read error on non EAGAIN errno
Summary: Tested over weekend with
D2571554. There was no EXC_RESOURCE/CPU crash when read errrors were returned on ENOTCONN. EAGAIN seems innocent as the spin detector was disabled on testing group.
Patch folly. I can add #ifdef __APPLE__ around the errno checking code but this should be good practice for non apple code as well.
I will remove debugging code in fbios master in another diff.
Reviewed By: djwatson
Differential Revision:
D2580819
fb-gh-sync-id:
9162a3deba01af8b07cd2b336d7da3da040c67a9
Nathan Bronson [Sat, 24 Oct 2015 02:48:25 +0000 (19:48 -0700)]
fix AtomicUnorderedInsertMap load factor computation
Summary: AtomicUnorderedInsertMap's constructor takes a maxLoadFactor argument,
which is given its default argument of 0.8f in all of our code.
The clipping function that was supposed to prevent load factors
greater than one was inverted, resulting in all of our code using a
maxLoadFactor of 1 instead of 0.8. This diff fixes the computation,
as well as changing all of the use sites so that the actual memory
allocated by existing clients does not change.
Reviewed By: yfeldblum
Differential Revision:
D2575238
fb-gh-sync-id:
bb9dd8de53114236b259631d175d62af098391cf
Jon Maltiel Swenson [Fri, 23 Oct 2015 21:44:22 +0000 (14:44 -0700)]
Fibers allocation/deallocation benchmarks
Summary: Add a couple benchmarks measuring allocation/deallocation latency. One benchmark measures an allocate-deallocate repeated pattern, the other measures the allocation of a large chunk of fibers.
We'll use these benchmarks later on after we modify the allocation/deallocation behavior of fibers.
Reviewed By: pavlo-fb
Differential Revision:
D2573064
fb-gh-sync-id:
414eb93d6223e42c187c03214a47dfb533491bab
Bartosz Nitka [Fri, 23 Oct 2015 18:42:05 +0000 (11:42 -0700)]
Option to fallback to double when int precision is not enough.
Summary: Some libraries like Haskell's `Data.Aeson` can produce arbitrarily
big numbers with arbitrary precision.
The json standard doesn't specify the ranges for numeric types.
For interoperability, we should allow the user to parse the numbers with
some loss of precision.
Reviewed By: luciang
Differential Revision:
D2565140
fb-gh-sync-id:
b1a9a46e298bf13cc89d7e79ce28705e9e251a7f
Nathan Bronson [Fri, 23 Oct 2015 14:23:37 +0000 (07:23 -0700)]
templatize AtomicUnorderedInsertMap's internals to allow big maps
Summary: AtomicUnorderedInsertMap used 32 bit index values internally. 2 bits
were stolen, limiting the capacity to 2^30. This diff makes the internal
index type a template parameter, so you can make really big maps if you
want (at the expense of bigger map overhead). The easiest way is to
substitute AtomicUnorderedInsertMap64.
Reviewed By: yfeldblum
Differential Revision:
D2574338
fb-gh-sync-id:
a74994b6da1046a149c2e7763c3dc19e35d9840b
Alan Frindell [Thu, 22 Oct 2015 20:12:58 +0000 (13:12 -0700)]
Fix infinite loop in Cursor::readTerminatedString
Summary: readTerminatedString could infinite loop if the terminator does not appear in the contained IOBuf chain and maxLength > chain.computeChainLength. I'm throwing out_of_range here because that more closely mirrors what the other read() functions do.
Reviewed By: siyengar
Differential Revision:
D2571039
fb-gh-sync-id:
1db22089562d8767920d66a0a1b091b02de6571f
Giuseppe Ottaviano [Thu, 22 Oct 2015 19:11:59 +0000 (12:11 -0700)]
Clang support for constexpr StringPiece constructor
Summary: Clang's `strlen` is not `constexpr`, but `__builtin_strlen` is, so we can have an unconditional `constexpr` `StringPiece` constructor.
Reviewed By: luciang, yfeldblum
Differential Revision:
D2561782
fb-gh-sync-id:
51e76a0d50355cc5ead1148ba2389b640a6888de
Yaacov Akiba Slama [Thu, 22 Oct 2015 05:30:22 +0000 (22:30 -0700)]
Fix gcc 5.2 compilation when _GLIBCXX_USE_CXX11_ABI is not 0
Summary: Tested in debian stretch when used in hhvm which can now run drupal 7.
The compilation error is also fixed by #214 but this fix maintains
forward declarations of basic_string and list.
Closes https://github.com/facebook/folly/pull/329
Reviewed By: yfeldblum
Differential Revision:
D2533880
fb-gh-sync-id:
85e18eeeba9efa1b4150217ba526b32b5573e15e
Philip Pronin [Wed, 21 Oct 2015 19:02:38 +0000 (12:02 -0700)]
fix "iocb" reporting in AsyncIO
Summary: A few fields were swapped, and we had unintentionall fallthrough in
switch.
Reviewed By: luciang
Differential Revision:
D2565884
fb-gh-sync-id:
8ad71c090c5120e99c672f785aaefdef03469ee2
Rameshkumar Shihora [Wed, 21 Oct 2015 18:31:52 +0000 (11:31 -0700)]
Move FingerprintBenchmark to Folly
Summary: FingerprintBenchmark was in an internal directory before, but it belongs alongside the Fingerprint code.
Reviewed By: yfeldblum
Differential Revision:
D2534646
fb-gh-sync-id:
d8ded3a5a9d33f60e9674ea71dc87a2d8d19a51b
Andrii Grynenko [Wed, 21 Oct 2015 02:34:57 +0000 (19:34 -0700)]
Improve folly::Singleton try_get perf and bring back raw get benchmark
Reviewed By: elsteveogrande
Differential Revision:
D2517522
fb-gh-sync-id:
eab11d17ce5db94e09aa733b6067e44d36be6345
Petr Lapukhov [Tue, 20 Oct 2015 22:30:55 +0000 (15:30 -0700)]
Add support for in-place creation of NotificationQueue::Consumer
Summary: as title, this comes handy when multiple consumers are needed
within the same class.
Reviewed By: has
Differential Revision:
D2530249
fb-gh-sync-id:
942761782a100b2d3fe54d94a7c1b0e03b95a847
Emil Hesslow [Tue, 20 Oct 2015 21:52:07 +0000 (14:52 -0700)]
Add getIPv6For6To4 to IPAddressV4
Summary: - I added this in PHP (
D2534138 ) so add it here too
- This is my first folly diff so I probably done something wrong :)
Reviewed By: yfeldblum
Differential Revision:
D2549168
fb-gh-sync-id:
5e6a80097be01fb54342e0c9da5b69465f695f80
Jon Maltiel Swenson [Tue, 20 Oct 2015 03:18:30 +0000 (20:18 -0700)]
Bring zstd support into folly/io/Compression.h
Summary: Bring zstd support into folly/io/Compression.h
Reviewed By: chipturner
Differential Revision:
D2551026
fb-gh-sync-id:
7c13338d45efb0fc19f0b44015c7e62d945a483b
Bruno Goncalves [Sat, 17 Oct 2015 02:03:22 +0000 (19:03 -0700)]
Remove boost dependency from folly/ProducerConsumerQueue.h
Summary: Boost is great, but c++11 incorporate some of their stuffs, and classes like ProducerConsumerQueue don't need it anymore.
Closes https://github.com/facebook/folly/pull/321
Reviewed By: fredemmott, yfeldblum
Differential Revision:
D2519081
fb-gh-sync-id:
b138a5af4662d1e7ef5e0823cf4001880ee02456
Ranjeeth Dasineni [Sat, 17 Oct 2015 00:22:49 +0000 (17:22 -0700)]
Change NotificationQueue assert -> CHECK
Summary: If the eventFd goes bad, NotificationQueue consumers can cause their event loop to spin indefinitely. If libevent gets POLLERR on the fd, it calls handlerReady, which triggers a read. The read will fail, but the callback is never uninstalled. I'm not sure it would be easy to recover gracefully from this, so crash hard instead.
Reviewed By: yfeldblum, pgriess
Differential Revision:
D2550270
fb-gh-sync-id:
c9575fbda778b3625da6d9db6b0542b8263f230a
Kyle Nekritz [Fri, 16 Oct 2015 22:57:07 +0000 (15:57 -0700)]
Commiting missing header file change from
D2408773
Summary: AsyncSSLSocket.h change was not synced from
D2408773 /
f7176051f816980a985beeb9b8a907dddd0dc0e3.
Test Plan: file matches
D2408773
Reviewers:
CC:
Task ID: #
Blame Rev:
Nathan Bronson [Fri, 16 Oct 2015 21:27:11 +0000 (14:27 -0700)]
fix initializer order bug in MemoryIdler
Summary: Make sure page size has been fetched from the operating system
before it is used in asserts.
Reviewed By: meyering
Differential Revision:
D2551368
fb-gh-sync-id:
d3735571e2a45f613bbbd7e0f158a755d36b376c
Yedidya Feldblum [Fri, 16 Oct 2015 19:46:00 +0000 (12:46 -0700)]
Avoid the ODR issue with ThreadLocalDetail's kInvalid
Summary: [Folly] Avoid the ODR issue with `ThreadLocalDetail`'s `kInvalid`.
The problem is that it is a `static constexpr` class member, so pull it out of the class.
Reviewed By: bmaurer
Differential Revision:
D2549272
fb-gh-sync-id:
28a73e73b9cf9f21bee2bba2125513c02ef56ce2
Madhu Ramanathan [Fri, 16 Oct 2015 18:07:24 +0000 (11:07 -0700)]
Reverting
D2503151 to unbreak buck build
Summary: This breaks buck build. Reverting till the fix is in to unblock build pipeline.
Reviewed By: jmswen
Differential Revision:
D2550685
fb-gh-sync-id:
7623e6c7fcaad70d7d207ec10a59f7381c72cebc
Jon Maltiel Swenson [Fri, 16 Oct 2015 16:42:43 +0000 (09:42 -0700)]
Bring ZSTD support into folly/io/Compression.h
Summary: Bring ZSTD support into folly/io/Compression.h
Reviewed By: chipturner
Differential Revision:
D2503151
fb-gh-sync-id:
c1450cecc8197db654b7a080a63753caa666f686
Aaron Roth [Fri, 16 Oct 2015 14:54:02 +0000 (07:54 -0700)]
Missed some derivation from boost::noncopyable after deleting the .hpp header.
Summary: There remained some derivations from boost::noncopyable in inner classes after boost/noncopyable.hpp was deleted in
D2459355. Get rid of these two.
Reviewed By: meyering
Differential Revision:
D2485930
fb-gh-sync-id:
89546490b15fa4279debf4b9cabcf48d3dc336bb
Mohammad Husain [Fri, 16 Oct 2015 04:13:25 +0000 (21:13 -0700)]
Add connection event callback to AsyncServerSocket
Summary: Adding a callback to AsyncServerSocket to get notified of client connection events. This can be used for example to record stats about these events.
Reviewed By: @afrind
Differential Revision:
D2544776
fb-gh-sync-id:
20d22cfc939c5b937abec2b600c10b7228923ff3
Lucian Grijincu [Fri, 16 Oct 2015 03:04:34 +0000 (20:04 -0700)]
folly: Symbolizer: don't colorize TERM="dumb" or TERM="" or TERM-undefined TTYs
Reviewed By: @dcolascione
Differential Revision:
D2548486
fb-gh-sync-id:
6e2d7e84598eb5b05aba7a262b7c53532337dbe3
Lucian Grijincu [Fri, 16 Oct 2015 02:17:30 +0000 (19:17 -0700)]
folly: Symbolizer: don't allocate from function which is supposed to be signal safe
Reviewed By: @philippv, @dcolascione
Differential Revision:
D2548023
fb-gh-sync-id:
d2b0571d5db03e38ed17a5de6a13d2194a05b2b9
Yedidya Feldblum [Fri, 16 Oct 2015 01:55:27 +0000 (18:55 -0700)]
Specialize and implement setThreadName only on some platforms
Summary: [Folly] Specialize and implement `setThreadName` only on some platforms.
With this technique, we can compile setThreadName and programs that call it on MSVC/Windows and on other platforms that don't have the underlying pthread call.
This is an alternative to: https://reviews.facebook.net/D46317.
Reviewed By: @nbronson
Differential Revision:
D2535593
fb-gh-sync-id:
09d26f53e3fe69b49326b5b6492a7d59f86db2e8
Jody Ho [Fri, 16 Oct 2015 01:51:01 +0000 (18:51 -0700)]
undefined reference to 'folly::threadlocal_detail::StaticMeta<void>::EntryID::kInvalid'
Summary: In some cases, folly::threadlocal_detail::StaticMeta<void>::EntryID::kInvalid
is odr-used, a definition at the namespace scope is required even though it has
been initialized with a brace-or-equal initializer.
See http://en.cppreference.com/w/cpp/language/static
Reviewed By: @yfeldblum
Differential Revision:
D2548668
fb-gh-sync-id:
9cd6d7b2f37d1481d1adbf4f0a2d9e66631efd15
Kyle Nekritz [Thu, 15 Oct 2015 15:19:48 +0000 (08:19 -0700)]
Add framework for switching certs based on signature_algorithms TLS extension.
Summary: Added support for switching SSLContexts based on the signature_algorithms
extension.
This diff does not currently include any logic for determining which certs use
SHA1 or not.
Some thoughts:
- This is a little scary since it defaults to SHA1 (assuming the client can't support
SHA256 if we don't see SHA256 specifically in the hello extension). We need to
be 100% sure that all clients that are going to reject SHA1 are sending this,
and that we identify it correctly.
- We should add logging to see when we think a client needs SHA1, when we
actually give SHA1, etc. I'm not sure what the best way to do this is with our
logging infrastructure.
- This is not setup to serve any SHA1 certs to SHA256 supporting clients.
Reviewed By: @siyengar
Differential Revision:
D2408773
fb-gh-sync-id:
48ad9cdfaae25e144c0964b9bfb1c342b137ffca
Yedidya Feldblum [Thu, 15 Oct 2015 05:39:59 +0000 (22:39 -0700)]
Fix Build: under GCC 4.9 + ASAN, RangeSse42.cpp fails to build
Summary: [Folly] Fix Build: under GCC 4.9 + ASAN, `RangeSse42.cpp` fails to build.
Reviewed By: @ldemailly, @meyering
Differential Revision:
D2544284
fb-gh-sync-id:
fd50f8b326252291ad3a5d9fe956e7e647ad0133
Subodh Iyengar [Thu, 15 Oct 2015 05:03:26 +0000 (22:03 -0700)]
Add handshake and connect times
Summary: Add api to get time taken to establish
connections and to complete handshake
for clients using AsyncSocket directly.
Reviewed By: @afrind
Differential Revision:
D2435074
fb-gh-sync-id:
f44c336e62c426736eb5b3d88dd57a18572382e8
Subodh Iyengar [Thu, 15 Oct 2015 05:01:55 +0000 (22:01 -0700)]
Ephemeral ciphers in false start list
Summary: Only include ephemeral ciphers in false start list.
Reviewed By: @​mzlee
Differential Revision:
D2429447
fb-gh-sync-id:
430d287a93249ff72b9ebe7db3bc283bb0712600
Yedidya Feldblum [Wed, 14 Oct 2015 05:08:20 +0000 (22:08 -0700)]
Fix Build: address some maybe-uninitialized warnings in folly/test/StringTest.cpp
Summary: [Folly] Fix Build: address some `maybe-uninitialized` warnings in `folly/test/StringTest.cpp`.
Reviewed By: @meyering
Differential Revision:
D2535743
fb-gh-sync-id:
fa6a071436d22169e2be69cec1abae19851657d2
Yedidya Feldblum [Wed, 14 Oct 2015 00:28:55 +0000 (17:28 -0700)]
Fix Build: address some maybe-uninitialized warnings in folly/io/async/EventBase.cpp
Summary: [Folly] Fix Build: address some `maybe-uninitialized` warnings in `folly/io/async/EventBase.cpp`.
Reviewed By: @meyering
Differential Revision:
D2535753
fb-gh-sync-id:
ff32f6957675d3b6d0267b1a59fb0c3aac4fe86e
Orvid King [Tue, 13 Oct 2015 22:26:52 +0000 (15:26 -0700)]
Handle less_than_impl and greater_than_impl under MSVC
Summary: MSVC chokes on the template constraints of these functions, so use a single implementation that will be const-folded by the optimizer instead.
Closes https://github.com/facebook/folly/pull/281
Reviewed By: @yfeldblum
Differential Revision:
D2419069
fb-gh-sync-id:
c9ad3d135430f8265bbc90391b45d9295d6de362
Hans Fugal [Tue, 13 Oct 2015 21:20:21 +0000 (14:20 -0700)]
(folly) have Try::moveFromTry take an lvalue
Summary: This is a case of having to say what you're doing twice, and it's unnecessary.
This change should not break anything as calling `std::move(lvalue)` where an
lvalue reference is expected will just be superfluous.
Reviewed By: @jsedgwick
Differential Revision:
D2534944
fb-gh-sync-id:
fdcd168f369d95b0f28abe23b401b4321f51fc36
Nathan Bronson [Tue, 13 Oct 2015 21:07:12 +0000 (14:07 -0700)]
never destroy LifoSem's wait node pool
Summary: Some LifoSem-s survive late into program execution, which means
that destroying the IndexedMemPool that holds LifoSem waiter nodes can
cause crashes during program shutdown.
Reviewed By: @chadparry
Differential Revision:
D2536597
fb-gh-sync-id:
c9b3b73b61f2b8bdcb00d03f4c6d3daf24b267c3
Orvid King [Tue, 13 Oct 2015 18:58:18 +0000 (11:58 -0700)]
Don't do memory operations in chunks on MSVC
Summary: Because, especially with the way that munmap is implemented in my windows port, this is a very bad idea. Plus, it's completely unnecessary on Windows.
Closes https://github.com/facebook/folly/pull/265
Reviewed By: @yfeldblum
Differential Revision:
D2283757
fb-gh-sync-id:
831c8aaad9bd5ad0fe091ea1e006814774d8a27c
Mohammad Husain [Tue, 13 Oct 2015 17:21:40 +0000 (10:21 -0700)]
Getter to know if the socket is accepting new connections
Reviewed By: @yfeldblum
Differential Revision:
D2534627
fb-gh-sync-id:
2934911b69542b4befa8dc03ec3cadb4a148496d