TCP transport now basically works. Still some bugs to squash.

This commit is contained in:
miha_vitorovic
2011-01-07 09:53:33 +01:00
parent 387d8aa0dc
commit 71b9dfec6d
3 changed files with 20 additions and 20 deletions

View File

@@ -417,11 +417,6 @@ namespace epics {
void BlockingTCPTransport::processReadCached(bool nestedCall,
ReceiveStage inStage, int requiredBytes, bool addToBuffer) {
// TODO remove debug
errlogSevPrintf(errlogInfo,
"processReadCached(%d, %d, %d, %d), _stage: %d",
nestedCall, inStage, requiredBytes, addToBuffer, _stage);
try {
while(!_closed) {
if(_stage==READ_FROM_SOCKET||inStage!=NONE) {
@@ -458,11 +453,6 @@ namespace epics {
int requiredPosition = (currentStartPosition
+requiredBytes);
// TODO remove debug
errlogSevPrintf(errlogInfo,
"requredPos:%d, buffer->pos:%d",
requiredPosition, _socketBuffer->getPosition());
while(_socketBuffer->getPosition()<requiredPosition) {
// read
char readBuffer[MAX_TCP_RECV];
@@ -472,12 +462,6 @@ namespace epics {
maxToRead, 0);
_socketBuffer->put(readBuffer, 0, bytesRead);
// TODO remove debug
if(bytesRead>0) errlogSevPrintf(
errlogInfo,
"***!!! got %d bytes of %d (reqPos=%d)!!!***",
bytesRead, requiredBytes, requiredPosition);
if(bytesRead<0) {
// error (disconnect, end-of-stream) detected
close(true);

View File

@@ -26,6 +26,15 @@ PROD_HOST += testChannelSearchManager
testChannelSearchManager_SRCS += testChannelSearchManager.cpp
testChannelSearchManager_LIBS += pvData pvAccess Com
PROD_HOST += testBlockingTCPSrv
testBlockingTCPSrv_SRCS += testBlockingTCPSrv.cpp
testBlockingTCPSrv_LIBS += pvData pvAccess Com
PROD_HOST += testBlockingTCPClnt
testBlockingTCPClnt_SRCS += testBlockingTCPClnt.cpp
testBlockingTCPClnt_LIBS += pvData pvAccess Com
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE

View File

@@ -29,14 +29,19 @@ using std::sscanf;
class ContextImpl : public Context {
public:
ContextImpl() :
_tr(new TransportRegistry()),
_timer(new Timer("client thread", lowPriority)) {}
_tr(new TransportRegistry()), _timer(new Timer("client thread",
lowPriority)) {
}
virtual ~ContextImpl() {
delete _tr;
delete _timer;
}
virtual Timer* getTimer() { return _timer; }
virtual TransportRegistry* getTransportRegistry() { return _tr; }
virtual Timer* getTimer() {
return _timer;
}
virtual TransportRegistry* getTransportRegistry() {
return _tr;
}
private:
TransportRegistry* _tr;
Timer* _timer;
@@ -47,6 +52,8 @@ public:
virtual void handleResponse(osiSockAddr* responseFrom,
Transport* transport, int8 version, int8 command, int payloadSize,
ByteBuffer* payloadBuffer) {
if(command==CMD_CONNECTION_VALIDATION) transport->verified();
}
};