Add HTTP_CON_FLAG_CONNECTING flag to track connection state and prevent
accessing freed connection objects during asynchronous operations.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Convert the `https` boolean field to a flags-based approach using
HTTP_CON_FLAG_HTTPS. This provides better extensibility for future
connection state flags while maintaining existing HTTPS functionality.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit enhances the handling of server-side HTTP disconnections by
implementing a zero-length message notification mechanism.
This change ensures proper notification of server-side disconnections to
device-side rtty instances, fixing cases where HTTP connections would remain
open after server disconnection.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
- Remove redundant 'busy' flag, use ctlfd > -1 to check busy state
- Remove 'sid' field from file_context, use tty->sid directly
- Fix fd comparison to use > -1 instead of > 0 for consistency
- Simplify file_context_reset by removing unnecessary busy flag reset
This reduces memory usage and
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Split file operation constants into two separate enums:
- RTTY_FILE_MSG_* for protocol messages between client/server
- RTTY_FILE_CTL_* for control messages via FIFO
This improves code clarity by distinguishing between different
types of file transfer communication channels.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Increase UPLOAD_FILE_BUF_SIZE from 16KB to 63KB to improve
file transfer performance by reducing the number of read/write
operations and system calls during large file uploads.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Replace manual timestamp tracking with libev's ev_timer_again()
for more reliable timeout handling.
- Remove manual timeout calculation in tty_timer_cb()
- Use ev_timer_again() to restart timer on activity
- Remove unused 'active' field from tty struct
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Introduce new '-g/--group' option to specify device group.
The changes allow organizing devices into groups by adding a new group
option that gets included in the registration message.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Moved the device ID validation check from post-parsing to the point
of option handling for '-I'. This ensures invalid IDs are caught
earlier during command-line processing.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
If other messages are received for a long time, causing the heartbeat
packet to be delayed in being received, it will lead to a heartbeat
timeout and disconnection. However, if other data arrives, we consider
the server to be active.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Random delay of 5 to 14 seconds to prevent a large number of
devices connecting to the server simultaneously.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Usually, commands are executed in batches on multiple devices,
but the password for each device is different. Therefore, the
password parameter is removed.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
Note: The communication protocol version has been changed to 5.
Change-Id: I44155cac65d0bc86b9b6e85420deb873929ab80b
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>