Commit Graph

62 Commits

Author SHA1 Message Date
Dmitriy Ryajov 71640da8f2 remove close from read/write methods 2020-06-02 09:10:27 -06:00
Dmitriy Ryajov 6e0eb93d4f remove readloops 2020-06-02 09:10:27 -06:00
Dmitriy Ryajov 9c2f31262e wip: try handling child stream exceptions 2020-06-02 09:10:27 -06:00
Jacek Sieka 69abf5097d
handle a few exceptions (#170)
* handle a few exceptions

Some of these are maybe too aggressive, but in return, they'll log
their exception - more refactoring needed to sort this out - right now
we get crashes on unhandled exceptions of unknown origin

* during connection setup
* while closing channels
* while processing pubsubs

* catch exceptions that are raised and don't try to catch exceptions that are not raised

* propagate cancellederror

* one more

* more

* more

* make interop tests less fragile

* Raise expiration time in gossipsub fanout test for slow CI

Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Giovanni Petrantoni <giovanni@fragcolor.xyz>
2020-05-14 21:56:56 -06:00
Jacek Sieka 618e01eba3
don't crash on double peerinfo close (#167) 2020-05-11 21:05:24 +02:00
Jacek Sieka 3053f03814 fix varint issues
* fixes #111
2020-05-11 09:12:23 -06:00
Jacek Sieka 1efada474c
remove readLoop in secure protocols (#162)
* remove readLoop in secure protocols, fix security issues

* fix Defect on remote sending 0-byte noise/secio message
* remove msglen from `write` (unused)
* simplify SecureConn data flow
* document some control-flow issues

* unify exception behaviour across noise and secio

* secio would not raise on mac/decryption errors

* fix compile error
2020-05-07 14:37:46 -06:00
Jacek Sieka 330da51819
removals (#159)
* remove unused stream methods
* reimplement some of them with proc's
* remove broken tests
* Error->Defect for defect
* warning fixes
2020-05-06 18:31:47 +02:00
Giovanni Petrantoni 4c6a123d31
Add chronos trackers and used them to sanitize resource disposal (#131)
* Add chronos trackers and used them to sanitize resource disposal

* Chronos trackers for transport tests wip

* No more chronos leaks in testtransport

* Make tcp transport and test more robust when closing

* Test async leaking tracking wip

* Fix a regression in wire connect

* Add chronos trackers to more tests and sanitize resource closure

* Wip fixing floodsub tests

* Floodsub wip

* Made floodsub basically deterministic, hit a nim bug with captures tho

* Wrap up floodsub tests refactor

* Wrapping up

* Add allFuturesThrowing utility

* Fix missing allFuturesThrowing in noise tests!

* Make tests green

* attempt fixing gossipsub failing cases

* Make sure to check also fanout in waitSub

* More verbose traces

* Gossipsub test improvments

* Refactor TcpTransport remove asyncCheck

* Add Connection trackers

* Add stricter connection tracking, wip mplex fix

* More asynccheck removal, in order to avoid connection leaks

* bump chronicles requirement

* Enable tracker dump to check CI output

* Wait for more futures in testmplex

* Remove tracker dump messages

* add tryAndWarn utility, fix mplex issue with go interop

* All allFuturesThrowing to directchat too

* make sure to cleanup on transport close
2020-04-21 10:24:42 +09:00
Ștefan Talpalaru eaa73ae6e8
add stream metrics (#136)
* add stream metrics

- just BufferStream and Connection are tracked, for now
- flag checking is enforced more strictly in close(), since it became
  clear that instances are closed multiple times

* add "metrics" dependency

and sort the list
2020-04-14 15:27:07 +02:00
Ștefan Talpalaru 7723403b1f
debug prints (#132)
* debug prints

* CI: enable stack traces

* Azure: better NimBinaries cache key

* CI changes

- Azure: remove Linux target
- Travis: add ARM64 target

* uglify the code in order to save 12 bytes per LPStream object
2020-04-14 15:21:16 +02:00
Dmitriy Ryajov f4740c8b8e fix trace runs in connection 2020-04-07 14:55:05 -06:00
Dmitriy Ryajov 6cbcc7859e reduse usssage of asyncCheck 2020-04-07 12:16:59 -06:00
Dmitriy Ryajov 976164ba3c proper connection cleanup 2020-04-07 12:16:59 -06:00
Dmitriy Ryajov e4303110a6 properly close connections 2020-04-07 12:16:59 -06:00
Dmitriy Ryajov a35ecc6227 reverting connection changes 2020-03-28 09:29:43 -06:00
Dmitriy Ryajov 3effb95f10 close underlying bufferstream in lpchannel 2020-03-28 09:29:43 -06:00
Dmitriy Ryajov 53e163abf2 check for size bounds when reading varints 2020-02-16 11:31:35 -06:00
Giovanni Petrantoni ea0d167285 Fix max size write mplex test 2020-02-12 11:57:38 -05:00
Giovanni Petrantoni f9cbdc252f Improve connection.nim read error clarity when buffer overflow 2020-02-12 11:57:38 -05:00
Giovanni Petrantoni 3531ebf772 Fix typo 2020-02-12 11:57:38 -05:00
Giovanni Petrantoni 23712ecf3b
Lazy channels (#78)
* Implemented lazy stream opening for mplex connections

* Properly fix newStream usage

* Make lazy channel open optional

* Add Lazy channel test

* Cleanup mplex test

* Move lazyness properly into LPChannel

* Connection writeLp back to proc
2020-02-11 12:30:36 -05:00
Dmitriy Ryajov 88a030d8fb fix: removing timeouts from conn 2020-02-05 20:38:43 +01:00
Dmitriy Ryajov 691efaa8a1 dont use result 2020-01-30 09:30:08 -06:00
Dmitriy Ryajov 171d60fb52 fix: reraise exception in readLp 2020-01-30 09:30:08 -06:00
Dmitriy Ryajov c6561b8851 add timeouts to connection/secio 2020-01-09 12:55:21 -06:00
Dmitriy Ryajov 68cc57669e
Feat/pubsub validators (#58)
* feat: adding validator hooks to pubsub

* expose add/remove validators on switch

* do less unnecessary copyng
2019-12-16 23:24:03 -06:00
Dmitriy Ryajov 293a219dbe
Cleanup (#55)
* fix: don't allow replacing pubkey

* fix: several small improvements

* removing pubkey setter

* improove error handling

* remove the use of Option[T] if not needed

* don't use optional

* fix-ci: temporarily pin p2pd to a working tag

* fix example to comply with latest changes

* bumping p2pd again to a higher version
2019-12-10 14:50:35 -06:00
Dmitriy Ryajov 5f6fcc3d90
extract public and private keys fields from peerid (#44)
* extract public and private keys fields from peerid

* allow assigning a public key

* cleaned up TODOs

* make pubsub prefix a const

* public key should be an `Option`
2019-12-07 10:36:39 -06:00
Dmitriy Ryajov 903e79ede1
Feat/conn cleanup (#41)
Backporting proper connection cleanup from #36 to align with latest chronos changes.

* add close event

* use proper varint encoding

* add proper channel cleanup in mplex

* add connection cleanup in secio

* tidy up

* add dollar operator

* fix tests

* don't close connections prematurely

* handle closing streams properly

* misc

* implement address filtering logic

* adding pipe tests

* don't use gcsafe if not needed

* misc

* proper connection cleanup and stream muxing

* re-enable pubsub tests
2019-12-03 22:44:54 -06:00
Dmitriy Ryajov 3194e3ac5b fixes after building with 0.20.2 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov bb277d4b56 readLp should warn on ignored exceptions 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov bc46a76029 connection should raise on invalid varint 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 15bae7bec5 use `result` instead of buffer 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov b5c4eaf9b8 don't use result in oneliners 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 5ae37cac98 no more buffer resets on len prefixed reads 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 99869aa8b8 don't reset buffer on exception 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 9862064234 changed copyright year 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 054085620c logging: switch debug for trace in most cases 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov ef89e98479 renaming channel 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 003b72ec27 adding bool 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov fc36de21c1 handle exceptions correctly 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov e31966b6f8 fix: switch, with identify and mplex 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 6086038b01 raise correct LP exception on incomplete data 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov f8a942ed67 make peerinfo an optional type 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 9bc7043f48 export read size const 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 40e75a7635 remove useless methods 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 5177bbb492 fix: return on read error 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov cbf0f4f186 move streams to own dir 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 1cef1b803b don't await twise 2019-10-11 08:15:24 +09:00