Commit graph

458 commits

Author SHA1 Message Date
Eric Frias
751777e754 Fix more locations where we were making boost::asio calls with buffers declared on the stack which could cause problems when the calling tasks were canceled. 2014-09-11 16:30:03 -04:00
Eric Frias
aa6882b3b7 Allow us to safely cancel tasks that are executing asynchronous network reads
and writes.  This was previously unsafe because we almost always passed read/write
buffers to boost that were on the stack. Canceling the task deleted the stack and
therefore the buffer, but couldn't reliably prevent boost from writing to the buffer
if data came in after the cancel.  This commit adds variants of the read and write
functions that take a shared_ptr<char> instead of a raw char* as the buffer, and
these variants will ensure the shared_ptr will outlive the boost::asio read/write.
2014-09-09 11:10:37 -04:00
dnotestein
10fdbcf5b3 Dequeue a thread from a blocking promise's notify list when the all the thread's tasks that are waiting on that promise are canceled. This prevents a crash when the promise is fulfilled after the thread is destroyed.
Re-organize read-loop execution to avoid crashes in read_loop on Win32 when ntp object destructs. Call quit on ntp_thread when ntp object destructs to free up thread (eventually we need to make fc::threads call quit in their destructor, but more work is required to make that work properly).
~fc::udp_socket now closes socket on destruction (consider doing this for tcp sockets as well).
2014-09-08 15:31:13 -04:00
Eric Frias
130da3623e Allow fibers to be canceled while they're sleeping or blocked on promises 2014-09-08 10:41:59 -04:00
Eric Frias
454573e048 Add support for boost 1.56. 2014-09-08 10:41:59 -04:00
Nathan Hourt
21db937ba7 Add reflector for multimap 2014-09-04 19:14:23 -04:00
Eric Frias
a0b3a9a92d Restore function-like semicolon-swallowing behavior to FC_THROW 2014-09-02 15:21:30 -04:00
Eric Frias
3222dc7c0b When reusing a context, re-initialize most of its fields. This fixes at least two errors:
- we were canceling tasks that hadn't been canceled, because the canceled flag was left set to true and the next task assigned to the context then became canceled as soon as it yielded
 - we were resumeing blocked tasks before they should have resumed, because their blocking_promises list wasn't cleared and they were unblocking because the erroneous promises were fulfilled
