mirror of https://github.com/ipxe/ipxe.git
Make tcp_connect() void; it will eventually have no failure case.
parent
9c9208a132
commit
7af478b30d
|
@ -41,6 +41,6 @@ struct hello_request {
|
||||||
int complete;
|
int complete;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int hello_connect ( struct hello_request *hello );
|
extern void hello_connect ( struct hello_request *hello );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct tcp_connection {
|
||||||
|
|
||||||
extern void *tcp_buffer;
|
extern void *tcp_buffer;
|
||||||
extern size_t tcp_buflen;
|
extern size_t tcp_buflen;
|
||||||
extern int tcp_connect ( struct tcp_connection *conn );
|
extern void tcp_connect ( struct tcp_connection *conn );
|
||||||
extern void tcp_send ( struct tcp_connection *conn, const void *data,
|
extern void tcp_send ( struct tcp_connection *conn, const void *data,
|
||||||
size_t len );
|
size_t len );
|
||||||
extern void tcp_close ( struct tcp_connection *conn );
|
extern void tcp_close ( struct tcp_connection *conn );
|
||||||
|
|
|
@ -64,18 +64,11 @@ size_t tcp_buflen = UIP_BUFSIZE - ( 40 + UIP_LLH_LEN );
|
||||||
* Open a TCP connection
|
* Open a TCP connection
|
||||||
*
|
*
|
||||||
* @v conn TCP connection
|
* @v conn TCP connection
|
||||||
* @ret 0 Success
|
|
||||||
* @ret <0 Failure
|
|
||||||
*
|
*
|
||||||
* This sets up a new TCP connection to the remote host specified in
|
* This sets up a new TCP connection to the remote host specified in
|
||||||
* tcp_connection::sin. The actual SYN packet will not be sent out
|
* tcp_connection::sin.
|
||||||
* until run_tcpip() is called for the first time.
|
|
||||||
*
|
|
||||||
* @todo Use linked lists instead of a static buffer, and thereby
|
|
||||||
* remove the only potential failure case, giving this function
|
|
||||||
* a void return type.
|
|
||||||
*/
|
*/
|
||||||
int tcp_connect ( struct tcp_connection *conn ) {
|
void tcp_connect ( struct tcp_connection *conn ) {
|
||||||
struct uip_conn *uip_conn;
|
struct uip_conn *uip_conn;
|
||||||
u16_t ipaddr[2];
|
u16_t ipaddr[2];
|
||||||
|
|
||||||
|
@ -86,11 +79,9 @@ int tcp_connect ( struct tcp_connection *conn ) {
|
||||||
|
|
||||||
* ( ( uint32_t * ) ipaddr ) = conn->sin.sin_addr.s_addr;
|
* ( ( uint32_t * ) ipaddr ) = conn->sin.sin_addr.s_addr;
|
||||||
uip_conn = uip_connect ( ipaddr, conn->sin.sin_port );
|
uip_conn = uip_connect ( ipaddr, conn->sin.sin_port );
|
||||||
if ( ! uip_conn )
|
#warning "Use linked lists so that uip_connect() cannot fail"
|
||||||
return -1;
|
assert ( uip_conn != NULL );
|
||||||
|
|
||||||
*( ( void ** ) uip_conn->appstate ) = conn;
|
*( ( void ** ) uip_conn->appstate ) = conn;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -544,8 +544,7 @@ void iscsi_wakeup ( struct iscsi_session *iscsi ) {
|
||||||
switch ( iscsi->state ) {
|
switch ( iscsi->state ) {
|
||||||
case ISCSI_STATE_NOT_CONNECTED:
|
case ISCSI_STATE_NOT_CONNECTED:
|
||||||
case ISCSI_STATE_FAILED:
|
case ISCSI_STATE_FAILED:
|
||||||
if ( tcp_connect ( &iscsi->tcp ) != 0 )
|
tcp_connect ( &iscsi->tcp );
|
||||||
iscsi_fail ( iscsi );
|
|
||||||
iscsi_start_login ( iscsi );
|
iscsi_start_login ( iscsi );
|
||||||
break;
|
break;
|
||||||
case ISCSI_STATE_IDLE:
|
case ISCSI_STATE_IDLE:
|
||||||
|
|
Loading…
Reference in New Issue