aboutsummaryrefslogtreecommitdiff
path: root/lib/tftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-11-14 22:41:42 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-11-14 22:41:42 +0000
commitb22e03b2b2504e0561a0a3f434836f476f1b83f3 (patch)
tree07aa55cca86c82c408399d171fb9da3dabbae97a /lib/tftp.c
parenta2926ebe7ca9e619f9d85d9b1d12d90f1fc714f4 (diff)
Fix how TFTP connections are treated when re-used, if the SessionHandle has
been used for other protocols in between. I found this when test 2004 started to fail for me!
Diffstat (limited to 'lib/tftp.c')
-rw-r--r--lib/tftp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index acab99334..8ed71df3b 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -698,8 +698,7 @@ static CURLcode Curl_tftp_done(struct connectdata *conn, CURLcode status,
static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
{
struct SessionHandle *data = conn->data;
- tftp_state_data_t *state =
- (tftp_state_data_t *) conn->data->reqdata.proto.tftp;
+ tftp_state_data_t *state;
tftp_event_t event;
CURLcode code;
int rc;
@@ -716,12 +715,14 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
make sure we have a good 'struct TFTP' to play with. For new connections,
the struct TFTP is allocated and setup in the Curl_tftp_connect() function.
*/
- if(!state) {
+ Curl_reset_reqproto(conn);
+
+ if(!data->reqdata.proto.tftp) {
code = Curl_tftp_connect(conn, done);
if(code)
return code;
- state = (tftp_state_data_t *)conn->data->reqdata.proto.tftp;
}
+ state = (tftp_state_data_t *)conn->data->reqdata.proto.tftp;
code = Curl_readwrite_init(conn);
if(code)