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

Add error message when stopping userlandProxy failed #2084

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
13 changes: 10 additions & 3 deletions portmapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,14 @@ func (pm *PortMapper) MapRange(container net.Addr, hostIP net.IP, hostPortStart,

cleanup := func() error {
// need to undo the iptables rules before we return
m.userlandProxy.Stop()
if userlanderr := m.userlandProxy.Stop(); userlanderr != nil {
logrus.Errorf("Error on userlandProxy delete: %s", userlanderr)
}
if hostIP.To4() != nil {
pm.forward(iptables.Delete, m.proto, hostIP, allocatedHostPort, containerIP.String(), containerPort)
if forwarderr := pm.forward(iptables.Delete, m.proto, hostIP, allocatedHostPort, containerIP.String(), containerPort); forwarderr != nil {
logrus.Errorf("Error on iptables delete: %s", forwarderr)
}

if err := pm.Allocator.ReleasePort(hostIP, m.proto, allocatedHostPort); err != nil {
return err
}
Expand Down Expand Up @@ -215,7 +220,9 @@ func (pm *PortMapper) Unmap(host net.Addr) error {
}

if data.userlandProxy != nil {
data.userlandProxy.Stop()
if err := data.userlandProxy.Stop(); err != nil {
logrus.Errorf("Error on userlandProxy delete: %s", err)
}
}

delete(pm.currentMappings, key)
Expand Down