/* Note: lib/util/ is currently GPL */
#include "lib/util/tevent_unix.h"
#include "lib/util/samba_util.h"
+#include "lib/util/debug.h"
+#include <linux/sockios.h>
struct async_connect_state {
int fd;
}
}
+ debug_info(state->fd);
+
written = writev(state->fd, state->iov, state->count);
if ((written == -1) && (errno == EINTR)) {
/* retry */
return;
}
+ incr_write(state->fd, written);
+ debug_info(state->fd);
+ DEBUG(0,("%s:%s: written[%u] total[%u]\n",
+ __location__, __func__,
+ (unsigned)written,
+ (unsigned)state->total_size));
if (state->count == 0) {
tevent_req_done(req);
return;
ssize_t nread, more;
uint8_t *tmp;
+ debug_info(state->fd);
nread = recv(state->fd, state->buf+state->nread, total-state->nread,
0);
if ((nread == -1) && (errno == ENOTSOCK)) {
return;
}
+ incr_read(state->fd, nread);
+ debug_info(state->fd);
+ DEBUG(0,("%s:%s: total[%u] nread[%u]\n",
+ __location__, __func__,
+ (unsigned)total,(unsigned)nread));
state->nread += nread;
if (state->nread < total) {
/* Come back later */
#include "auth.h"
#include "libcli/smb/smbXcli_base.h"
#include "lib/tevent_wait.h"
+#include <linux/sockios.h>
#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
return sys_errno;
}
+struct io_stats {
+ int fd;
+ size_t w;
+ size_t r;
+};
+
+static struct io_stats g;
+
+static void incr_write(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->w += v;
+}
+static void incr_read(int fd, size_t v)
+{
+ struct io_stats *s = &g;
+
+ s->r += v;
+}
+static void _debug_info(int fd, const char *location, const char *func)
+
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct io_stats *s = &g;
+ struct tcp_info info;
+ //socklen_t ilen = sizeof(info);
+ int ret;
+ int val0 = 0;
+ int val1 = 0;
+ int val2 = 0;
+
+ ZERO_STRUCT(info);
+ //ret = getsockopt(fd, IPPROTO_TCP,
+ // TCP_INFO, (void *)&info, &ilen);
+ //if (ret != 0) {
+ // DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ // location, func,
+ // errno, strerror(errno)));
+ // ZERO_STRUCT(info);
+ //}
+
+ ret = ioctl(fd, SIOCINQ, &val0);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val0 = -1;
+ }
+ ret = ioctl(fd, SIOCOUTQ, &val1);
+ if (ret != 0) {
+ DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ location, func,
+ errno, strerror(errno)));
+ val1 = -1;
+ }
+ //ret = ioctl(fd, SIOCOUTQNSD, &val2);
+ //if (ret != 0) {
+ // DEBUG(0,("%s:%s: errno[%d/%s]\n",
+ // location, func,
+ // errno, strerror(errno)));
+ // val1 = -1;
+ //}
+ DEBUG(0,("%s:%s: %s: r[%u] w[%u] unacked[%u] sacked[%u] SIOCINQ[%u] SIOCOUTQ[%u] SIOCOUTQNSD[%u]\n",
+ location, func, current_timestring(talloc_tos(), true),
+ (unsigned)s->r, (unsigned)s->w,
+ (unsigned)info.tcpi_unacked,
+ (unsigned)info.tcpi_sacked,
+ (unsigned)val0,
+ (unsigned)val1,
+ (unsigned)val2));
+ TALLOC_FREE(frame);
+}
+
+#define debug_info(fd) _debug_info(fd, __location__, __func__)
static NTSTATUS smbd_smb2_check_ack_queue(struct smbXsrv_connection *xconn)
{
while (xconn->smb2.ack_queue != NULL) {
struct smbd_smb2_send_queue *e = xconn->smb2.ack_queue;
- struct tcp_info info;
- socklen_t ilen = sizeof(info);
- int ret;
-
- ret = getsockopt(xconn->transport.sock, IPPROTO_TCP,
- TCP_INFO, (void *)&info, &ilen);
- if (ret != 0) {
- DEBUG(0,("%s:%s: errno[%d/%s]\n",
- __location__, __func__,
- errno, strerror(errno)));
- ZERO_STRUCT(info);
- } else {
- DEBUG(0,("%s:%s: unacked[%u] sacked[%u]\n",
- __location__, __func__,
- (unsigned)info.tcpi_unacked,
- (unsigned)info.tcpi_sacked));
- }
+
+ debug_info(xconn->transport.sock);
DLIST_REMOVE(xconn->smb2.ack_queue, e);
//e->ack.seqnum >=info.tcpi_sacked + iov_buflen(e->vector, e->count);
}
if (e->ack.req != NULL && !e->ack.started) {
- struct tcp_info info;
- socklen_t ilen = sizeof(info);
-
- ret = getsockopt(xconn->transport.sock, IPPROTO_TCP,
- TCP_INFO, (void *)&info, &ilen);
- if (ret != 0) {
- DEBUG(0,("%s:%s: errno[%d/%s]\n",
- __location__, __func__,
- errno, strerror(errno)));
- ZERO_STRUCT(info);
- } else {
- DEBUG(0,("%s:%s: unacked[%u] sacked[%u]\n",
- __location__, __func__,
- (unsigned)info.tcpi_unacked,
- (unsigned)info.tcpi_sacked));
- }
+ //debug_info(xconn->transport.sock);
e->ack.started = true;
- e->ack.seqnum = info.tcpi_sacked + iov_buflen(e->vector, e->count);
+ e->ack.seqnum = 0;//info.tcpi_sacked + iov_buflen(e->vector, e->count);
}
msg = (struct msghdr) {
.msg_iovlen = e->count,
};
+ debug_info(xconn->transport.sock);
ret = sendmsg(xconn->transport.sock, &msg, 0);
if (ret == 0) {
/* propagate end of file */
return map_nt_error_from_unix_common(err);
}
+ incr_write(xconn->transport.sock, ret);
+
ok = iov_advance(&e->vector, &e->count, ret);
if (!ok) {
return NT_STATUS_INTERNAL_ERROR;
}
if (e->ack.req != NULL && e->ack.started) {
- tevent_wait_done(e->ack.req);
+ //tevent_wait_done(e->ack.req);
}
+ debug_info(xconn->transport.sock);
xconn->smb2.send_queue_len--;
DLIST_REMOVE(xconn->smb2.send_queue, e);
if (e->ack.req != NULL && e->ack.started) {
.msg_iovlen = 1,
};
+ debug_info(xconn->transport.sock);
ret = recvmsg(xconn->transport.sock, &msg, 0);
if (ret == 0) {
/* propagate end of file */
return map_nt_error_from_unix_common(err);
}
+ incr_read(xconn->transport.sock, ret);
+ debug_info(xconn->transport.sock);
if (ret < state->vector.iov_len) {
uint8_t *base;
base = (uint8_t *)state->vector.iov_base;