Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 2 - dropped ACKs #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions transaction/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ func (mng *Manager) request(r *base.Request) {
return
}

// If we failed to correlate an ACK, just drop it.
if r.Method == base.ACK {
log.Warn("Couldn't correlate ACK to an open transaction. Dropping it.")
return
}

// Create a new transaction
tx := &ServerTransaction{}
tx.tm = mng
Expand Down Expand Up @@ -288,9 +282,20 @@ func (mng *Manager) request(r *base.Request) {
tx.tu_err = make(chan error, 1)
tx.ack = make(chan *base.Request, 1)

// Send a 100 Trying immediately.
// Technically we shouldn't do this if we trustthe user to do it within 200ms,
// but I'm not sure how to handle that situation right now.
if r.Method != base.ACK {
// Send a 100 Trying immediately.
// Technically we shouldn't do this if we trust the user to do it within 200ms,
// but I'm not sure how to handle that situation right now.
// Explicitly don't do this for ACKs; 2xx ACKs are their own transaction but
// don't engender a provisional response - we just pass them up to the user
// to handle at the dialog scope.
mng.sendPresumptiveTrying(tx)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is indented with spaces instead of tabs. You monster.


mng.requests <- tx
}

func (mng *Manager) sendPresumptiveTrying(tx *ServerTransaction) {

// Pretend the user sent us a 100 to send.
trying := base.NewResponse(
Expand All @@ -309,6 +314,4 @@ func (mng *Manager) request(r *base.Request) {

tx.lastResp = trying
tx.fsm.Spin(server_input_user_1xx)

mng.requests <- tx
}