#include <tevent.h>
#include "lib/async_req/async_sock.h"
#include "lib/util/iov_buf.h"
+#include "lib/util/debug.h"
/* Note: lib/util/ is currently GPL */
#include "lib/util/tevent_unix.h"
#include "lib/util/samba_util.h"
+#undef DEBUG
+#define DEBUG( _level, body ) do {\
+ int level = 5; \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ unlikely(DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level)) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ )) \
+ && (dbgtext body) ); \
+} while(0)
struct async_connect_state {
int fd;
struct tevent_fd *fde;
}
}
+DEBUG(0,("%s:%s: before writev... ev[%p]\n", __location__, __func__, state->ev));
written = writev(state->fd, state->iov, state->count);
if ((written == -1) && (errno == EINTR)) {
+DEBUG(0,("%s:%s: errno=%d - %s\n", __location__, __func__, errno, strerror(errno)));
/* retry */
return;
}
if (written == -1) {
+DEBUG(0,("%s:%s: errno=%d - %s\n", __location__, __func__, errno, strerror(errno)));
tevent_req_error(req, errno);
return;
}
if (written == 0) {
+ errno = EPIPE;
+DEBUG(0,("%s:%s: errno=%d - %s\n", __location__, __func__, errno, strerror(errno)));
tevent_req_error(req, EPIPE);
return;
}
+DEBUG(0,("%s:%s: written %zd\n", __location__, __func__, written));
state->total_size += written;
ok = iov_advance(&state->iov, &state->count, written);
}
if (state->count == 0) {
+DEBUG(0,("%s:%s: done total %zu\n", __location__, __func__, state->total_size));
tevent_req_done(req);
return;
}
+DEBUG(0,("%s:%s: more total %zu\n", __location__, __func__, state->total_size));
}
ssize_t writev_recv(struct tevent_req *req, int *perrno)
#include "lib/crypto/aes_ccm_128.h"
#include "lib/crypto/aes_gcm_128.h"
+#undef DEBUG
+#define DEBUG( _level, body ) do {\
+ int level = 5; \
+ (void)( ((level) <= MAX_DEBUG_LEVEL) && \
+ unlikely(DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level)) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ )) \
+ && (dbgtext body) ); \
+} while(0)
struct smbXcli_conn;
struct smbXcli_req;
struct smbXcli_session;
* We're the first ones, add the read_smb request that waits for the
* answer from the server
*/
+DEBUG(0,("%s:%s: state[%p] \n", __location__, __func__, state));
conn->read_smb_req = read_smb_send(conn->pending,
state->ev,
conn->sock_fd);
received = read_smb_recv(subreq, frame, &inbuf, &err);
TALLOC_FREE(subreq);
+DEBUG(0,("%s:%s: received[%zu]\n", __location__, __func__, received));
if (received == -1) {
status = map_nt_error_from_unix_common(err);
smbXcli_conn_disconnect(conn, status);
}
}
+DEBUG(0,("%s:%s: state[%p] nbt_len[%u]\n", __location__, __func__, state, (unsigned)nbt_len));
subreq = writev_send(state, state->ev, state->conn->outgoing,
state->conn->sock_fd, false, iov, num_iov);
if (subreq == NULL) {
state->write_req = NULL;
+DEBUG(0,("%s:%s: state[%p]\n", __location__, __func__, state));
nwritten = writev_recv(subreq, &err);
TALLOC_FREE(subreq);
if (nwritten == -1) {