GithubHelp home page GithubHelp logo

Comments (2)

 avatar commented on April 19, 2024

If connect to 2 servers, looks the first connection is closed? Does this mean wangle could NOT share IOThreadPool among connections?

diff --git a/wangle/example/echo/EchoClient.cpp b/wangle/example/echo/EchoClient.cpp
index 5ee0cad..5f101ee 100644
--- a/wangle/example/echo/EchoClient.cpp
+++ b/wangle/example/echo/EchoClient.cpp
@@ -63,23 +63,46 @@ int main(int argc, char** argv) {
client.group(std::make_sharedwangle::IOThreadPoolExecutor(1));
client.pipelineFactory(std::make_shared());
auto pipeline = client.connect(SocketAddress(FLAGS_host, FLAGS_port)).get();
++ auto pipeline1 = client.connect(SocketAddress(FLAGS_host, 8070)).get();

./bin/EchoClient -v=5
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0414 03:18:42.539069 13215 EventBase.cpp:164] EventBase(): Created.
I0414 03:18:42.540269 13215 EventBase.cpp:295] EventBase(): Starting loop.
I0414 03:18:42.540786 13214 EventBase.cpp:164] EventBase(): Created.
I0414 03:18:42.541205 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 0
I0414 03:18:42.541543 13215 AsyncSocket.cpp:192] new AsyncSocket(0x7f6910001950, evb=0x7f6910000af0)
I0414 03:18:42.541913 13215 AsyncSocket.cpp:383] AsyncSocket::connect(this=0x7f6910001950, evb=0x7f6910000af0, fd=11, host=[::1]:8080
I0414 03:18:42.575080 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 33
I0414 03:18:42.575783 13215 AsyncSocket.cpp:1401] AsyncSocket::handleWrite() this=0x7f6910001950, fd=11, state=1
I0414 03:18:42.576248 13215 AsyncSocket.cpp:1573] AsyncSocket::handleConnect() this=0x7f6910001950, fd=11, state=1
I0414 03:18:42.576648 13215 AsyncSocket.cpp:1750] AsyncSocket::updateEventRegistration(this=0x7f6910001950, fd=11, evb=0x7f6910000af0, state=2, events=2
I0414 03:18:42.576925 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 1
I0414 03:18:42.576954 13215 AsyncSocket.cpp:192] new AsyncSocket(0x7f69100022f0, evb=0x7f6910000af0)
I0414 03:18:42.577000 13215 AsyncSocket.cpp:383] AsyncSocket::connect(this=0x7f69100022f0, evb=0x7f6910000af0, fd=12, host=[::1]:8070
I0414 03:18:42.577679 13215 AsyncSocket.cpp:1750] AsyncSocket::updateEventRegistration(this=0x7f6910001950, fd=11, evb=0x7f6910000af0, state=2, events=0
I0414 03:18:42.577715 13215 AsyncSocket.cpp:250] AsyncSocket::destroy(this=0x7f6910001950, evb=0x7f6910000af0, fd=11, state=2
I0414 03:18:42.577729 13215 AsyncSocket.cpp:812] AsyncSocket::closeNow(): this=0x7f6910001950, fd_=11, state=2, shutdownFlags=0
I0414 03:18:42.577813 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 0
I0414 03:18:42.578115 13215 AsyncSocket.cpp:1401] AsyncSocket::handleWrite() this=0x7f69100022f0, fd=12, state=1
I0414 03:18:42.578132 13215 AsyncSocket.cpp:1573] AsyncSocket::handleConnect() this=0x7f69100022f0, fd=12, state=1
I0414 03:18:42.578147 13215 AsyncSocket.cpp:1750] AsyncSocket::updateEventRegistration(this=0x7f69100022f0, fd=12, evb=0x7f6910000af0, state=2, events=2
I0414 03:18:42.578207 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 0
I0414 03:18:48.651737 13215 EventBase.cpp:401] EventBase 0x7f6910000af0 loop time: 6073
1
Segmentation fault

from wangle.

 avatar commented on April 19, 2024

It turned out to be a misuse. When ClientBootstrap sets up the second connection, the original pipeline will be automatically destroyed, as ClientBootstrap.connect returns future(Pipeline*), not share_ptr.

Has to create two ClientBootstrap instances.

from wangle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.