Fixed bug where connection errors caused 100% cpu.
parent
7cbebef352
commit
4eee66d16a
|
@ -278,7 +278,7 @@ void JNL_Connection::run(int max_send_bytes, int max_recv_bytes, int *bytes_sent
|
||||||
*/
|
*/
|
||||||
int res = socket_recv(m_recv_buffer+m_recv_pos,len,0);
|
int res = socket_recv(m_recv_buffer+m_recv_pos,len,0);
|
||||||
|
|
||||||
if (res == 0 || (res < 0 && ERRNO != EWOULDBLOCK))
|
if (res <= 0 || (res < 0 && ERRNO != EWOULDBLOCK))
|
||||||
{
|
{
|
||||||
m_state=STATE_CLOSED;
|
m_state=STATE_CLOSED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -76,12 +76,12 @@
|
||||||
int totalRead = 0;
|
int totalRead = 0;
|
||||||
|
|
||||||
while (totalRead < amount) {
|
while (totalRead < amount) {
|
||||||
int status = _get->run();
|
int result = _get->run();
|
||||||
int amountRead = _get->get_bytes((char *)((uint8_t *)buffer) + totalRead, amount - totalRead);
|
int amountRead = _get->get_bytes((char *)((uint8_t *)buffer) + totalRead, amount - totalRead);
|
||||||
|
|
||||||
totalRead += amountRead;
|
if (result != 0 && 0 == amountRead) break;
|
||||||
|
|
||||||
if (status && 0 == amountRead) break;
|
totalRead += amountRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
_byteCount += totalRead;
|
_byteCount += totalRead;
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 17F6C6400F5F9E3F000D9DA9 /* JNetLib.xcodeproj */;
|
containerPortal = 17F6C6400F5F9E3F000D9DA9 /* JNetLib.xcodeproj */;
|
||||||
proxyType = 2;
|
proxyType = 2;
|
||||||
remoteGlobalIDString = 8DC2EF5B0486A6940098B216 /* JNetLib.framework */;
|
remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
|
||||||
remoteInfo = JNetLib;
|
remoteInfo = JNetLib;
|
||||||
};
|
};
|
||||||
17F6C6800F5F9FFE000D9DA9 /* PBXContainerItemProxy */ = {
|
17F6C6800F5F9FFE000D9DA9 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 17F6C6400F5F9E3F000D9DA9 /* JNetLib.xcodeproj */;
|
containerPortal = 17F6C6400F5F9E3F000D9DA9 /* JNetLib.xcodeproj */;
|
||||||
proxyType = 1;
|
proxyType = 1;
|
||||||
remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* JNetLib */;
|
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
|
||||||
remoteInfo = JNetLib;
|
remoteInfo = JNetLib;
|
||||||
};
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
Loading…
Reference in New Issue