1. 27 Jan, 2016 3 commits
    • Maxim Georgiev's avatar
      Add mechanizm for caching local and peer addresses in AsyncSSLSocket. · 23e1c2d3
      Maxim Georgiev authored
      Summary: This change adds a flag to AsyncSSLSocket which forces the socket to cache local and remote addresses right after TCP connection is established. Cached address values will be available after the connection is closed. Caching addresses can be halpful in SSL handshake failure investigations.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2863274
      
      fb-gh-sync-id: d7b415292988c2fb187a80422e8ccbf8ba8ab0e3
      23e1c2d3
    • Giuseppe Ottaviano's avatar
      Fix typo in comment · 13f7a671
      Giuseppe Ottaviano authored
      Reviewed By: yfeldblum
      
      Differential Revision: D2869494
      
      fb-gh-sync-id: 889957a92dd7f59c4b9564d1946e9f4058293839
      13f7a671
    • Yedidya Feldblum's avatar
      Extract endianness checks into Portability.h · ddce9087
      Yedidya Feldblum authored
      Summary: [Folly] Extract endianness checks into Portability.h.
      
      Reviewed By: fugalh
      
      Differential Revision: D2857924
      
      fb-gh-sync-id: 23ecd2a3cad661024acb62769cd85df394786c59
      ddce9087
  2. 26 Jan, 2016 2 commits
    • Christopher Dykes's avatar
      Use FOLLY_DEPRECATED rather than directly using GCC specific attributes. · 68a47850
      Christopher Dykes authored
      Summary: Without this MSVC can't compile.
      
      Reviewed By: lbrandy
      
      Differential Revision: D2856598
      
      fb-gh-sync-id: 0e146afe844b0ce5d3782528ed9c3de53f7c8b05
      68a47850
    • Arjen Roodselaar's avatar
      Debian DEBs build script · 25e4743f
      Arjen Roodselaar authored
      Summary:
      This scripts uses fpm to build a somewhat reproducible set of debs which can be deployed to Ubuntu 14.04 hosts. The main library package carries the Folly major version number, allowing multiple versions to be installed alongside. The -dev deb is simply called libfolly-dev and will be upgraded as Folly moves forward. In accordance to the Debian packaging policies the shared libraries have their (debug) symbols stripped and saved to external symbol files, contained in the -dev deb.
      
      sgolemon, yfeldblum you guys are my best guess to review this. Feel free to suggest additional folks if needed.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2806082
      
      fb-gh-sync-id: 42605acccdec781f7a6b59a925121e6ed7c7cdf5
      25e4743f
  3. 25 Jan, 2016 2 commits
    • Christopher Dykes's avatar
      Initialize LifoSem's padding to allow for its constexpr constructor. · ef0c9e47
      Christopher Dykes authored
      Summary: MSVC correctly gives an error about the constexpr constructor not initializing all members.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2856806
      
      fb-gh-sync-id: cef97639906dd3c39e3d3dc2ba939021e15edcb9
      ef0c9e47
    • Michael Bejda's avatar
      Thread-safe RequestContext putIfAbsent operation · 1721cad0
      Michael Bejda authored
      Summary:
      Adds a thread-safe putIfAbsent operation to the RequestContext. The current setContextData() is not sufficent to do it safely.
      Just like setContextData, this method is unfair, as a high volume of reads will block the spinlock.
      
      Reviewed By: fugalh
      
      Differential Revision: D2850752
      
      fb-gh-sync-id: 2ff22ea9e9bd8f27f6ae7a57214a6dbc4fdcd4c5
      1721cad0
  4. 22 Jan, 2016 1 commit
    • David Callahan's avatar
      avoid aggressive optimization · 1723592c
      David Callahan authored
      Summary: GCC will now dead-code eliminate the folly-based version of this test without a mechanisms to force the result to be live.
      
      Reviewed By: ttsugriy
      
      Differential Revision: D2854633
      
      fb-gh-sync-id: 0e3841ed22c040fda7653bcfb5a3f19ca3d1f835
      1723592c
  5. 21 Jan, 2016 4 commits
    • Tom Jackson's avatar
      Add PrintTo for dynamic · e202187f
      Tom Jackson authored
      Summary: Making `EXPECT_EQ(dyn1, dyn2)` easier to debug
      
      Reviewed By: luciang, ot, yfeldblum
      
      Differential Revision: D2848318
      
      fb-gh-sync-id: 0c7cdd292665a493f2b792798df4e6966c1f28db
      e202187f
    • Kyle Nekritz's avatar
      Add getPeerCert() to AsyncTransport. · 31260110
      Kyle Nekritz authored
      Reviewed By: elindsey
      
      Differential Revision: D2850760
      
      fb-gh-sync-id: 60dbc3117e658d2fd083a87884892924bf313019
      31260110
    • Kyle Nekritz's avatar
      Adding OpenSSLPtrTypes.h. · 85e8a2d4
      Kyle Nekritz authored
      Summary:
      So that these deleter and unique_ptr types don't have to be redeclared every single place they are used.
      To be expanded on.
      
      Reviewed By: mzlee
      
      Differential Revision: D2850376
      
      fb-gh-sync-id: e7f8bba320163b8b12a93b5cf3cd9a5921d38edc
      85e8a2d4
    • Dmitry Pleshkov's avatar
      Haswell-specific implementation of Select64 routine. · b2818624
      Dmitry Pleshkov authored
      Summary: k-th bit selection could be efficiently implemented via new BMI2 instruction set.
      
      Reviewed By: ot, philippv
      
      Differential Revision: D2843311
      
      fb-gh-sync-id: 4c0cf52176a03422aef276ce5f677080f67f5fdf
      b2818624
  6. 20 Jan, 2016 2 commits
    • Michael Lee's avatar
      Move StringTest benchmarks into StringBenchmark.cpp · f00612cf
      Michael Lee authored
      Summary: StringTest.cpp is a mix of benchmarks and normal unittests. Fixing this.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2840804
      
      fb-gh-sync-id: d3efc357f5f09385e9f69b70e38b64d59045ff0d
      f00612cf
    • Michael Lee's avatar
      Remove unecessary main functions. · edc4bd3f
      Michael Lee authored
      Summary: Starting with this, but I will keep digging through these. The tests will be compiled into one combined test with a single main.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2841391
      
      fb-gh-sync-id: 78fd153e282f1ca2dbe7ada942dc04fc8ba5d42d
      edc4bd3f
  7. 19 Jan, 2016 1 commit
    • Alan Frindell's avatar
      Add Range::erase · 14564041
      Alan Frindell authored
      Summary: Needed to use StringPiece with boost::algorithm::trim()
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2833657
      
      fb-gh-sync-id: 3430b1a2540279b2f69f04c871df3bca748f2cb1
      14564041
  8. 15 Jan, 2016 3 commits
    • Alexey Spiridonov's avatar
      Print null correctly · c1ab48e4
      Alexey Spiridonov authored
      Summary: Null by itself was printing as 0, now it prints as null, which is consistent with the 'pseudo json' output.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2789284
      
      fb-gh-sync-id: f318b8d0f8349f4b36f868c419842fb50bee9517
      c1ab48e4
    • Aaron Balsara's avatar
      Fix buck build for SSLContext · b015c8c3
      Aaron Balsara authored
      Summary: D2800746 broke buck with an unsigned/signed compare
      
      Reviewed By: dkgi
      
      Differential Revision: D2835102
      
      fb-gh-sync-id: a0b8311b38a199e089d3ed5a69b12f8f8abe38b1
      b015c8c3
    • Aaron Balsara's avatar
      Allow SSLContext to read certificates and keys from memory · d65b7736
      Aaron Balsara authored
      Summary: Added the ability for SSLContext to load X509 Certificates and private keys from memory
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2800746
      
      fb-gh-sync-id: 14cad74f8d761b9b0f07e2827b155cec9ba27f50
      d65b7736
  9. 14 Jan, 2016 2 commits
    • Francis Ma's avatar
      Decouple future and fiber for mobile · 138b7236
      Francis Ma authored
      Summary:
      folly::fibers have a bunch of dependencies that are shaky on mobiles.
      Decoupling it by using folly::Baton instead of folly::fibers::Baton. Should have
      zero effect on fbcode cases.
      
      Reviewed By: djwatson, yfeldblum
      
      Differential Revision: D2821603
      
      fb-gh-sync-id: 0ce3472c9eedf97224e8584d25e04515396cd18e
      138b7236
    • Rachel Kroll's avatar
      match new signal text from prior diff; squash colors (!) · 76dabfa2
      Rachel Kroll authored
      Reviewed By: yfeldblum
      
      Differential Revision: D2828789
      
      fb-gh-sync-id: 71e45ffe31061220e06d7e7762058f8a1501b5cc
      76dabfa2
  10. 13 Jan, 2016 2 commits
  11. 12 Jan, 2016 1 commit
  12. 11 Jan, 2016 1 commit
  13. 09 Jan, 2016 2 commits
    • Yedidya Feldblum's avatar
      SingeltonVault::ScopedExpunger - RAII class to clear singletons · 10627e03
      Yedidya Feldblum authored
      Summary:
      [Folly] `SingeltonVault::ScopedExpunger` - RAII class to clear singletons.
      
      Clears all singletons in the given vault at ctor and dtor times. Useful for unit-tests that need to clear the world.
      
      This need can arise when a unit-test needs to swap out an object used by a singleton for a test-double, but the singleton needing its dependency to be swapped has a type or a tag local to some other translation unit and unavailable in the current translation unit.
      
      Other, better approaches to this need are "plz 2 refactor" ....
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D2802459
      
      fb-gh-sync-id: c24cebd3a464ed5da29ea1d9e7b86c51d61cf631
      10627e03
    • Andrii Grynenko's avatar
      Fix Python FiberTask to properly init/reset Python thread state · b8520e0d
      Andrii Grynenko authored
      Reviewed By: alikhtarov
      
      Differential Revision: D2813735
      
      fb-gh-sync-id: ab3c3e18618ed8bf15f478bcfca008786834e65c
      b8520e0d
  14. 08 Jan, 2016 2 commits
    • Pallab Bhattacharya's avatar
      folly::Symbolizer can be enhanced for dumpStackTrace · 635af78d
      Pallab Bhattacharya authored
      Summary:
      added functionality in Symbolizer.cpp to handle multi-segment binary and to allow symbol lookup via /proc/self/exe when some or whole text is relocated to ANON pages such as during hugification. An example of multi-segment binary : P56071432
      
      cc markw65 - a part of the change include logic pulled from hphp/runtime/base/stack-logger.cpp:symbolize_huge_text so that hugified consumers of dumpStackTrace need not fork off.
      
      Reviewed By: edwardc
      
      Differential Revision: D2802837
      
      fb-gh-sync-id: 577ab1b4ef8f22059894bfdd9c0526a22ee89ca8
      635af78d
    • Giuseppe Ottaviano's avatar
      Fix two fbstring operator+ overloads · 81295897
      Giuseppe Ottaviano authored
      Summary: `insert()` returns `fbstring` in most cases, but `iterator` (that is, `value_type*`) when the first argument is an iterator. Two overloads of `operator+` used `insert` as if it returned `fbstring`, which by chance works anyway unless the resulting string contains a `'\0'` (plus it does an extra string copy). This diff fixes the bug.
      
      Reviewed By: philippv, luciang, Gownta
      
      Differential Revision: D2813713
      
      fb-gh-sync-id: 015188b72813da2dabe23980f50f00832d62aa14
      81295897
  15. 06 Jan, 2016 1 commit
    • David Callahan's avatar
      parse args for -json flag · 5d7bf822
      David Callahan authored
      Reviewed By: yfeldblum
      
      Differential Revision: D2803911
      
      fb-gh-sync-id: 65023cae7fd8e06c30fed100826b4b834ee2e9b1
      5d7bf822
  16. 05 Jan, 2016 4 commits
    • Gustavo Serra Scalet's avatar
      Enable GroupVarint on PPC64 · 061b5de8
      Gustavo Serra Scalet authored
      Summary:
      This PR is necessary for both Folly and HHVM to compile on PPC64 (https://github.com/PPC64/hhvm) and other platforms that are not compatible with SSE instructions.
      
      It also removes GroupVarint32 tables generator dependency on x86 platform.
      Closes https://github.com/facebook/folly/pull/339
      
      Reviewed By: mxw
      
      Differential Revision: D2760156
      
      fb-gh-sync-id: b4e93b54b62d6f68ccf684d34840678f677bf276
      061b5de8
    • David Callahan's avatar
      parse args for -json flag · a0430d4a
      David Callahan authored
      Reviewed By: lbrandy
      
      Differential Revision: D2803778
      
      fb-gh-sync-id: 0cb21413bb1c78d256b4408322f8d585f53cb0ac
      a0430d4a
    • Neel Goyal's avatar
      Add canAdvance to cursor and tests · 1c77ef4f
      Neel Goyal authored
      Summary:
      Determine if the cursor can advance N bytes. This is useful if
      applications want to check before reading so an exception isn't thrown.
      It tries to walk the minimal amount of links needed in the chain.
      
      I had a task that could have used this, though caching totalLength and
      macro magic ended up being the implementation chosen. I think this just
      adds to the cursor API.
      
      Reviewed By: djwatson
      
      Differential Revision: D2728498
      
      fb-gh-sync-id: 8657653b82a48828cccab143653dc169ef715702
      1c77ef4f
    • Michael Lee's avatar
      Switch back to SYS_gettid, and fix · 3f93d783
      Michael Lee authored
      Summary:
      SYS_gettid is different on Linux vs. OSX.  `__NR_gettid` is
      only sometimes present and `SYS_gettid` is only sometimes present, but
      we can pick one name and just follow that one.
      
      Reviewed By: dcolascione
      
      Differential Revision: D2800515
      
      fb-gh-sync-id: 4245de4b9184ac4233ade9da297409c1031869a3
      3f93d783
  17. 04 Jan, 2016 1 commit
    • Michael Lee's avatar
      Clean up folly tests. · 43db7ae3
      Michael Lee authored
      Summary: Clean up and remove unecessary gflags use.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2795904
      
      fb-gh-sync-id: 99cccb4dc32a051b3d552b72cbc9243e20ba8127
      43db7ae3
  18. 30 Dec, 2015 1 commit
    • Giuseppe Ottaviano's avatar
      Close AsyncServerSocket sockets in reverse order · 99a7f383
      Giuseppe Ottaviano authored
      Summary:
      When a large number of processes concurrently bind and close `AsyncServerSocket`s with `port=0` (for example in tests) binding the IPv4 socket on the same port bound with the IPv6 socket can currently fail, because sockets are closed in the same order as they are opened, which makes the following scenario possible:
      
      ```
      P0: close IPv6 port
      P1: open IPv6 port (succeed)
      P1: open IPv4 port (FAIL)
      P0: close IPv4 port
      ```
      
      This diff reverses the closing order, and also fixes a couple of outdated comments.
      
      Reviewed By: philippv
      
      Differential Revision: D2795920
      
      fb-gh-sync-id: 0b5157a56dfed84aed4a590c103050a2727847b3
      99a7f383
  19. 28 Dec, 2015 1 commit
  20. 24 Dec, 2015 2 commits
    • Dominik Gabi's avatar
      wrapper for nullable attribute · 396329db
      Dominik Gabi authored
      Reviewed By: yfeldblum
      
      Differential Revision: D2784472
      
      fb-gh-sync-id: 84c7426cc82edabb04c662fa699764ffc0864b7e
      396329db
    • Dominik Gabi's avatar
      clang attribute wrappers · 6896ff9d
      Dominik Gabi authored
      Summary: adding GCC compatible wrappers for clang attributes to folly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D2706913
      
      fb-gh-sync-id: 17db34089d48a6a01c20904321a47ff98141c2fe
      6896ff9d
  21. 23 Dec, 2015 2 commits
    • Michael Lee's avatar
      Change `SYS_gettid` to __NR_gettid instead · 2a0cb937
      Michael Lee authored
      Summary: SYS_gettid is not available on all platforms, but __NR_gettid should be.
      
      Reviewed By: dcolascione
      
      Differential Revision: D2787003
      
      fb-gh-sync-id: ee024437ac95281a3573e2440653847f6f7d1738
      2a0cb937
    • Giuseppe Ottaviano's avatar
      Fix test Dynamic.ArrayReassignment with Clang 3.7 · 015ca678
      Giuseppe Ottaviano authored
      Summary:
      `dynamic` is one of the few unfortunate recursive types that have a constructor of the form `T(initializer_list<T>)`. After the Defect Report 95 (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1467) a statement `T t = {v};` where `v` is of type `T` invokes the copy constructor instead of the initializer list constructor. Clang 3.7 implements the new behavior, and GCC probably will soon.
      This diff only fixes a test where the ambiguous syntax is used, but a better solution would be preferable.
      
      Reviewed By: philippv
      
      Differential Revision: D2786455
      
      fb-gh-sync-id: 7fa5235e4041cbc8dd3ce685b5a0c23c343f78d2
      015ca678