That's the only case where this can happen, so we should not clutter the main
code path.
conn = switch_message(req->cmd, req);
- if (req->unread_bytes) {
- /* writeX failed. drain socket. */
- if (drain_socket(req->sconn->sock, req->unread_bytes) !=
- req->unread_bytes) {
- smb_panic("failed to drain pending bytes");
- }
- req->unread_bytes = 0;
- }
-
if (req->done) {
TALLOC_FREE(req);
return;
return;
out:
+ if (req->unread_bytes) {
+ /* writeX failed. drain socket. */
+ if (drain_socket(req->sconn->sock, req->unread_bytes) !=
+ req->unread_bytes) {
+ smb_panic("failed to drain pending bytes");
+ }
+ req->unread_bytes = 0;
+ }
+
END_PROFILE(SMBwriteX);
return;
}