Fixes to make telnet interface work more than 1x.
This commit is contained in:
parent
6ab443545f
commit
9a4152eb2d
@ -339,9 +339,8 @@ int SGSocket::readline( char *buf, int length ) {
|
|||||||
// cout << "sock_stream\n";
|
// cout << "sock_stream\n";
|
||||||
if ( msgsock == INVALID_SOCKET ) {
|
if ( msgsock == INVALID_SOCKET ) {
|
||||||
// cout << "msgsock == invalid\n";
|
// cout << "msgsock == invalid\n";
|
||||||
msgsock = accept(sock, 0, 0);
|
msgsock = sock;
|
||||||
closesocket(sock);
|
sock = accept(msgsock, 0, 0);
|
||||||
sock = msgsock;
|
|
||||||
} else {
|
} else {
|
||||||
// cout << "ready to read\n";
|
// cout << "ready to read\n";
|
||||||
char *buf_ptr = save_buf + save_len;
|
char *buf_ptr = save_buf + save_len;
|
||||||
@ -361,8 +360,7 @@ int SGSocket::readline( char *buf, int length ) {
|
|||||||
if ( result == 0 && save_len == 0 && first_read == true ) {
|
if ( result == 0 && save_len == 0 && first_read == true ) {
|
||||||
SG_LOG( SG_IO, SG_ALERT,
|
SG_LOG( SG_IO, SG_ALERT,
|
||||||
"Connection closed by foreign host." );
|
"Connection closed by foreign host." );
|
||||||
closesocket(sock);
|
close();
|
||||||
open( get_dir() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -494,6 +492,10 @@ bool SGSocket::close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closesocket( sock );
|
closesocket( sock );
|
||||||
|
if ( sock_style == SOCK_STREAM && msgsock != INVALID_SOCKET ) {
|
||||||
|
sock = msgsock;
|
||||||
|
msgsock = INVALID_SOCKET;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user