WireGuard Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] device: make locks more efficient
@ 2019-08-29  4:13 liuhaichao
  0 siblings, 0 replies; 3+ messages in thread
From: liuhaichao @ 2019-08-29  4:13 UTC (permalink / raw)
  To: wireguard; +Cc: Haichao Liu

From: Haichao Liu <liuhaichao@bytedance.com>

Change-Id: I515c38e9911d4baeb4c2a45249c18a371864f8e1
Signed-off-by: Haichao Liu <liuhaichao@bytedance.com>
---
 device/uapi.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/device/uapi.go b/device/uapi.go
index 99cb421..c8499e2 100644
--- a/device/uapi.go
+++ b/device/uapi.go
@@ -283,12 +283,12 @@ func (device *Device) IpcSetOperation(socket *bufio.Reader) *IPCError {
 				logDebug.Println(peer, "- UAPI: Updating endpoint")
 
 				err := func() error {
-					peer.Lock()
-					defer peer.Unlock()
 					endpoint, err := CreateEndpoint(value)
 					if err != nil {
 						return err
 					}
+					peer.Lock()
+					defer peer.Unlock()
 					peer.endpoint = endpoint
 					return nil
 				}()
-- 
2.19.1

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] device: make locks more efficient
  2019-07-31  2:57 liuhaichao
@ 2019-08-27 22:57 ` Jason A. Donenfeld
  0 siblings, 0 replies; 3+ messages in thread
From: Jason A. Donenfeld @ 2019-08-27 22:57 UTC (permalink / raw)
  To: liuhaichao; +Cc: WireGuard mailing list

Thanks. Looks good, but needs a Signed-off-by line using the -s option
to git-commit.
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] device: make locks more efficient
@ 2019-07-31  2:57 liuhaichao
  2019-08-27 22:57 ` Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: liuhaichao @ 2019-07-31  2:57 UTC (permalink / raw)
  To: wireguard; +Cc: liuhaichao

From: liuhaichao <liuhaichao@bytedance.com>

Change-Id: I515c38e9911d4baeb4c2a45249c18a371864f8e1
---
 device/uapi.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/device/uapi.go b/device/uapi.go
index 99cb421..c8499e2 100644
--- a/device/uapi.go
+++ b/device/uapi.go
@@ -283,12 +283,12 @@ func (device *Device) IpcSetOperation(socket *bufio.Reader) *IPCError {
 				logDebug.Println(peer, "- UAPI: Updating endpoint")
 
 				err := func() error {
-					peer.Lock()
-					defer peer.Unlock()
 					endpoint, err := CreateEndpoint(value)
 					if err != nil {
 						return err
 					}
+					peer.Lock()
+					defer peer.Unlock()
 					peer.endpoint = endpoint
 					return nil
 				}()
-- 
2.19.1

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  4:13 [PATCH] device: make locks more efficient liuhaichao
  -- strict thread matches above, loose matches on Subject: below --
2019-07-31  2:57 liuhaichao
2019-08-27 22:57 ` Jason A. Donenfeld

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com
	public-inbox-index wireguard

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git