@@ -38,8 +38,8 @@ using namespace lcb;
3838static void cleanup_negotiated (SessionInfo * info );
3939static void handle_ioerr (lcbio_CTX * ctx , lcb_STATUS err );
4040
41- #define LOGFMT CTX_LOGFMT_PRE ",SASLREQ=%p) "
42- #define LOGID (s ) CTX_LOGID(s->ctx), (void *)s
41+ #define LOGFMT CTX_LOGFMT_PRE ",SOCK=%016" PRIx64 ", SASLREQ=%p) "
42+ #define LOGID (s ) CTX_LOGID(s->ctx), ((s->ctx && s->ctx->sock) ? s->ctx->sock->id : 0), ( void *)s
4343
4444static void timeout_handler (void * arg );
4545
@@ -270,7 +270,8 @@ SessionRequestImpl::MechStatus SessionRequestImpl::set_chosen_mech(std::string &
270270 cbsasl_error_t saslerr ;
271271
272272 if (mechlist .empty ()) {
273- lcb_log (LOGARGS (this , WARN ), LOGFMT "Server does not support SASL (no mechanisms supported, empty list)" , LOGID (this ));
273+ lcb_log (LOGARGS (this , WARN ), LOGFMT "Server does not support SASL (no mechanisms supported, empty list)" ,
274+ LOGID (this ));
274275 return MECH_NOT_NEEDED ;
275276 }
276277
@@ -329,7 +330,8 @@ SessionRequestImpl::MechStatus SessionRequestImpl::set_chosen_mech(std::string &
329330 info -> mech .assign (chosenmech );
330331 return MECH_OK ;
331332 case SASL_NOMECH :
332- lcb_log (LOGARGS (this , WARN ), LOGFMT "Server does not support SASL (no mechanisms supported, SASL_NOMECH)" , LOGID (this ));
333+ lcb_log (LOGARGS (this , WARN ), LOGFMT "Server does not support SASL (no mechanisms supported, SASL_NOMECH)" ,
334+ LOGID (this ));
333335 return MECH_UNAVAILABLE ;
334336 default :
335337 lcb_log (LOGARGS (this , ERROR ), LOGFMT "cbsasl_client_start returned %d" , LOGID (this ), saslerr );
@@ -772,9 +774,17 @@ void SessionRequestImpl::handle_read(lcbio_CTX *ioctx)
772774 }
773775
774776 default : {
775- lcb_log (LOGARGS (this , ERROR ), LOGFMT "Received unexpected response. OP=0x%x. RC=0x%x, completed=%d" ,
776- LOGID (this ), resp .opcode (), resp .status (), completed );
777- set_error (LCB_ERR_PROTOCOL_ERROR , "Received unexpected response" , & resp );
777+ if (resp .server_response ()) {
778+ lcb_log (LOGARGS (this , ERROR ),
779+ LOGFMT "Received unexpected response. OP=0x%x. RC=0x%x, SEQ=%u, completed=%d" , LOGID (this ),
780+ (int )resp .opcode (), (int )resp .status (), (int )resp .opaque (), completed );
781+ set_error (LCB_ERR_PROTOCOL_ERROR , "Received unexpected response" , & resp );
782+ } else {
783+ lcb_log (LOGARGS (this , DEBUG ),
784+ LOGFMT "Received unexpected message. MAGIC=0x%02x, OP=0x%x. RC=0x%x, SEQ=%u, completed=%d" ,
785+ LOGID (this ), (int )resp .magic (), (int )resp .opcode (), (int )resp .status (), (int )resp .opaque (),
786+ completed );
787+ }
778788 break ;
779789 }
780790 }
0 commit comments