Commit Graph

354 Commits

Author SHA1 Message Date
Avi Kivity
bc8a940dfa packet: mark as noexcept move constructible 2014-10-02 14:32:34 +03:00
Avi Kivity
dacf81745e core: add circular_buffer
Since we have lots of queues, we need an efficient queue structure,
esp. for moveable types.  libstdc++'s std::deque is quite hairy,
and boost's circular_buffer_space_optimized uses assignments instead of
constructors, which are both slower and less available than constructors.

This patch implements a growable circular buffer for these needs.
2014-10-02 14:32:32 +03:00
Avi Kivity
42db87a8c2 core: add helper functions for "transferring" objects
Here, transferring is defined as moving an object to a new location
(either via a move or copy constructor) and destroying the source.  This
is useful when implementing containers.
2014-10-02 14:28:14 +03:00
Avi Kivity
26f78f97f4 Merge branch 'tgrabiec/arp' of github.com:cloudius-systems/seastar-dev
ARP related fixes, including many core updates.
2014-10-01 16:34:21 +03:00
Tomasz Grabiec
73413748a7 arp: limit the number of waiting requests
Currently the waiters queue can grow to infinity pretty quickly.
2014-10-01 13:45:29 +02:00
Tomasz Grabiec
a435a0561d arp: fail requests on timeout 2014-10-01 13:45:29 +02:00
Tomasz Grabiec
281d986c34 arp: retry lookup requests every second
Bridges with forwarding delay ignore requests for some time. We should
retry the request so that we eventually get the response.
2014-10-01 13:45:29 +02:00
Tomasz Grabiec
04b53b7498 ip: make send() composable
This allows the caller to compose it with other actions when send() is
done or when it fails.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
86246a4c0e tests: add test for bug in error propagation by future::then() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
6fa3212888 core: fix missing error propagation when intermediate future is involved
Test case (added in the next patch):

    promise<> p1;
    promise<> p2;

    auto f = p1.get_future().then([f = std::move(p2.get_future())] () mutable {
        return std::move(f); // this future will fail
    }).then([] {
        // never reached, that's ok
    });

    p1.set_value();
    p2.set_exception(std::runtime_error("boom"));

    // f should get resolved eventually with error, but was not
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
6f1d1d6627 tests: add tests for future::rescue() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
0269fd6f15 tests: add tests for future::finally() 2014-10-01 13:45:28 +02:00
Tomasz Grabiec
d9bf08c1b3 core: introduce future::finally()
The callback passed to it will be executed when future gets resolved,
successfully or not. The returned future will mimic the state of the
target future.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
fcb55c1f04 core: introduce future::forward_to()
It causes that when future is resolved, the target promise will be
resolved too with the same state.
2014-10-01 13:45:28 +02:00
Tomasz Grabiec
07d6df11a8 core: introduce make_exception_future() which works with exception objects 2014-10-01 13:45:25 +02:00
Tomasz Grabiec
125a696d6c core: introduce promise::set_exception() which works with exception objects 2014-10-01 13:45:22 +02:00
Tomasz Grabiec
061bccd084 core: timer: add support for periodicy
Simplifies the client side which uses periodic timers.
2014-10-01 13:21:10 +02:00
Tomasz Grabiec
48a86b7073 core: make timer callbacks synchronous with state changes
It allows for simpler client code because the client can assume that
when cancel() returns the callback will not run and thus there's no
need to handle the race between timer teardown and execution of the
callback.
2014-10-01 13:21:10 +02:00
Tomasz Grabiec
9a0ab2f1a4 tests: introduce some basic utilities used by tests 2014-10-01 13:21:09 +02:00
Tomasz Grabiec
eeea3640f2 core: make future::rescue() return a future<>
This will allow to compose rescue() just like then().
2014-10-01 13:21:09 +02:00
Tomasz Grabiec
5f2e06beda core: make future's result obtainable via future::rescue()
This will allow the user to have one handler for both success and
failure. This simplifies client code a bit when both paths need to
work on the same object. Having to split the function into two
callbacks, one of which is passed to then() and the other to rescue()
on a resulting promise, would make it necessary to wrap the object in
a shared_ptr, which is suboptimal.
2014-10-01 13:21:02 +02:00
Avi Kivity
4f5059fa75 app template: support configuration files
~/.config/seastar/seastar.conf
2014-09-30 21:29:53 +03:00
Avi Kivity
475c9a39dc tcp: fix FIN handling
Advance sequence number after our FIN is acknowledged, and don't sent it
out again after that.

