diff --git a/iso.c b/iso.c index a02e076..7feb24b 100644 --- a/iso.c +++ b/iso.c @@ -174,38 +174,21 @@ iso_recv(uint8 * rdpver) /* Establish a connection up to the ISO layer */ RD_BOOL -iso_connect(char *server, char *username) +iso_connect(char *server, char *username, RD_BOOL reconnect) { uint8 code = 0; if (!tcp_connect(server)) return False; - iso_send_connection_request(username); - - if (iso_recv_msg(&code, NULL) == NULL) - return False; - - if (code != ISO_PDU_CC) + if (reconnect) { - error("expected CC, got 0x%x\n", code); - tcp_disconnect(); - return False; + iso_send_msg(ISO_PDU_CR); + } + else + { + iso_send_connection_request(username); } - - return True; -} - -/* Establish a reconnection up to the ISO layer */ -RD_BOOL -iso_reconnect(char *server) -{ - uint8 code = 0; - - if (!tcp_connect(server)) - return False; - - iso_send_msg(ISO_PDU_CR); if (iso_recv_msg(&code, NULL) == NULL) return False; diff --git a/mcs.c b/mcs.c index 7c9f2eb..54a576f 100644 --- a/mcs.c +++ b/mcs.c @@ -377,16 +377,8 @@ mcs_connect_common(char *server, STREAM mcs_data, char *username, RD_BOOL reconn { unsigned int i; - if (reconnect) - { - if (!iso_reconnect(server)) - return False; - } - else - { - if (!iso_connect(server, username)) - return False; - } + if (!iso_connect(server, username, reconnect)) + return False; mcs_send_connect_initial(mcs_data); if (!mcs_recv_connect_response(mcs_data)) diff --git a/proto.h b/proto.h index 70ee9ad..4dd6130 100644 --- a/proto.h +++ b/proto.h @@ -75,8 +75,7 @@ void ewmh_init(void); STREAM iso_init(int length); void iso_send(STREAM s); STREAM iso_recv(uint8 * rdpver); -RD_BOOL iso_connect(char *server, char *username); -RD_BOOL iso_reconnect(char *server); +RD_BOOL iso_connect(char *server, char *username, RD_BOOL reconnect); void iso_disconnect(void); void iso_reset_state(void); /* licence.c */