As a debugging aid, we also record the cancellation reason whenever a task is canceled, and include that in the canceled_exception (this is only enabled in debug builds)
2014-08-28 15:43:26 -04:00
Eric Frias
477d3397f6 Merge branch 'log_task_names' 2014-08-28 15:29:14 -04:00
Eric Frias
da15557c85 assert() instead of throwing fc::null_optional exception when dereferencing an invalid optional. Before, the behavior was to throw null_optional in debug mode and to allow the dereference in release, which masked the error 2014-08-28 11:42:46 -04:00
Eric Frias
ac385d1f6b Allow the user to supply a reason string when canceling a task (useful for debugging) 2014-08-27 14:07:44 -04:00
Eric Frias
8841f5e271 Import thread/task_specific variables 2014-08-27 12:20:19 -04:00
Eric Frias
27096f15a7 Log the names of tasks to the log file (now contains thread_name:task_name} 2014-08-24 18:33:05 -04:00
Eric Frias
578527626c Support GNTP password authentication 2014-08-21 19:32:56 -04:00
Eric Frias
156a7cc4b4 Allow setting hostname 2014-08-21 16:14:08 -04:00
Eric Frias
362884fc52 Import GNTP notification code 2014-08-21 15:21:48 -04:00
Eric Frias
978de7885a Add a macro to check if a task that shouldn't yield actually yields. 2014-08-02 19:43:28 -04:00
Eric Frias
8fa21821ae Suppress "inherited via dominance" warning 2014-08-02 15:49:07 -04:00
Daniel Larimer
6e31ffd963 Merge branch 'master' of https://github.com/InvictusInnovations/fc 2014-08-01 17:21:24 -04:00
dnotestein
7cc69f3bb7 Set canceled flag in task's context object so that we cancel out of active tasks when they try to resume. Wrap a try-catch block around tcp and udp resolve requests to convert any non-fc exceptions to fc exceptions. Minor change to clarify design intent that request_time_task should always be running in _ntp_thread. 2014-08-01 11:31:36 -04:00
Daniel Larimer
3ccbe26dd5 adding aes exception 2014-07-29 13:54:50 -04:00
Vikram Rajkumar
a23f3a86be Add missing integer variant conversions 2014-07-28 22:36:47 -04:00
Vikram Rajkumar
f644b1e475 Fix compiler warning 2014-07-27 20:46:39 -04:00
Eric Frias
d847f6469a Allow us to require assigning descriptions to all async tasks to aid in debugging 2014-07-27 17:37:21 -04:00
Vikram Rajkumar
48837f3116 Add time_point_sec::to_iso_{extended_}string() 2014-07-26 21:05:11 -04:00
Eric Frias
24ba357b0d Make future's cancel_and_wait automatically swallow the canceled_exception since it is expected. 2014-07-26 14:51:48 -04:00
PaulEU
4890351b34 Added OpenSSL configuration file path. (qt_wallet issue #10 Some clients on Windows 7 quit/crash on start) 2014-07-23 00:18:09 +02:00
Gandalf-the-Grey
2d51fd7321 Fix compile fc on Win64 tcp_socket needs a bit (two dozens of) more space. 2014-07-22 10:04:55 -04:00
Nathan Hourt
eb022cef27 Merge branch 'master' of github.com:InvictusInnovations/fc
Conflicts:
	.gitignore
2014-07-22 10:00:25 -04:00
Eric Frias
0a1011ddc9 Fix win32 compile (increase size of tcp_socket) 2014-07-21 10:40:21 -04:00
Daniel Larimer
eed62c8338 sockets now wait for any pending write or read operations to finish before destructing 2014-07-17 17:03:25 -04:00
Eric Frias
f2cbb650c6 Merge branch 'master' of github.com:InvictusInnovations/fc 2014-07-14 19:26:17 -04:00
Eric Frias
c28ccd2413 Fix wacky types u_int32_t to uint32_t &c 2014-07-14 19:25:54 -04:00
Vikram Rajkumar
e442b29f6e Fix scrypt 2014-07-14 13:40:33 -04:00
Daniel Larimer
ace06d775c support for 8 param rpc calls 2014-07-04 17:23:47 -04:00
Vikram Rajkumar
c9c56ffbb6 Merge branch 'master' of https://github.com/InvictusInnovations/fc 2014-07-03 17:24:14 -04:00
Vikram Rajkumar
e9b1b8ec2e Use a separate thread for log compression 2014-07-03 17:24:06 -04:00
Eric Frias
c020913cb8 Make process::exec take an 'int' for the bitmask of launch options instead of an enum to make it more clear that it's a bitmask (and avoid a cast) 2014-07-03 09:30:50 -04:00
Vikram Rajkumar
cc1ef61cd6 Logs are now rotated on startup if rotation is enabled 2014-07-03 01:16:46 -04:00
Vikram Rajkumar
39c7f05ea9 Implement LZMA file decompression 2014-07-03 00:01:02 -04:00
Vikram Rajkumar
f56dd6d208 Implement LZMA file compression 2014-07-02 23:28:43 -04:00
Daniel Larimer
9f401c7143 Merge pull request #30 from nathanhourt/phoenix
Add missing synchronous call overload to json_connection
2014-07-02 17:40:52 -04:00
Vikram Rajkumar
c0187865ea Implement log file rotation 2014-07-02 17:36:21 -04:00
Vikram Rajkumar
748a9b52a5 Add time_point_sec::-( uint32_t ) 2014-07-01 13:38:24 -04:00
Vikram Rajkumar
0efad975cb Add missing const on time_point_sec::+ 2014-07-01 12:13:58 -04:00
Daniel Larimer
c33acad0ab fix udt sockets, actually enable non blocking operation 2014-06-29 01:38:46 -04:00
Daniel Larimer
d2072e9d3a updates to thread / udt socket 2014-06-26 20:10:56 -04:00
Daniel Larimer
8670a4722f Merge branch 'master' of https://github.com/InvictusInnovations/fc 2014-06-26 20:10:37 -04:00
Eric Frias
c925ceb232 Add a comparison operators for signed_int, correct the ones for unsigned_int 2014-06-26 15:51:35 -04:00
Eric Frias
560b107e58 Fix signed/unsigned warnings 2014-06-26 15:51:01 -04:00