File tree 3 files changed +15
-8
lines changed
src/libYARP_os/src/yarp/os/impl
3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change
1
+ LogForwarder_static_Bottle {#yarp-3.5}
2
+ --------------------------
3
+
4
+ ### Libraries
5
+
6
+ #### ` os `
7
+
8
+ * The ` LogForwarder ` no longer skips messages when messages are sent too
9
+ quickly (#2643 ).
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ yarp::os::impl::LogForwarder::LogForwarder()
37
37
if (!outputPort.open (logPortName)) {
38
38
printf (" LogForwarder error while opening port %s\n " , logPortName.c_str ());
39
39
}
40
- outputPort.enableBackgroundWrite (true );
41
40
outputPort.addOutput (" /yarplogger" , " fast_tcp" );
42
41
43
42
started = true ;
@@ -46,12 +45,12 @@ yarp::os::impl::LogForwarder::LogForwarder()
46
45
void yarp::os::impl::LogForwarder::forward (const std::string& message)
47
46
{
48
47
mutex.lock ();
49
- static Bottle b ;
48
+ Bottle& b = outputPort. prepare () ;
50
49
b.clear ();
51
50
std::string port = " [" + outputPort.getName () + " ]" ;
52
51
b.addString (port);
53
52
b.addString (message);
54
- outputPort.write (b );
53
+ outputPort.writeStrict ( );
55
54
mutex.unlock ();
56
55
}
57
56
@@ -68,9 +67,7 @@ void yarp::os::impl::LogForwarder::shutdown()
68
67
69
68
yarp::os::impl::LogForwarder& fw = getInstance ();
70
69
fw.forward (ost.str ());
71
- while (fw.outputPort .isWriting ()) {
72
- yarp::os::SystemClock::delaySystem (0.2 );
73
- }
70
+ fw.outputPort .waitForWrite ();
74
71
fw.outputPort .interrupt ();
75
72
fw.outputPort .close ();
76
73
}
Original file line number Diff line number Diff line change 8
8
9
9
#include < yarp/os/api.h>
10
10
11
- #include < yarp/os/Port.h>
11
+ #include < yarp/os/Bottle.h>
12
+ #include < yarp/os/BufferedPort.h>
12
13
13
14
#include < mutex>
14
15
#include < string>
@@ -32,7 +33,7 @@ class YARP_os_impl_API LogForwarder
32
33
LogForwarder& operator =(LogForwarder const &) = delete ;
33
34
34
35
std::mutex mutex;
35
- yarp::os::Port outputPort;
36
+ yarp::os::BufferedPort<yarp::os::Bottle> outputPort;
36
37
static bool started;
37
38
};
38
39
You can’t perform that action at this time.
0 commit comments