struct HandleData is now called struct SingleRequest, and is only for data that
is inited at the start of the DO action. I removed the Curl_transfer_keeper struct completely, and I had to move out a few struct members (that had to be set before DO or used after DONE) to the UrlState struct. The SingleRequest struct is accessed with SessionHandle->req. One of the biggest reasons for doing this was the bunch of duplicate struct members in HandleData and Curl_transfer_keeper since it was really messy to keep track of two variables with the same name and basically the same purpose!
This commit is contained in:
30
lib/telnet.c
30
lib/telnet.c
@@ -245,7 +245,7 @@ CURLcode init_telnet(struct connectdata *conn)
|
||||
if(!tn)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
conn->data->reqdata.proto.telnet = (void *)tn; /* make us known */
|
||||
conn->data->state.proto.telnet = (void *)tn; /* make us known */
|
||||
|
||||
tn->telrcv_state = CURL_TS_DATA;
|
||||
|
||||
@@ -264,7 +264,7 @@ CURLcode init_telnet(struct connectdata *conn)
|
||||
static void negotiate(struct connectdata *conn)
|
||||
{
|
||||
int i;
|
||||
struct TELNET *tn = (struct TELNET *) conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *) conn->data->state.proto.telnet;
|
||||
|
||||
for(i = 0;i < CURL_NTELOPTS;i++)
|
||||
{
|
||||
@@ -340,7 +340,7 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
|
||||
static
|
||||
void set_remote_option(struct connectdata *conn, int option, int newstate)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
if(newstate == CURL_YES)
|
||||
{
|
||||
switch(tn->him[option])
|
||||
@@ -422,7 +422,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
|
||||
static
|
||||
void rec_will(struct connectdata *conn, int option)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
switch(tn->him[option])
|
||||
{
|
||||
case CURL_NO:
|
||||
@@ -475,7 +475,7 @@ void rec_will(struct connectdata *conn, int option)
|
||||
static
|
||||
void rec_wont(struct connectdata *conn, int option)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
switch(tn->him[option])
|
||||
{
|
||||
case CURL_NO:
|
||||
@@ -520,7 +520,7 @@ void rec_wont(struct connectdata *conn, int option)
|
||||
static void
|
||||
set_local_option(struct connectdata *conn, int option, int newstate)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
if(newstate == CURL_YES)
|
||||
{
|
||||
switch(tn->us[option])
|
||||
@@ -602,7 +602,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
|
||||
static
|
||||
void rec_do(struct connectdata *conn, int option)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
switch(tn->us[option])
|
||||
{
|
||||
case CURL_NO:
|
||||
@@ -655,7 +655,7 @@ void rec_do(struct connectdata *conn, int option)
|
||||
static
|
||||
void rec_dont(struct connectdata *conn, int option)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
switch(tn->us[option])
|
||||
{
|
||||
case CURL_NO:
|
||||
@@ -817,7 +817,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
|
||||
char option_arg[256];
|
||||
char *buf;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
|
||||
/* Add the user name as an environment variable if it
|
||||
was given on the command line */
|
||||
@@ -888,7 +888,7 @@ static void suboption(struct connectdata *conn)
|
||||
char varname[128];
|
||||
char varval[128];
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct TELNET *tn = (struct TELNET *)data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;
|
||||
|
||||
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn)+2);
|
||||
switch (CURL_SB_GET(tn)) {
|
||||
@@ -956,7 +956,7 @@ void telrcv(struct connectdata *conn,
|
||||
int in = 0;
|
||||
int startwrite=-1;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct TELNET *tn = (struct TELNET *)data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;
|
||||
|
||||
#define startskipping() \
|
||||
if(startwrite >= 0) \
|
||||
@@ -1120,14 +1120,14 @@ void telrcv(struct connectdata *conn,
|
||||
static CURLcode Curl_telnet_done(struct connectdata *conn,
|
||||
CURLcode status, bool premature)
|
||||
{
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->reqdata.proto.telnet;
|
||||
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
|
||||
(void)status; /* unused */
|
||||
(void)premature; /* not used */
|
||||
|
||||
curl_slist_free_all(tn->telnet_vars);
|
||||
|
||||
free(conn->data->reqdata.proto.telnet);
|
||||
conn->data->reqdata.proto.telnet = NULL;
|
||||
free(conn->data->state.proto.telnet);
|
||||
conn->data->state.proto.telnet = NULL;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -1166,7 +1166,7 @@ static CURLcode Curl_telnet(struct connectdata *conn, bool *done)
|
||||
if(code)
|
||||
return code;
|
||||
|
||||
tn = (struct TELNET *)data->reqdata.proto.telnet;
|
||||
tn = (struct TELNET *)data->state.proto.telnet;
|
||||
|
||||
code = check_telnet_options(conn);
|
||||
if(code)
|
||||
|
||||
Reference in New Issue
Block a user