|
@@ -105,20 +105,21 @@ static
|
|
|
ssize_t hashfast_write(const int fd, void * const buf, size_t bufsz)
|
|
ssize_t hashfast_write(const int fd, void * const buf, size_t bufsz)
|
|
|
{
|
|
{
|
|
|
const ssize_t rv = write(fd, buf, bufsz);
|
|
const ssize_t rv = write(fd, buf, bufsz);
|
|
|
- if (opt_debug && opt_dev_protocol)
|
|
|
|
|
|
|
+ if ((opt_debug && opt_dev_protocol) || unlikely(rv != bufsz))
|
|
|
{
|
|
{
|
|
|
|
|
+ const int e = errno;
|
|
|
char hex[(bufsz * 2) + 1];
|
|
char hex[(bufsz * 2) + 1];
|
|
|
bin2hex(hex, buf, bufsz);
|
|
bin2hex(hex, buf, bufsz);
|
|
|
if (rv < 0)
|
|
if (rv < 0)
|
|
|
- applog(LOG_DEBUG, "%s fd=%d: SEND (%s) => %d",
|
|
|
|
|
- "hashfast", fd, hex, (int)rv);
|
|
|
|
|
|
|
+ applog(LOG_WARNING, "%s fd=%d: SEND (%s) => %d errno=%d(%s)",
|
|
|
|
|
+ "hashfast", fd, hex, (int)rv, e, bfg_strerror(e, BST_ERRNO));
|
|
|
else
|
|
else
|
|
|
if (rv < bufsz)
|
|
if (rv < bufsz)
|
|
|
- applog(LOG_DEBUG, "%s fd=%d: SEND %.*s(%s)",
|
|
|
|
|
|
|
+ applog(LOG_WARNING, "%s fd=%d: SEND %.*s(%s)",
|
|
|
"hashfast", fd, rv * 2, hex, &hex[rv * 2]);
|
|
"hashfast", fd, rv * 2, hex, &hex[rv * 2]);
|
|
|
else
|
|
else
|
|
|
if (rv > bufsz)
|
|
if (rv > bufsz)
|
|
|
- applog(LOG_DEBUG, "%s fd=%d: SEND %s => +%d",
|
|
|
|
|
|
|
+ applog(LOG_WARNING, "%s fd=%d: SEND %s => +%d",
|
|
|
"hashfast", fd, hex, (int)(rv - bufsz));
|
|
"hashfast", fd, hex, (int)(rv - bufsz));
|
|
|
else
|
|
else
|
|
|
applog(LOG_DEBUG, "%s fd=%d: SEND %s",
|
|
applog(LOG_DEBUG, "%s fd=%d: SEND %s",
|