// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . package event import ( "fmt" "reflect" "sync" "testing" "time" ) func TestFeedPanics(t *testing.T) { { var f Feed f.Send(int(2)) want := feedTypeError{op: "Send", got: reflect.TypeOf(uint64(0)), want: reflect.TypeOf(int(0))} if err := checkPanic(want, func() { f.Send(uint64(2)) }); err != nil { t.Error(err) } } { var f Feed ch := make(chan int) f.Subscribe(ch) want := feedTypeError{op: "Send", got: reflect.TypeOf(uint64(0)), want: reflect.TypeOf(int(0))} if err := checkPanic(want, func() { f.Send(uint64(2)) }); err != nil { t.Error(err) } } { var f Feed f.Send(int(2)) want := feedTypeError{op: "Subscribe", got: reflect.TypeOf(make(chan uint64)), want: reflect.TypeOf(make(chan<- int))} if err := checkPanic(want, func() { f.Subscribe(make(chan uint64)) }); err != nil { t.Error(err) } } { var f Feed if err := checkPanic(errBadChannel, func() { f.Subscribe(make(<-chan int)) }); err != nil { t.Error(err) } } { var f Feed if err := checkPanic(errBadChannel, func() { f.Subscribe(int(0)) }); err != nil { t.Error(err) } } } func checkPanic(want error, fn func()) (err error) { defer func() { panic := recover() if panic == nil { err = fmt.Errorf("didn't panic") } else if !reflect.DeepEqual(panic, want) { err = fmt.Errorf("panicked with wrong error: got %q, want %q", panic, want) } }() fn() return nil } func TestFeed(t *testing.T) { var feed Feed var done, subscribed sync.WaitGroup subscriber := func(i int) { defer done.Done() subchan := make(chan int) sub := feed.Subscribe(subchan) timeout := time.NewTimer(2 * time.Second) subscribed.Done() select { case v := <-subchan: if v != 1 { t.Errorf("%d: received value %d, want 1", i, v) } case <-timeout.C: t.Errorf("%d: receive timeout", i) } sub.Unsubscribe() select { case _, ok := <-sub.Err(): if ok { t.Errorf("%d: error channel not closed after unsubscribe", i) } case <-timeout.C: t.Errorf("%d: unsubscribe timeout", i) } } const n = 1000 done.Add(n) subscribed.Add(n) for i := 0; i < n; i++ { go subscriber(i) } subscribed.Wait() if nsent := feed.Send(1); nsent != n { t.Errorf("first send delivered %d times, want %d", nsent, n) } if nsent := feed.Send(2); nsent != 0 { t.Errorf("second send delivered %d times, want 0", nsent) } done.Wait() } func TestFeedSubscribeSameChannel(t *testing.T) { var ( feed Feed done sync.WaitGroup ch = make(chan int) sub1 = feed.Subscribe(ch) sub2 = feed.Subscribe(ch) _ = feed.Subscribe(ch) ) expectSends := func(value, n int) { if nsent := feed.Send(value); nsent != n { t.Errorf("send delivered %d times, want %d", nsent, n) } done.Done() } expectRecv := func(wantValue, n int) { for i := 0; i < n; i++ { if v := <-ch; v != wantValue { t.Errorf("received %d, want %d", v, wantValue) } } } done.Add(1) go expectSends(1, 3) expectRecv(1, 3) done.Wait() sub1.Unsubscribe() done.Add(1) go expectSends(2, 2) expectRecv(2, 2) done.Wait() sub2.Unsubscribe() done.Add(1) go expectSends(3, 1) expectRecv(3, 1) done.Wait() } func TestFeedSubscribeBlockedPost(t *testing.T) { var ( feed Feed nsends = 2000 ch1 = make(chan int) ch2 = make(chan int) wg sync.WaitGroup ) defer wg.Wait() feed.Subscribe(ch1) wg.Add(nsends) for i := 0; i < nsends; i++ { go func() { feed.Send(99) wg.Done() }() } sub2 := feed.Subscribe(ch2) defer sub2.Unsubscribe() // We're done when ch1 has received N times. // The number of receives on ch2 depends on scheduling. for i := 0; i < nsends; { select { case <-ch1: i++ case <-ch2: } } } func TestFeedUnsubscribeBlockedPost(t *testing.T) { var ( feed Feed nsends = 200 chans = make([]chan int, 2000) subs = make([]Subscription, len(chans)) bchan = make(chan int) bsub = feed.Subscribe(bchan) wg sync.WaitGroup ) for i := range chans { chans[i] = make(chan int, nsends) } // Queue up some Sends. None of these can make progress while bchan isn't read. wg.Add(nsends) for i := 0; i < nsends; i++ { go func() { feed.Send(99) wg.Done() }() } // Subscribe the other channels. for i, ch := range chans { subs[i] = feed.Subscribe(ch) } // Unsubscribe them again. for _, sub := range subs { sub.Unsubscribe() } // Unblock the Sends. bsub.Unsubscribe() wg.Wait() } func TestFeedUnsubscribeFromInbox(t *testing.T) { var ( feed Feed ch1 = make(chan int) ch2 = make(chan int) sub1 = feed.Subscribe(ch1) sub2 = feed.Subscribe(ch1) sub3 = feed.Subscribe(ch2) ) if len(feed.inbox) != 3 { t.Errorf("inbox length != 3 after subscribe") } if len(feed.sendCases) != 1 { t.Errorf("sendCases is non-empty after unsubscribe") } sub1.Unsubscribe() sub2.Unsubscribe() sub3.Unsubscribe() if len(feed.inbox) != 0 { t.Errorf("inbox is non-empty after unsubscribe") } if len(feed.sendCases) != 1 { t.Errorf("sendCases is non-empty after unsubscribe") } } func BenchmarkFeedSend1000(b *testing.B) { var ( done sync.WaitGroup feed Feed nsubs = 1000 ) subscriber := func(ch <-chan int) { for i := 0; i < b.N; i++ { <-ch } done.Done() } done.Add(nsubs) for i := 0; i < nsubs; i++ { ch := make(chan int, 200) feed.Subscribe(ch) go subscriber(ch) } // The actual benchmark. b.ResetTimer() for i := 0; i < b.N; i++ { if feed.Send(i) != nsubs { panic("wrong number of sends") } } b.StopTimer() done.Wait() } =dependabot/npm_and_yarn/devel/electron6/files/ini-1.3.8'>stats
path: root/security/openssl
Commit message (Expand)AuthorAgeFilesLines
* - fix build with perl 5.16dinoex2013-09-212-1/+6
* Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-211-0/+1
* Convert to new perl frameworkbapt2013-09-171-6/+7
* - drop depedency to makedependdinoex2013-09-101-2/+0
* - fix build when libc.so is not a symlinkdinoex2013-06-181-0/+19
* - fix wording of optiondinoex2013-03-181-1/+1
* - updated patches for options PADLOCKdinoex2013-03-062-11/+11
* - fix build with manpagesdinoex2013-03-041-2/+2
* - fix broken symlink in manpagedinoex2013-02-251-1/+1
* - update to 1.0.1edinoex2013-02-143-84/+12
* - fix paddding in TLS1.1 and DTLS on amd64dinoex2013-02-112-1/+73
* - Security update to 1.0.1ddinoex2013-02-072-14/+15
* - fix option PADLOCKdinoex2013-02-032-15/+14
* - enable optimized NIST ECC on 64-bit little-endian machinesdinoex2013-01-301-2/+18
* - make the pkg-message respect PREFIXdinoex2013-01-293-4/+5
* - mark option PADLOCK as BROKENdinoex2013-01-291-0/+1
* - cleanup headerdinoex2013-01-271-5/+1
* - fix pkg-plist for option SHAREDdinoex2012-07-301-12/+12
* - fix pkg-plist for option SHARED disableddinoex2012-07-291-12/+12
* - pass no-thread if threads are disableddinoex2012-07-291-1/+6
* - fix option THREADSdinoex2012-07-291-9/+10
* - update descripitionsdinoex2012-06-301-11/+11
* - fix options ZLIP and ASMdinoex2012-06-261-5/+5
* - use OPTIONS_DEFINEdinoex2012-06-162-27/+50
* - fix build with -Werrordinoex2012-05-171-0/+10
* - Security update to 1.0.1cdinoex2012-05-132-4/+4
* - Security Update to 1.0.0adinoex2012-04-202-4/+8
* - update to 1.0.1dinoex2012-04-124-13/+23
* - drop DTLS bugfixes, now included upstreamdinoex2012-03-152-34/+5
* - tamper SHLIB_VERSION_NUMBER in opensslv.hdinoex2012-02-221-0/+2
* - Security update to 1.0.0gdinoex2012-01-202-10/+10
* - Build with obsolte MD2 hash by defaultdinoex2012-01-112-27/+16
* - make portlint happierdinoex2011-11-222-16/+24
* - cleanup homepagedinoex2011-11-221-4/+0
* - Security update to 1.0.0edinoex2011-09-083-18/+45
* - Security update to 1.0.0ddinoex2011-02-112-12/+12
* - Security update to 1.0.0cdinoex2010-12-033-28/+12
* - Security update to 1.0.0bdinoex2010-11-173-22/+29
* - ease fetchingdinoex2010-06-121-5/+5
* - update dtls-heartbeats.patchdinoex2010-06-121-3/+3
* - update to openssl-1.0.0adinoex2010-06-064-75/+19
* - fix path in c_rehashdinoex2010-05-054-4/+50
* - add option WITHOUT_ASMdinoex2010-04-071-0/+7
* - fix build on sparc64dinoex2010-04-071-0/+4
* - chase updated patches for sctp-17 and dtlsdinoex2010-04-062-13/+28
* - add options WITH_MD2dinoex2010-04-062-2/+36
* - strip text for optionsdinoex2010-04-051-1/+1
* - update to 1.0.0dinoex2010-04-035-162/+266
* - Security update to 0.9.8ndinoex2010-03-312-7/+4
* - update to 0.9.8mdinoex2010-02-275-294/+76
* - allow use of faster CPUdinoex2010-01-242-17/+24
* - Security patch to fix Memory leakdinoex2010-01-202-4/+46
* - new option WITH_OPENSSL_THREADSdinoex2010-01-132-8/+11
* - drop broken FIPS supportdinoex2010-01-121-19/+5
* Don't link unneeded PTHREAD_LIBS.ale2010-01-052-2/+3
* - improve message for option WITH_SCTPdinoex2009-11-071-1/+1
* - Security update to 0.9.8ldinoex2009-11-072-5/+4
* - add option WITH_FIPS to make configdinoex2009-10-301-0/+3
* PR: 138881dinoex2009-09-192-3/+3
* - fix Hardware accelerationdinoex2009-09-172-2/+2
* - make patches fetchabledinoex2009-08-141-1/+3
* - revert patchdinoex2009-08-142-5/+6
* - update dtls-bugs.patchdinoex2009-08-142-16/+4
* - mark option WITH_SCTP as brokendinoex2009-08-101-0/+1
* - fix build for OSVERSION 800105dinoex2009-07-221-0/+4
* - set MAKE_JOBS_UNSAFEdinoex2009-07-211-0/+1
* - keep private directories around if useddinoex2009-07-071-2/+2
* - WITH_SCTP does not buuild on 7.1dinoex2009-05-221-1/+1
* - add more DTLS bugfixesdinoex2009-05-216-74/+65
* - Security Fixdinoex2009-05-203-0/+69
* - Security update to 0.9.8kdinoex2009-03-293-16/+4
* - fix shared lib pathdinoex2009-02-231-1/+2
* - cleanup betadinoex2009-02-232-31/+20
* - update to 0.9.8jdinoex2009-01-1021-728/+130
* - Security fix for incorrect checks for malformed signaturesdinoex2009-01-092-3/+152
* - cleanup 0.97dinoex2009-01-092-90/+49
* - mark FORBIDDENdinoex2009-01-091-0/+1
* - mark BROKENdinoex2009-01-081-0/+2
* - Remove conditional checks for FreeBSD 5.x and olderpav2009-01-071-8/+0
* - update to 0.9.8idinoex2008-10-093-5/+6
* - Security fix for 0.9.7mdinoex2008-08-212-1/+43
* - Remove duplicates from MAKE_ENV after inclusion of CC and CXX in default MA...pav2008-07-251-1/+0
* - enable cryptodevdinoex2008-06-262-1/+13
* - readd 0.9.7mdinoex2008-06-081-0/+3
* - Security update to 0.9.8hdinoex2008-05-303-13/+10
* - remove WITH_OPENSSL_SNAPSHOTdinoex2008-03-291-17/+3
* - remove option OPENSSL_OVERWRITE_BASEdinoex2007-10-242-47/+11
* - update to 0.9.8gdinoex2007-10-242-4/+4
* - Secuurity update to 0.9.8fdinoex2007-10-175-211/+5
* - fix DESTDIR for config stagedinoex2007-08-061-2/+2
* - Remove the DESTDIR modifications from individual ports as we have a new,gabor2007-08-041-4/+4
* - enable cadmilladinoex2007-06-122-1/+3
* - Fix runtime crash in OpenSSL with "Illegal instruction" when build with gcc42dinoex2007-06-071-0/+182
* - Security update to 0.9.7m / 0.9.8edinoex2007-02-282-9/+11
* - use USE_LDCONFIGdinoex2007-02-121-1/+1
* - Remove support for a.out format and PORTOBJFORMAT variable from individualpav2007-01-301-6/+1
* - Security update to 0.9.7ldinoex2006-09-282-8/+8
* - update to 0.9.8cdinoex2006-09-082-9/+9
* - fix warning when no openssl is in the basedinoex2006-08-311-1/+1
* - new option WITH_OPENSSL_COMPRESSIONdinoex2006-08-171-0/+4
* Add support for DESTDIR part I.erwin2006-08-041-2/+2
* - ignore OpenSSL 0.9.7* on CUREENT >= 700019dinoex2006-08-021-1/+18
* - activate regression-testdinoex2006-06-241-0/+2
* - bump shared lib versions for FreeBSD > 6.0dinoex2006-05-251-11/+15
* - update to 0.9.8a and 0.9.7jdinoex2006-05-083-22/+21
* - force CC and CFLAGS from /etc/make.confdinoex2005-12-262-11/+11
* - warn users of option OPENSSL_OVERWRITE_BASEdinoex2005-11-251-0/+10
* - update default build options on aplhadinoex2005-11-191-1/+1
* - backout last patchdinoex2005-11-191-40/+26
* - update default build options on aplhadinoex2005-11-191-26/+40
* - add SHA checksumdinoex2005-11-131-0/+2
* - Fix build of openssl-beta on 6.0dinoex2005-10-201-1/+1
* - new option WITHOUT_OPENSSL_SSE2dinoex2005-10-161-0/+4
* - update stable to 0.9.7idinoex2005-10-164-32/+4
* - force 0.9.7 for FREEBSD 6.0 RELEASEdinoex2005-10-161-0/+8
* - new option WITH_OPENSSL_STABLE=yesdinoex2005-10-141-10/+8
* - binary compatability patchdinoex2005-10-143-1/+29
* - update to 0.9.7g and 0.9.8adinoex2005-10-124-64/+8
* - Security Fix: CAN-2005-2969dinoex2005-10-123-2/+58
* - bump SHLIB versiondinoex2005-10-041-2/+3
* - update default to 0.9.8dinoex2005-09-20