Check cfstream status when open fails before breaking the process
This commit is contained in:
parent
fe2ca56297
commit
2ec0624c6b
|
@ -1069,13 +1069,21 @@ int wrapSocket(tnet_transport_t *transport, transport_socket_xt *sock)
|
|||
|
||||
// Open streams
|
||||
if (!CFReadStreamOpen(sock->cf_read_stream)) {
|
||||
TSK_DEBUG_ERROR("CFReadStreamOpen(fd=%d) failed", sock->fd);
|
||||
CFStreamStatus status = CFReadStreamGetStatus(sock->cf_read_stream);
|
||||
if (status != kCFStreamStatusOpen && status != kCFStreamStatusOpening && status != kCFStreamStatusReading) {
|
||||
TSK_DEBUG_ERROR("CFReadStreamOpen(fd=%d) failed with status=%ld", sock->fd, status);
|
||||
return -1;
|
||||
}
|
||||
TSK_DEBUG_INFO("CFReadStreamOpen(fd=%d) returned with status=%ld", sock->fd, status);
|
||||
}
|
||||
if (!CFWriteStreamOpen(sock->cf_write_stream)) {
|
||||
TSK_DEBUG_ERROR("CFWriteStreamOpen(fd=%d) failed", sock->fd);
|
||||
CFStreamStatus status = CFWriteStreamGetStatus(sock->cf_write_stream);
|
||||
if (status != kCFStreamStatusOpen && status != kCFStreamStatusOpening && status != kCFStreamStatusWriting) {
|
||||
TSK_DEBUG_ERROR("CFWriteStreamOpen(fd=%d) failed with status=%ld", sock->fd, status);
|
||||
return -1;
|
||||
}
|
||||
TSK_DEBUG_INFO("CFWriteStreamOpen(fd=%d) returned with status=%ld", sock->fd, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue