ipdbg-la: Minor cosmetic and comment fixes.

This commit is contained in:
Uwe Hermann 2019-01-29 23:15:37 +01:00
parent 8e249032d3
commit 1b6b9c01df
1 changed files with 10 additions and 11 deletions

View File

@ -70,7 +70,7 @@ static gboolean data_available(struct ipdbg_la_tcp *tcp)
if (ioctlsocket(tcp->socket, FIONREAD, &bytes_available) != 0) { if (ioctlsocket(tcp->socket, FIONREAD, &bytes_available) != 0) {
#else #else
int bytes_available; int bytes_available;
if (ioctl(tcp->socket, FIONREAD, &bytes_available) < 0){ // TIOCMGET if (ioctl(tcp->socket, FIONREAD, &bytes_available) < 0) { /* TIOCMGET */
#endif #endif
sr_err("FIONREAD failed: %s\n", g_strerror(errno)); sr_err("FIONREAD failed: %s\n", g_strerror(errno));
return FALSE; return FALSE;
@ -143,11 +143,10 @@ SR_PRIV int ipdbg_la_tcp_close(struct ipdbg_la_tcp *tcp)
int ret = SR_OK; int ret = SR_OK;
#ifdef _WIN32 #ifdef _WIN32
if (shutdown(tcp->socket, SD_SEND) != SOCKET_ERROR) if (shutdown(tcp->socket, SD_SEND) != SOCKET_ERROR) {
{
char recvbuf[16]; char recvbuf[16];
int recvbuflen = 16; int recvbuflen = 16;
// Receive until the peer closes the connection /* Receive until the peer closes the connection. */
while (recv(tcp->socket, recvbuf, recvbuflen, 0) > 0); while (recv(tcp->socket, recvbuf, recvbuflen, 0) > 0);
} }
#endif #endif
@ -181,8 +180,8 @@ static int tcp_receive_blocking(struct ipdbg_la_tcp *tcp,
int received = 0; int received = 0;
int error_count = 0; int error_count = 0;
/* Timeout after 500ms of not receiving data */ /* Timeout after 2s of not receiving data. */
/* increase timeout in case lab is not just beside the office */ /* Increase timeout in case lab is not just beside the office. */
while ((received < bufsize) && (error_count < 2000)) { while ((received < bufsize) && (error_count < 2000)) {
int recd = ipdbg_la_tcp_receive(tcp, buf, bufsize - received); int recd = ipdbg_la_tcp_receive(tcp, buf, bufsize - received);
if (recd > 0) { if (recd > 0) {
@ -190,7 +189,7 @@ static int tcp_receive_blocking(struct ipdbg_la_tcp *tcp,
received += recd; received += recd;
} else { } else {
error_count++; error_count++;
g_usleep(1000); /* Sleep for 1ms */ g_usleep(1000);
} }
} }