summaryrefslogtreecommitdiff
path: root/lib/server
Commit message (Collapse)AuthorAge
* Refactor handling of exceptions in protocol server command executors.Chris Wilson2014-10-31
| | | | | | | | | | Add a standard method to Replyable that will be called if a recoverable exception (a BoxException) occurs, and can return a protocol Message to be sent to the client, such as an error code for various standard errors, or rethrow the exception. If you want something different, catch exceptions and return the desired reply yourself, or you'll get the default handling.
* optlen could become bigger than sizeof(info) in future and that's OKChris Wilson2014-09-18
|
* Add check for trying to ReceiveStream when no stream availableChris Wilson2014-09-18
|
* Update comment to match current method nameChris Wilson2014-09-18
|
* Whitespace fixesChris Wilson2014-09-18
|
* Improve exception message if a Daemon is used without being configured firstChris Wilson2014-09-18
|
* Catch exceptions while executing store commands, and return an error message.Chris Wilson2014-09-04
| | | | | | | | | This will allow the client to eventually have more information about what went wrong on the server, if the server admin agrees, and makes test debugging easier. Backport some additional testbackupstore tests from the test refactor branch. Merged back changes from the test refactor branch to reduce diffs.
* Changed many uses of BackupProtocolClient to BackupProtocolCallable.Chris Wilson2014-09-04
| | | | | | Makes way for more use of local protocol objects and protocol subclasses. Merged back changes from the test refactor branch to reduce diffs.
* Simplify code with macros, update comments and fix whitespace.Chris Wilson2014-09-04
| | | | | | Hopefully all of these changes are inconsequential. Merged back changes from the test refactor branch to reduce diffs.
* Fix poll timeout calculation for infinite timeouts.Chris Wilson2014-08-15
|
* Whitespace fixes.Chris Wilson2014-08-15
|
* Add missing timeouts for network operations.Chris Wilson2014-08-15
|
* Fix deadlock waiting for read or write on closed connection.Chris Wilson2014-08-15
| | | | | | | | If the system is suspended then it may not realise that a TCP connection has been closed, while waiting for data to arrive on it. We didn't used to apply a timeout to this read operation. Now we use the connection's default timeout on all read and write operations. Network operations that don't pass a timeout will be logged with a backtrace, so that they can be fixed.
* Remove ServerException.h and the exception code aliases that it defines.Chris Wilson2014-08-15
| | | | We don't really need these, so clean up by removing them.
* Whitespace, wrapping, comments and dead code cleanups.Chris Wilson2014-08-15
| | | | | | | | Conflicts: bin/bbackupd/BackupDaemon.cpp bin/bbackupd/BackupDaemon.h test/bbackupd/testbbackupd.cpp
* Don't just eat the exception, rethrow it after logging details.Chris Wilson2014-04-25
|
* Add debugging code for when SendStream() fails during client command.Chris Wilson2014-04-18
| | | | | | | | | Will hopefully help to debug Brendon Baumgartner's issue with backups not completing and repeating over and over, due to this error: > Apr 18 11:14:09 hosting bbackupd[18990]: WARNING: Exception thrown: > ServerException(Protocol_BadUsage) (Sending a stream with a definite > size of zero is not allowed in the protocol) at Protocol.cpp:703
* Fix compilation on Debian 7 (Wheezy) by including bsd/unistd.h.Chris Wilson2014-04-12
| | | | | | | If libedit is installed then -ledit will be detected and added to the link line, which makes the test for getpeereid pass. Then SocketStream.cpp tries to use it, but that won't work unless we include bsd/unistd.h where the prototype is declared.
* Refactor logging option processing out of Daemon class.Chris Wilson2014-04-09
| | | | Allows command-line tools to reuse the same option processing.
* Add a static GetMessage() to BackupProtocolError.Chris Wilson2014-04-09
| | | | | | | | | Allows retrieving the error message for a given code, when we no longer have the protocol object handy. Conflicts: lib/server/makeprotocol.pl.in
* Whitespace, comments and log messages cleanups.Chris Wilson2014-03-02
|
* Always flush any incoming stream on server side.Chris Wilson2014-03-02
| | | | | | | | | | Otherwise the protocol might be broken and can't be used any more, even if we made an effort to return an Error reply instead of throwing an exception. This used to not be a problem because an Error reply would terminate the connection anyway, but it no longer does. So if the client also didn't terminate, but tried to handle the exception and keep using the connection, then it might find that its next command fails because the protocol is broken.
* Use static_cast instead of C-style casts, for C++ style and safety.Chris Wilson2014-03-02
|
* Fix whitespace and comments, remove redundant code in protocol generator.Chris Wilson2014-03-02
|
* Add convenience macro for testing commands that return errors.Chris Wilson2014-03-02
|
* Fix memory leak in local protocol.Chris Wilson2014-03-02
| | | | | When a command fails with an error, and CheckReply throws an exception, the mStreamsToSend were not deleted.
* Add information about last exchange when wrong type of object received.Chris Wilson2014-03-02
| | | | | | | | | | Helps with debugging ConnectionException::Protocol_StreamWhenObjExpected and ConnectionException::Protocol_ObjWhenStreamExpected errors, which may be caused by a command returning an error message and failing to consume any uploaded streams first. Add extra debugging in ProtocolLocal objects to detect when this happens during the command itself, which helps with debugging.
* SpellingChris Wilson2014-03-02
|
* Make Protocol take control of the socket object passed in.Chris Wilson2014-03-01
| | | | | | | | | | | | | We pass a std::auto_ptr<SocketStream> to every Protocol subclass when we construct it, and it takes control of this object. This reduces the risk of: * accidentally reusing the same SocketStream for multiple Protocols (it happened to me in testbackupstore); * holding onto a reference to the SocketStream; * allowing a locally-scoped SocketStream to go out of scope and be released while still being referenced by a live Protocol.
* Don't write #include statements for empty filenames.Chris Wilson2014-02-07
|
* Rename $cmd_class to $cmd_classes.Chris Wilson2014-02-07
| | | | Makes code easier to read.
* Add ReceiveStream to protocol callable base class.Chris Wilson2014-02-07
| | | | | So we can call it on either a Client or a Local protocol object, without having to know which it is, or cast it.
* Fix getopt header confusion.Chris Wilson2013-09-30
| | | | | | | | Our copy of getopt.h in lib/win32 was beating the system getopt.h in the search path, and providing different definitions, which clang picked up. Renamed our getopt.h to bsd_getopt.h, and added a box_getopt.h to decide whether to include this one instead of the system getopt.h.
* Set process title on Windows.Chris Wilson2013-08-25
| | | | | | Thanks to Arnaud for submitting the patch: "I propose a little patch to enable the SetProcessTitle function on windows system."
* Pass std::auto_ptr objects to Protocol for upload.Chris Wilson2013-08-22
| | | | | | | | | | | Passing raw pointers is bad C++ style, and dangerous, because Protocol will free the passed-in pointers after uploading them, so we should not keep using them. Reduce code duplication in BackupClientDirectoryRecord patch/normal upload. Return a std::auto_ptr<BackupStoreFileEncodeStream> instead of a std::auto_ptr<IOStream> from BackupStoreFile::EncodeFile* functions.
* Add a ToString() method on protocol objects, to help with debugging them.Chris Wilson2013-08-21
|
* Fix missing space in log message.Chris Wilson2012-11-17
|
* Fix typo.Chris Wilson2012-06-07
|
* Defend against exceptions during logging, e.g. CipherException if filename ↵Chris Wilson2012-04-28
| | | | decrypt fails.
* Move LogError out of server/SSLLib so we can use it in Crypto.Chris Wilson2012-04-28
|
* Hopefully fix TcpNice setsockopt/struct tcp_info compile errors on Windows.Chris Wilson2012-03-16
|
* Initialise the EWMA rate average to 0, and comment on variables in log message.Chris Wilson2012-02-12
|
* Add experimental "TCP Nice" mode, disabled by default.Chris Wilson2012-02-12
|
* Store more details in protocol exceptions to help with debugging.Chris Wilson2012-02-02
|
* Catch trying to send a zero-length stream, which will cause an assertion ↵Chris Wilson2012-01-22
| | | | failure on the other side.
* Improve logging of socket errors (create, bind, accept, and poll)Chris Wilson2012-01-22
|
* Split option processing out of Daemon::Main() to ease use of Daemon class in ↵Chris Wilson2012-01-22
| | | | tests.
* Add remote host and port to post-login login message, requested by Pete Jalajas.Chris Wilson2011-12-13
|
* Improve error message on bbackupd command socket bind failure, thanks to ↵Chris Wilson2011-10-31
| | | | Christophe.
* Avoid recompiling everything on MSVC when BoxVersion.h changes.Chris Wilson2011-10-25
|