diff options
author | Mario Campos <mario-campos@github.com> | 2023-08-22 18:59:59 -0500 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-09-06 14:11:35 +0200 |
commit | 7f0f947667ec6ed22b30e205627da51dffe620c4 (patch) | |
tree | 0aa2cdac02e136220bd6d2f1b95c6990d52ca962 /src/plugins/xfer/xfer-dcc.c | |
parent | 23d70b5101f8a8ca9cac92e25b783c8259ab14df (diff) | |
download | weechat-7f0f947667ec6ed22b30e205627da51dffe620c4.zip |
xfer: add passive DCC support.
This commit also includes support for passive DCC RESUME.
There was also a potential segfault with calling `atoi(pos_token)` when `pos_token` is NULL, so `token` is set to be stored as a string. Although it is an integer, we don't need to store it as such. That's really more of an implementation detail.
Diffstat (limited to 'src/plugins/xfer/xfer-dcc.c')
-rw-r--r-- | src/plugins/xfer/xfer-dcc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/plugins/xfer/xfer-dcc.c b/src/plugins/xfer/xfer-dcc.c index 3c4a37d22..e9d019d03 100644 --- a/src/plugins/xfer/xfer-dcc.c +++ b/src/plugins/xfer/xfer-dcc.c @@ -342,14 +342,17 @@ xfer_dcc_recv_file_child (struct t_xfer *xfer) } /* first connect to sender (blocking) */ - xfer->sock = weechat_network_connect_to (xfer->proxy, - xfer->remote_address, - xfer->remote_address_length); - if (xfer->sock == -1) + if (xfer->type == XFER_TYPE_FILE_RECV_ACTIVE) { - xfer_network_write_pipe (xfer, XFER_STATUS_FAILED, - XFER_ERROR_CONNECT_SENDER); - return; + xfer->sock = weechat_network_connect_to (xfer->proxy, + xfer->remote_address, + xfer->remote_address_length); + if (xfer->sock == -1) + { + xfer_network_write_pipe (xfer, XFER_STATUS_FAILED, + XFER_ERROR_CONNECT_SENDER); + return; + } } /* set TCP_NODELAY to be more aggressive with acks */ |