mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
Core: Socket::GetLine fixed reaction to EOF
git-svn-id: svn://ultimatepp.org/upp/trunk@7104 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
2c7ae75f66
commit
d2af891121
5 changed files with 18 additions and 9 deletions
|
|
@ -15,7 +15,7 @@ NAMESPACE_UPP
|
|||
#pragma comment(lib, "ws2_32.lib")
|
||||
#endif
|
||||
|
||||
#define LLOG(x) // DLOG("TCP " << x)
|
||||
#define LLOG(x) // LOG("TCP " << x)
|
||||
|
||||
IpAddrInfo::Entry IpAddrInfo::pool[COUNT];
|
||||
|
||||
|
|
@ -741,6 +741,11 @@ void TcpSocket::ReadBuffer(int end_time)
|
|||
end = buffer + Recv(buffer, BUFFERSIZE);
|
||||
}
|
||||
|
||||
bool TcpSocket::IsEof() const
|
||||
{
|
||||
return is_eof && ptr == end || IsAbort() || !IsOpen() || IsError();
|
||||
}
|
||||
|
||||
int TcpSocket::Get_()
|
||||
{
|
||||
if(!IsOpen() || IsError() || IsEof() || IsAbort())
|
||||
|
|
@ -829,10 +834,12 @@ String TcpSocket::GetAll(int len)
|
|||
|
||||
String TcpSocket::GetLine(int maxlen)
|
||||
{
|
||||
LLOG("GetLine " << maxlen);
|
||||
LLOG("GetLine " << maxlen << ", iseof " << IsEof());
|
||||
String ln;
|
||||
int end_time = GetEndTime();
|
||||
for(;;) {
|
||||
if(IsEof())
|
||||
return String::GetVoid();
|
||||
int c = Peek(end_time);
|
||||
if(c < 0) {
|
||||
if(!IsError())
|
||||
|
|
|
|||
Loading…
Reference in a new issue