NodeSSH Reconnect Issue: isConnected() Returns TRUE Even When Connection Unsuccessful
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu từ phương thức connect của TypeScript và theo dõi thời điểm this.connection được gán so với các sự kiện ready, error, end và close của SSH2. Xác nhận thay đổi bằng cách kiểm tra rằng isConnected() không báo có kết nối sau một reconnect không thành công; issue không nêu tên tệp hoặc bài kiểm thử nào cần chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am encountering an issue which seems to be related to ISSUE-429, where the problem still persists. As im not aware of any pitfalls in the code, i have created a suggestion to resolve the issue.
Description:
The problem is caused by the assignment of the this.connection property before the connection promise resolves. Specifically, the this.connection property is being set before the connection.on('ready') event is triggered.
Proposed Solution:
To resolve this issue, I suggest moving the assignment of this.connection inside the connection.on('ready') event in the connect method:
public async connect(givenConfig: Config): Promise<this> {
// ... (Rest of the code remains the same)
const connection = new SSH2.Client();
await new Promise<void>((resolve, reject) => {
connection.on('error', reject);
if (config.onKeyboardInteractive) {
connection.on('keyboard-interactive', config.onKeyboardInteractive);
}
connection.on('ready', () => {
connection.removeListener('error', reject);
this.connection = connection; // Move this line inside the 'ready' event
resolve();
});
connection.on('end', () => {
if (this.connection === connection) {
this.connection = null;
}
});
connection.on('close', () => {
if (this.connection === connection) {
this.connection = null;
}
reject(new SSHError('No response from server', 'ETIMEDOUT'));
});
connection.connect(config);
});
return this;
}
Will i help?
Yeah, let us discuss and i can create a PR :)
- Ngôn ngữ chính
- TypeScript
- Star
- 1k
- Fork
- 94
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của steelbrain/node-ssh
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
steelbrain/node-ssh#487 ·
-
ssh-certificate supportĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
steelbrain/node-ssh#482 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
steelbrain/node-ssh#474 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
steelbrain/node-ssh#473 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
steelbrain/node-ssh#472 ·
Tất cả issue của steelbrain/node-ssh
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundariesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
lingdojo/kana-dojo#34127 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
osmlab/name-suggestion-index#13104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100