MarkForHandoff marks the connection for handoff due to MOVING notification. Returns an error if the connection is already marked for handoff. Note: This only sets metadata - the connection state is not changed until OnPut. This allows the current user to finish using the connection before handoff.
(newEndpoint string, seqID int64)
| 716 | // Note: This only sets metadata - the connection state is not changed until OnPut. |
| 717 | // This allows the current user to finish using the connection before handoff. |
| 718 | func (cn *Conn) MarkForHandoff(newEndpoint string, seqID int64) error { |
| 719 | // Check if already marked for handoff |
| 720 | if cn.ShouldHandoff() { |
| 721 | return errAlreadyMarkedForHandoff |
| 722 | } |
| 723 | |
| 724 | // Set handoff metadata atomically |
| 725 | cn.handoffStateAtomic.Store(&HandoffState{ |
| 726 | ShouldHandoff: true, |
| 727 | Endpoint: newEndpoint, |
| 728 | SeqID: seqID, |
| 729 | }) |
| 730 | return nil |
| 731 | } |
| 732 | |
| 733 | // MarkQueuedForHandoff marks the connection as queued for handoff processing. |
| 734 | // This makes the connection unusable until handoff completes. |