Fixes FIN storm after the connection is closed.
2014-09-30 20:11:44 +03:00
Asias He
ca9019cdfe virtio: Rename std::vector<vring::buffer_chain> ret to vbc
Make the naming more consistent.
2014-09-30 11:28:26 +03:00
Asias He
4db98d5159 virtio: Fix ring size
Fix error with tcp_test:
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast> >'
  what():  boost::bad_any_cast: failed conversion using boost::any_cast
2014-09-30 10:47:11 +03:00
Avi Kivity
3daee77c9e build: support configuring the compiler 2014-09-30 10:43:46 +03:00
Avi Kivity
404cabc645 build: list required libraries explicitly
clang doesn't add those libraries itself, add them explicitly.
2014-09-30 10:43:16 +03:00
Avi Kivity
4f83aab5f0 ragel: remove unused variable 2014-09-30 10:43:01 +03:00
Avi Kivity
9cbd099fe5 README, Dockerfile: update for ragel 2014-09-30 09:34:32 +03:00
Avi Kivity
3ea40b2848 core: get rid of input_stream::_scanned
With input_stream::read_until() gone, it's not really needed.
2014-09-29 17:53:04 +03:00
Avi Kivity
cd27c4342d core: drop input_stream::read_until()
Superceded by consume().
2014-09-29 17:41:56 +03:00
Avi Kivity
1472c24533 httpd: replace custom parser with Ragel based parser 2014-09-29 15:17:42 +03:00
Avi Kivity
9b2290228b core: add infrastructure for building Ragel parsers 2014-09-29 15:17:42 +03:00
Avi Kivity
7724a616fd core: add input_stream::consume()
This method, intended for request parsers, receives a stream of temporary
buffers until it determines that parsing is done, at which point it can
return any unconsumed partial buffer back to the input stream.

It is intended as a replacement for read_until(), since it can parse in a
single pass.
2014-09-29 15:17:42 +03:00
Avi Kivity
1f4c063c58 build: make --static option use full static linking (not just libstdc++)
Runing on pre-glibc2.18 hosts (like C7) is impossible without this. The
downside is that the developer has to download, build, and install static
versions of libtcmalloc and libaio.
2014-09-29 15:15:29 +03:00
Gleb Natapov
ca0a0b60e1 smp: Fix smp::submit_to to handle submission to a local cpu
Handle submission to a local cpu by executing a function immediately
and returning ready future.
2014-09-28 14:03:42 +03:00
Gleb Natapov
4c51d387d7 smp: remove debug output 2014-09-28 13:22:05 +03:00
Avi Kivity
9a0d0336b5 virtio: allow tuning the ring size 2014-09-28 11:04:30 +03:00
Asias He
cff8cb353a net: Add netmask option 2014-09-28 10:06:08 +03:00
Asias He
7ab735d3c7 net: Gateway support 2014-09-28 10:05:58 +03:00
Tomasz Grabiec
099c4cfcc2 core: get rid of reactor::_next_timeout
timer_set maintains next timeout so no need to duplicate it.

This also fixes a potential issue, if upon timer expiry no timer is
pending we did not update _next_timeout which will result in timer fd
not being updated upon next arm().
2014-09-25 20:51:57 +03:00
Avi Kivity
ac7b3921f8 README: fix typos in future introduction 2014-09-25 17:58:07 +03:00
Avi Kivity
5c7df1bebc README: update wrt the disappearance of Makefile 2014-09-25 17:57:08 +03:00
Tomasz Grabiec
ec616d7ae5 arp: add missing host-to-network conversion
Caused ARP requests from seastar to be dropped.
2014-09-25 17:54:29 +03:00
Asias He
c5d623265d net: Support ping 2014-09-25 17:49:38 +03:00
Avi Kivity
812fe7b0ae build: remove Makefile 2014-09-25 13:46:53 +03:00
Avi Kivity
24780a8a8a build: move cscope rules to ninja 2014-09-25 13:46:17 +03:00
Avi Kivity
a17d216d03 build: add 'debug' and 'release' targets
Build all artifacts for a build mode.
2014-09-25 13:24:20 +03:00
Asias He
eda11080cb virtio: Check tcp packet using ip_hdr->ip_proto
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2014-09-25 13:06:11 +03:00
Asias He
4bd9f4d49d net: Always check IP header checksum
virtio-net do tcp checksum offload not IP header checksum offload.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
2014-09-25 12:56:53 +03:00