Commit 75905d9e authored by Pavel Vainerman's avatar Pavel Vainerman

backported to p9 as 2.9.4-alt0.M90P.0.5 (with rpmbph script)

parents 9ab54c02 e5cea4ff
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
Name: libuniset2 Name: libuniset2
Version: 2.9.4 Version: 2.9.4
Release: alt0.M90P.0.4 Release: alt0.M90P.0.5
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
License: LGPL-2.1 License: LGPL-2.1
...@@ -576,9 +576,12 @@ rm -f %buildroot%_docdir/%oname/html/*.md5 ...@@ -576,9 +576,12 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes # history of current unpublished changes
%changelog %changelog
* Sun Mar 28 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.4-alt0.M90P.0.4 * Wed Mar 31 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.4-alt0.M90P.0.5
- backport to ALTLinux p9 (by rpmbph script) - backport to ALTLinux p9 (by rpmbph script)
* Wed Mar 31 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.4-alt0.5
- test build for websocketgate
* Sun Mar 28 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.4-alt0.4 * Sun Mar 28 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.4-alt0.4
- [uwebsocket]: sm2 mode - [uwebsocket]: sm2 mode
......
...@@ -497,7 +497,7 @@ Poco::JSON::Object::Ptr UWebSocketGate::respError( Poco::Net::HTTPServerResponse ...@@ -497,7 +497,7 @@ Poco::JSON::Object::Ptr UWebSocketGate::respError( Poco::Net::HTTPServerResponse
return jdata; return jdata;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UWebSocketGate::onWebSocketSession(Poco::Net::HTTPServerRequest& req, Poco::Net::HTTPServerResponse& resp) void UWebSocketGate::onWebSocketSession( Poco::Net::HTTPServerRequest& req, Poco::Net::HTTPServerResponse& resp)
{ {
using Poco::Net::WebSocket; using Poco::Net::WebSocket;
using Poco::Net::WebSocketException; using Poco::Net::WebSocketException;
...@@ -597,7 +597,6 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco:: ...@@ -597,7 +597,6 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco::
auto idlist = uniset::explode(slist); auto idlist = uniset::explode(slist);
{ {
uniset_rwmutex_wrlock lock(wsocksMutex);
ws = make_shared<UWebSocket>(req, resp); ws = make_shared<UWebSocket>(req, resp);
ws->setHearbeatTime(wsHeartbeatTime_sec); ws->setHearbeatTime(wsHeartbeatTime_sec);
ws->setSendPeriod(wsSendTime_sec); ws->setSendPeriod(wsSendTime_sec);
...@@ -611,6 +610,7 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco:: ...@@ -611,6 +610,7 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco::
ws->ask(i); ws->ask(i);
} }
uniset_rwmutex_wrlock lock(wsocksMutex);
wsocks.emplace_back(ws); wsocks.emplace_back(ws);
} }
...@@ -620,7 +620,7 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco:: ...@@ -620,7 +620,7 @@ std::shared_ptr<UWebSocketGate::UWebSocket> UWebSocketGate::newWebSocket( Poco::
return ws; return ws;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UWebSocketGate::delWebSocket(std::shared_ptr<UWebSocket>& ws ) void UWebSocketGate::delWebSocket( std::shared_ptr<UWebSocket>& ws )
{ {
uniset_rwmutex_wrlock lock(wsocksMutex); uniset_rwmutex_wrlock lock(wsocksMutex);
...@@ -635,9 +635,8 @@ void UWebSocketGate::delWebSocket(std::shared_ptr<UWebSocket>& ws ) ...@@ -635,9 +635,8 @@ void UWebSocketGate::delWebSocket(std::shared_ptr<UWebSocket>& ws )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
const std::string UWebSocketGate::UWebSocket::ping_str = "{\"data\": [{\"type\": \"Ping\"}]}";
UWebSocketGate::UWebSocket::UWebSocket(Poco::Net::HTTPServerRequest* _req, UWebSocketGate::UWebSocket::UWebSocket( Poco::Net::HTTPServerRequest* _req,
Poco::Net::HTTPServerResponse* _resp): Poco::Net::HTTPServerResponse* _resp):
Poco::Net::WebSocket(*_req, *_resp), Poco::Net::WebSocket(*_req, *_resp),
req(_req), req(_req),
...@@ -694,7 +693,7 @@ bool UWebSocketGate::UWebSocket::isActive() ...@@ -694,7 +693,7 @@ bool UWebSocketGate::UWebSocket::isActive()
return iosend.is_active(); return iosend.is_active();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UWebSocketGate::UWebSocket::set(ev::dynamic_loop& loop, std::shared_ptr<ev::async> a ) void UWebSocketGate::UWebSocket::set( ev::dynamic_loop& loop, std::shared_ptr<ev::async> a )
{ {
iosend.set(loop); iosend.set(loop);
ioping.set(loop); ioping.set(loop);
...@@ -749,6 +748,8 @@ void UWebSocketGate::UWebSocket::send( ev::timer& t, int revents ) ...@@ -749,6 +748,8 @@ void UWebSocketGate::UWebSocket::send( ev::timer& t, int revents )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
const std::string UWebSocketGate::UWebSocket::ping_str = "."; // "{\"data\": [{\"type\": \"Ping\"}]}";
void UWebSocketGate::UWebSocket::ping( ev::timer& t, int revents ) void UWebSocketGate::UWebSocket::ping( ev::timer& t, int revents )
{ {
if( EV_ERROR & revents ) if( EV_ERROR & revents )
...@@ -799,11 +800,11 @@ void UWebSocketGate::UWebSocket::read( ev::io& io, int revents ) ...@@ -799,11 +800,11 @@ void UWebSocketGate::UWebSocket::read( ev::io& io, int revents )
if( (flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING) if( (flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PING)
{ {
sendFrame(rbuf, n, WebSocket::FRAME_OP_PONG); sendFrame(rbuf, n, WebSocket::FRAME_FLAG_FIN | WebSocket::FRAME_OP_PONG);
return; return;
} }
if( (flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_PONG) if( (flags & WebSocket::FRAME_OP_BITMASK) & WebSocket::FRAME_OP_PONG )
return; return;
...@@ -926,7 +927,7 @@ void UWebSocketGate::UWebSocket::sensorInfo( const uniset::SensorMessage* sm ) ...@@ -926,7 +927,7 @@ void UWebSocketGate::UWebSocket::sensorInfo( const uniset::SensorMessage* sm )
ioping.stop(); ioping.stop();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void UWebSocketGate::UWebSocket::doCommand(const std::shared_ptr<SMInterface>& ui ) void UWebSocketGate::UWebSocket::doCommand( const std::shared_ptr<SMInterface>& ui )
{ {
if( qcmd.empty() ) if( qcmd.empty() )
return; return;
...@@ -1171,7 +1172,7 @@ void UWebSocketGate::UWebSocket::write() ...@@ -1171,7 +1172,7 @@ void UWebSocketGate::UWebSocket::write()
} }
catch( WebSocketException& exc ) catch( WebSocketException& exc )
{ {
cerr << "(sendFrame): ERROR: " << exc.displayText() << endl; mylog3 << "(sendFrame): ERROR: " << exc.displayText() << endl;
switch( exc.code() ) switch( exc.code() )
{ {
......
...@@ -297,11 +297,6 @@ ...@@ -297,11 +297,6 @@
./extensions/UniNetwork/uninet.cc ./extensions/UniNetwork/uninet.cc
./extensions/UWebSocketGate/main.cc ./extensions/UWebSocketGate/main.cc
./extensions/UWebSocketGate/Makefile.am ./extensions/UWebSocketGate/Makefile.am
./extensions/UWebSocketGate.old/main.cc
./extensions/UWebSocketGate.old/Makefile.am
./extensions/UWebSocketGate.old/UWebSocketGate.cc
./extensions/UWebSocketGate.old/UWebSocketGate.h
./extensions/UWebSocketGate.old/UWebSocketGateSugar.h
./extensions/UWebSocketGate/tests/Makefile.am ./extensions/UWebSocketGate/tests/Makefile.am
./extensions/UWebSocketGate/tests/tests_with_sm.cc ./extensions/UWebSocketGate/tests/tests_with_sm.cc
./extensions/UWebSocketGate/tests/test_uwebsocketgate.cc ./extensions/UWebSocketGate/tests/test_uwebsocketgate.cc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment