Comments (10)
Nice, thanks, ss is even faster than netstat. You can also set --forward-port=some available port to skip the port detection altogether. That's actually a bit faster as well.
I'd like to get rid of the whole netstat calling logic and detect the ports in the remote components (e.g. cdc_rsync_server) in code, but that'll require some bigger refactorings since right now cdc_rsync_server and port forwarding are started at the same time.
from cdc-file-transfer.
I'll replace the netstat command by
if which ss; then ss --numeric --listening --tcp; else netstat --numeric --listening --tcp; fi
from cdc-file-transfer.
@ljusten remote_util->BuildProcessStartInfoForSsh
can handle shell scripts, right?
cdc-file-transfer/common/port_manager_win.cc
Lines 235 to 283 in d8c2b59
The candidate you have just show me may not work if the remote shell is fish or other shells incompatible with sh.
It's great if we can grab the status code of a one-shot command (e.g. which ss
) in a single function call.
from cdc-file-transfer.
That's true, but we already run similar code elsewhere, so at least it doesn't make the problem more severe. The real solution is to get rid of all shell scripts, but that's much more work.
from cdc-file-transfer.
Actually, this should work in a wider range of (all?) shells:
which ss && ss --numeric --listening --tcp || netstat --numeric --listening --tcp
It also has the advantage that it falls back to netstat if executing ss fails.
from cdc-file-transfer.
@ljusten It has more portability. I'm afraid the ss
's path vomited by which
could occur unintended behavior.
$ which git && echo aaa || echo bbb
/usr/bin/git
aaa
$ which foo && echo aaa || echo bbb
bbb
Is it ignored when analyzed?
from cdc-file-transfer.
Yes, it's ignored when analyzed. It can be hidden by adding > /dev/null
after which ss
, but I think it's a useful thing to have in debug logs since this way we know which one was executed.
from cdc-file-transfer.
@ljusten I got it. I'll leave it to you. I've appreciated your quick response.
from cdc-file-transfer.
I found missing netstat is treated as the connection timeout without -vvv.
This causes users' misunderstanding.
from cdc-file-transfer.
@ljusten Thank you for the fix!
from cdc-file-transfer.
Related Issues (20)
- hetzner clound cdc_rsync HOT 3
- EOF detected; Failed to receive packet of size 4
- Teste
- [cdc_rsync] [cdc_stream] Use sftp for deployment HOT 1
- Clean up mentiones of gamelet and related
- Readme in release zip files is missing png files
- QUESTION - LINUX ONLY HOT 7
- Deploy cdc_rsync_server based upon target system cpu architecture HOT 2
- Can cdc_rsync be used as a local Windows rsync tool? HOT 10
- [Feature Request] Support for MacOS HOT 1
- Document how cdc-file-transfer is installed
- Do port detection in cdc_rsync_server and cdc_fuse_fs instead of running netstat/ss
- Get rid of shell scripting in ssh commands
- Docs should mention the need to install vc_redist
- fastcdc implementation sets chunk boundaries before last gear-hashed byte. HOT 4
- Remove git submodules HOT 3
- Patching of file isn't working HOT 3
- [cdc_rsync] Fails to overwrite directory with a file
- problem with comping in SLES 12sp5 gcc7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdc-file-transfer.