Commit Graph

49 Commits

Author SHA1 Message Date
Tevin 650050ef9b
Add special thanks to @jakubgs 2019-11-12 15:57:04 +08:00
Tevin 04a3451fa2
Update go.mod 2019-11-12 11:29:27 +08:00
Jakub Sokołowski 8100eb9207
use x/sys/unix instead of syscall to fix EpollWait on Android
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-11-11 11:47:34 +01:00
Tevin 9f5b7a96d8
Merge pull request #13 from tevino/adjust-bench
Adjust benchmark
2019-03-06 16:36:16 +08:00
Tevin Zhang 482e2a9b8c Test against the latest go 2019-03-06 16:27:45 +08:00
Tevin Zhang b4b7e90e24 Find an address that will actually timeout in tests by testing 2019-03-06 16:24:31 +08:00
Tevin Zhang f190c4f619 Run benchmark via Travis CI 2019-03-06 16:24:31 +08:00
Tevin Zhang 45a3fe5ed8 Adjust timeout in benchmark 2019-03-06 16:24:31 +08:00
Tevin 9762d1c917
Merge pull request #12 from frankxyy/patch-1
Fix variable name
2019-03-06 11:07:32 +08:00
Yangyang Xu 2d71f9df05
fix variable name 2019-03-06 11:06:19 +08:00
Tevin d61444948d
Merge pull request #11 from tevino/travis
Add Travis CI
2019-02-13 11:08:49 +08:00
Tevin Zhang 0d34068678 Use 10.255.255.1:80 as an always-timeout address
Since 10.0.0.0:1 causes ErrConnect(permission denied) instead of ErrTimeout in Travis CI's macOS environment.
2019-02-13 11:05:36 +08:00
Tevin Zhang 6868d911df Add logging 2019-02-13 11:05:36 +08:00
Tevin Zhang 5cbfc67444 Add Travis CI 2019-02-13 11:05:36 +08:00
Tevin Zhang 793d50316e Unexport EPOLLET 2019-02-13 10:20:58 +08:00
Tevin Zhang f79f8fc471 Add comment 2019-02-13 10:20:15 +08:00
Tevin 0fca588859
Merge pull request #10 from tevino/benchmark
Add benchmark
2019-02-13 10:14:12 +08:00
Tevin Zhang b0f2b6a708 Add benchmarks
go version go1.11.4 linux/amd64

goos: linux
goarch: amd64
pkg: github.com/tevino/tcp-shaker
BenchmarkPipePoolDummyOK-32              	  300000	      4002 ns/op	     660 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolOK-32           	  300000	      3955 ns/op	     507 B/op	      14 allocs/op
BenchmarkPipePoolDummyErr-32             	  300000	      4026 ns/op	     613 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolErr-32          	  300000	      3973 ns/op	     526 B/op	      14 allocs/op
BenchmarkPipePoolDummyTimeout-32         	  300000	      3954 ns/op	     613 B/op	      16 allocs/op
BenchmarkPipePoolSyncPoolTimeout-32      	  300000	      3895 ns/op	     507 B/op	      14 allocs/op
BenchmarkResultPipesMUOK-32              	  300000	      4692 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapOK-32         	  300000	      3902 ns/op	     506 B/op	      14 allocs/op
BenchmarkResultPipesMUErr-32             	  300000	      4399 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapErr-32        	  300000	      3993 ns/op	     508 B/op	      14 allocs/op
BenchmarkResultPipesMUTimeout-32         	  300000	      4473 ns/op	     478 B/op	      12 allocs/op
BenchmarkResultPipesSyncMapTimeout-32    	  300000	      3947 ns/op	     507 B/op	      14 allocs/op
2019-02-12 19:03:06 +08:00
Tevin Zhang 562d62828d Add PipePool of different implementations 2019-02-12 18:40:29 +08:00
Tevin Zhang e298e4beb3 Add ResultPipes of different implementations 2019-02-12 18:40:29 +08:00
Tevin 32a4a549c2
Merge pull request #9 from tevino/refactor
Refactor
2019-02-12 16:40:31 +08:00
Tevin Zhang 070a54c143 Print error from CheckingLoop 2019-02-12 16:19:46 +08:00
Tevin Zhang f00667a79b WaitReady() before using checker 2019-02-12 16:19:46 +08:00
Tevin Zhang f3158e873d Add fds to epoll_ctl error message 2019-02-12 16:19:46 +08:00
Tevin Zhang 62afebf5fa Add -v for verbose logging 2019-02-12 16:19:20 +08:00
Tevin Zhang 2ef7e36ff8 Fix WaitReady() for nonlinux platform 2019-02-12 15:22:22 +08:00
Tevin Zhang a72775abcb Add special thanks 2019-02-12 15:22:22 +08:00
Tevin Zhang 8e82d76788 Ensure safety before reuse of pipe 2019-02-12 15:22:22 +08:00
Tevin Zhang 201333fdee Remove lock 2019-02-12 15:22:22 +08:00
Tevin Zhang 7c5283d607 Refine doc 2019-02-11 18:42:46 +08:00
Tevin Zhang a89fc1fe18 Refactor
Significant changes:

1. `NewChecker()` accepts no argument, `zeroLinger` is enabled by default
2. Optional parameter `zeroLinger` in `CheckAddr()` turned into `CheckerAddrZeroLinger()`
3. `InitChecker()` -> `CheckingLoop(context)`
4. `ErrNotInitialized` -> `ErrCheckerAlreadyStarted`
5. Fewer system call calling, e.g. `connect()` is called exactly once per check
6. Epoll is now edge-triggered
2019-02-11 17:54:51 +08:00
Tevin 1573d54316
Merge pull request #8 from lujjjh/zerolinger-on-nonlinux
Add zeroLinger support for non-Linux platform
2019-01-06 20:04:10 +08:00
lujjjh c27d2836c6
Add zeroLinger support for POSIX operating systems 2018-05-22 13:16:48 +08:00
Tevin Zhang 2d9369c3f0 Concurrent TCP Checker 2016-12-06 17:23:50 +08:00
Tevin Zhang ce742af518 Add fake implementation for non-Linux platform 2016-12-06 17:20:41 +08:00
Tevin Zhang 2d25c4a3e0 Retry connect when EINPROGRESS etc is encountered
Version older than this may leads to false positive results from CheckAddr
2016-10-18 21:00:00 +08:00
Tevin Zhang 882b0fcc11 A lot of adjustments
1. 'shaker' renamed to 'check', should have named the repo to
tcp-checker
2. Add NewChecker() for creation
3. Add parameter zeroLinger
4. More error handling (Error from syscall.Close is returned)
2016-07-26 19:25:46 +08:00
Tevin Zhang b34a84cbb7 Add tests 2016-07-22 19:37:07 +08:00
Tevin Zhang 83dc726525 Add more doc with some renames 2016-07-22 19:37:00 +08:00
Tevin Zhang f2b515e1c4 Add command line tool 2016-07-22 16:58:53 +08:00
Tevin Zhang fecad2b47b Add Go Report Card 2016-06-28 18:10:56 +08:00
Tevin Zhang ecd883184f Refine package description 2016-06-02 11:08:46 +08:00
Tevin Zhang b1b6beb4d3 Add usage in README 2016-06-01 18:23:31 +08:00
Tevin Zhang 9b0c49fe5e Fix typo 2016-06-01 18:18:41 +08:00
Tevin Zhang 67b523fe25 Better error handling 2016-06-01 17:47:04 +08:00
Tevin Zhang 944163aafd Add Shaker.Ready() and Shaker.EpollFd() 2016-06-01 17:46:36 +08:00
Tevin Zhang f6beed899b Make Shaker's methods goroutine safe 2016-06-01 17:46:12 +08:00
Tevin Zhang 0c7007486a First commit 2016-06-01 13:42:41 +08:00
Tevin Zhang 69c453cad7 Initial commit 2016-05-31 18:19:07 +08:00